|
Excellent comment Mark. So, if a developer cannot depend on the order of events, how then does one determine when a windows object is fully instantiated? Another thread says to use IsWindow() to determine when things are ready to go... but this would seem to me to be a bit of a polling solution.
Charlie Gilley
Will program for food...
Whoever said children were cheaper by the dozen... lied.
Overheard in a cubicle: "A project is just a bug under development."
Seeking to rise above the intelligence of a one eared rabbit...
Caught in a vortex of weirdness...
|
|
|
|
|
charlieg wrote: how then does one determine when a windows object is fully instantiated?
If you create a window yourself, then the returned HWND from the create API
is (obviously) valid.
*Sorry, I hit the Post message button LOL*
From the window proc's point of view, the effective lifetime of the window is from
WM_CREATE/WM_INITDIALOG to WM_NCDESTROY.
As far as documentation, you can kind of follow it from CreateWindow...
CreateWindow()
"Before returning, CreateWindow sends a WM_CREATE message to the window procedure."
WM_CREATE
"The window procedure of the new window receives this message after the window is created,
but before the window becomes visible."
WM_DESTROY
"It is sent to the window procedure of the window being destroyed after the window is removed
from the screen."
"During the processing of the message, it can be assumed that all child windows still exist."
WM_NCDESTROY
"The WM_NCDESTROY message is sent after the child windows have been destroyed. In contrast,
WM_DESTROY is sent before the child windows are destroyed."
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
hello,
I made my own browser by using CHtmlView,
and I would like to add some functions which are.....
1) I want to active focus to link which is the very first tab in red color.
2) if i press down Key which is in my keyboard, i would like to move
the active focus to next other link or check box ... etc. (similar to pressing Tab Key)
3) if i press up Key which is in my keyboard, i would like to move
the active focus to back to previous link or check box ...etc.
4) if i press right Key the current active focus link goes to it's other site.
to do these I reviewed the IHTML Interfaces...but couldn't found it.
so I would like to know the IHTML Interface and the method which will do the job
what i want...and I also want to know how could I call the IHTML Interface.
thanks for reading....please help~~~~
heres my signature
|
|
|
|
|
I am using a class derived from clistctrl. I am using the CreateDragImage function to create the image shown when dragging. My understanding is that this should create an image of both the icon displayed as well as the text for the particular item I am dragging, however all I am getting is the icon with no text. I am sure this has something to do with the fact that this is a derived class, but does anyone know any other workarounds for getting the text to display in the drag image?
Thanks,
Derrick
|
|
|
|
|
I dont know if I may have to manually create the bitmap image of the text and put that in the imagelist. If so does anyone know how to do that?
|
|
|
|
|
Hi all,
I'm making use of an ODBC class written by Carlos Antollini called 'A set of ODBC Classes'. The problem is that in my one function I create an instance of the class and connect to a database. Then I dissconnect. Then later on I start another funtion to perform some transactions of the database, but the I receive an error stating: Exception Message: External exception C0000008. I think it has something to do with the allocation of the environment handle. Because if I remove the first function call it works. But the later on, on a next call it fails again. It fails on this call:
ret = SQLDriverConnect(m_hDbc,
hWnd,
(SQLCHAR*)szConnStr,
SQL_NTS,
(SQLCHAR*)szConnStrOut,
sizeof(szConnStrOut),
&pcbConnStrOut,
(SQLUSMALLINT)drvConn);
Can one assign more than one environment handle when creating more than one instance of the class???
Can anyone please help me.
Many thanks in advance
Regards,
-- modified at 8:20 Tuesday 4th September, 2007
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|
|
Hey Friends i m new to database programming using VC++.
where do i find articles on MS ACCESS and vc++.
thanks in advance:
|
|
|
|
|
they are very much available in this codeproject as well as codeguru.com.
|
|
|
|
|
If you see Database section on the codeproject you see lot of articles about access,sql,oracle,...
|
|
|
|
|
I created a thread using CreateThread,that I can get the ID of the thread.
I want to terminate the thread now.
I know I can use terminatethread to end it.
But it says that using that way is not a good method.
And I try to use PostThreadMessage(threadID,WM_QUIT,0,0),but the thread would not end!
Someone would like to tell me how to end the thread except using terminatethread?(And I did not use CWinThread).Thanks.
GOOD LUCK
|
|
|
|
|
|
It really a excellent solution of terminating a thread.
But if we do not use MFC,how should do such thing?
|
|
|
|
|
The solution explained there has nothing to do with MFC: you just use a flag that you set from another thread. In your thread loop, check for this flag end stop looping once it is set.
|
|
|
|
|
Use the technique described in Newcomer's article: wait for some handles to synchronization objects with a call to ::WaitForMultipleObjects() where one of them (preferably the first one for priority reasons) is signaled when the thread should terminate.
After you have set this event you should wait on the thread handle with ::WaitForSingleObject() to know when the thread has finished completely to be able to clean up the trhead object and other resources you have claimed for the thread.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
From which thread you called PostThreadMessage()?
AJay
|
|
|
|
|
In the main process like a dialog,I create the thread and post the message
|
|
|
|
|
Perhaps the worker thread doesn't even have a message pump!
Steve
|
|
|
|
|
Using the ReadFile() api, how would one determine if the bytes being read are ASCII, MBCS, UNICODE or even UTF8?
|
|
|
|
|
Actually the first few bytes of files is used to identify the type of encoding. For example for plain ascill there will not be any speciall bytes.
For UNICODE - FF FE
For UTF-8 - EF BB BF
|
|
|
|
|
It is only for .txt files only. Am I right?
- NS -
|
|
|
|
|
May be. But all other file formats( having text data ) are applications specific such as doc or xls. So its there own implementation.
|
|
|
|
|
This won't work in my situation since I'm not actually reading a file but a pipe. I'm diverting the putput of a console, so the bytes being read could either be ascii or unicode, but I have yet to find an easy way to determine which.
|
|
|
|
|
I have a owner-draw dialog,I change its default color to blue.But when the dialog was minimized,there would be a thin rectange left on the screen.
Someone would like to tell me why and how to resolve it?
Thanks.
GOOD LUCK
|
|
|
|
|
What do you mean by "owner-draw dialog"?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
What I mean is that,the rect of the dialog based window is not the nomal rectange but round rectange or other shape.I also paint its color no longer than gray.
Then,when the dialog is minimized,there would be a thin frame on the screen!
|
|
|
|