|
Stephen Hewitt wrote: In short: calling TerminateThread is reckless and dangerous and almost never safe. After calling TerminateThread the process is in an unknown and possibly invalid state.
In short (IMHO): calling TerminateThread maybe the last option in situation like the ont the OP depicted (unless you can change the overall design the way you suggested).
Stephen Hewitt wrote: You can not make quality software like this.
I agree on the above.
Cheers.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Don't use TerminateThread . See here[^] for why not.
Steve
|
|
|
|
|
Thanks steve, lots of points to be noted. Also nice that there's .net illustration too. Reading them. Thanks
Press: 1500 to 2,200 messages in just 6 days? How's that possible sir?
Dr.Brad :Well,I just replied to everything Graus did and then argued with Negus for a bit.
|
|
|
|
|
Dear All;
I am hosting a microsoft web browser control (assuming it has got a variable: m_webBrowser) on a dialog box.
I want to capture a screen shot of the content of the web browser (excluding the main window).
Does anyone know or have any idea how to save the content of web browser as an image?
I have tried this:
<br />
RECT rc;<br />
HWND hWnd = m_webBrowser.GetSafeHwnd();<br />
::GetWindowRect (hWnd,&rc); <br />
HDC hDC = ::GetDC(0);<br />
HDC memDC = ::CreateCompatibleDC ( hDC );<br />
HBITMAP memBM = ::CreateCompatibleBitmap ( hDC, rc.right-rc.left, rc.bottom-rc.top );<br />
::SelectObject ( memDC, memBM );<br />
::BitBlt( memDC, 0, 0, rc.right-rc.left, rc.bottom-rc.top , hDC, rc.left, rc.top , SRCCOPY );<br />
But it only saves the visible area of the web browser and not all the content !!!
I will be very gratefull if anyone can help with this problem as it is giving me a real headache .
llp00na
|
|
|
|
|
|
I am indeed very gratefull,
Thank you very much
llp00na
|
|
|
|
|
Hi,
I am doing a fopen and fwrite,
TCHAR *szFileName = tmpnam(NULL);
FILE *pfBmpFile = fopen( szFileName, "wb" );
fwrite( lbbuddy_data, sizeof(unsigned char), __bmp_size, pfBmpFile );
fclose( pfBmpFile );
There is no problem when we create our application users as administrators on the workstation
but in this case they can not be Administrators because of security risks. So whenever i use a Non-Admin users the application crashes.
Does someone have suggestion on how to go about other than giving administrator access?
|
|
|
|
|
AnilUnni wrote: So whenever i use a Non-Admin users the application crashes.
Does someone have suggestion on how to go about other than giving administrator access?
it crashes ? you should check the return from fopen before using it in fwrite/fclose.
you'll probably have better luck if you create your temp file in the system temp folder. use SHGetSpecialFolderLocation to get the path.
|
|
|
|
|
AnilUnni wrote: TCHAR *szFileName = tmpnam(NULL);
FILE *pfBmpFile = fopen( szFileName, "wb" );
Does tmpnam() return a path that non-administrators have access to?
AnilUnni wrote: ...the application crashes.
Where?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Does tmpnam() return a path that non-administrators have access to?
No it does not so should i create a file with a name?
|
|
|
|
|
AnilUnni wrote: ...should i create a file with a name?
Last time I checked, all files had names.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
No it doesn't that was the problem. Thanks Dave
|
|
|
|
|
if use GetOpenFileName() dialog , you can delete ,rename file or folder via right key menu, how can avoid it? i use C&API, or are there any component to use,like vb's ocx, a dialog have a directory tree box and a file list box ,but how can i invoke ocx?
Help!!!!
urgent!!!!!!!!!!!!!!!
|
|
|
|
|
zhongwenjia wrote: if use GetOpenFileName() dialog , you can delete ,rename file or folder via right key menu, how can avoid it? i use C&API
See the docs for the OPENFILENAME structure Flags member: "If you want the old-style user
interface, omit the OFN_EXPLORER flag and provide a replacement old-style template or hook
procedure. If you want the old style but do not need a custom template or hook procedure, simply
provide a hook procedure that always returns FALSE."
The GetOpenFileName()[^] docs explain how to add the hookproc.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
See here.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hey DavidCrow - is your link broken or is it just me?
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Mark Salsbery wrote: is your link broken or is it just me?
It's just you me!
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi,
WIN 32 application crashes while calling a MFC DLL export function, which creates a dialog box using CDialogBox::Create().
What will be the reason?
One more doubt..How can I add MFC support to a WIN 32 Aplication?
Thankx In Advance...
|
|
|
|
|
If the MFC dialog is created on the main application thread then the main application thread needs
to be an MFC UI thread. That means your application needs to be an MFC app.
I think the easiest way to convert a Win32 app to MFC would be to create a new MFC project with
the app wizard. MFC provides the WinMain() function so...
From the Win32 code, take application-wide initialization code and put it in the new app class'
InitInstance() override. Cleanup code goes to an ExitInstance() override.
The Win32 app's main window message handling can be moved to MFC window message-map style
handlers. MFC provides the message loop.
Hope that helps get you started.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
what is the difference between const and volatile ?
and which can be the cases we use them?
Thank you
KIRAN PINJARLA
|
|
|
|
|
|
|
In brief:
const is a contract between the developer and the compiler: the developer promises not to modify the const -declared identifier and if he/she violates that contract the compiler generates an error.
volatile is used as an instruction to the compiler that the volatile -declared identifier may be modified in the background. The compiler must not optimize and cache it in a register; its memory location has to be read each time the value is requested.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Hi,
const is to say the programm that the value in this variable should not change or be modified. One easy example to use it is when you use a function e.g. SearchObject (const CString szName, const int nID)
here I'm telling that these szName and nID may not being changed inside the run of the function.
About volatile... I can't tell you more than the MSDN help says, I have never used it.
volatile Member data is loaded from memory each time it is accessed; disables certain optimizations.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
Help !!!!!!!!!!!!!!
1. I use C&WinAPI
2. to show a dialog to select file, but you cannot manipulate it
my imagine :
1. use openfile dialog and hide the right key menu
2. i know a dialog in VB, right of the dialog is a editbox show directory list, when you select any folder in that, the left side show a file list of that folder, but it is ocx, how can i invoke it?
so, how can i do for each way. and are there any other simplest way ?
|
|
|
|