The code below is my response to WM_CREATE in my window and i was wondering if anyone sees anything wrong with it specifically for the thread that is created. Sometimes my thread does not display all the graphic information its suppose too. Are my creates in the right order?

Any help appreciated.
________________________________________________

.ELSEIF uMsg==WM_CREATE
invoke GetDC,hWnd <<(OWN_DC specified in CreateWindow)
mov hdc,eax
invoke SetICMMode,hdc,ICM_ON
invoke CreateCompatibleDC,NULL
mov cdc,eax
invoke SetICMMode,cdc,ICM_ON

mov eax,OFFSET ThreadProc
invoke CreateThread,NULL,NULL,eax,\
hWnd,0,\
ADDR ThreadID
mov Threadh,eax


invoke CloseHandle,Threadh
Posted on 2001-10-08 21:24:55 by titan
Technically, I don't see anything wrong with your code. If hWnd is the window handle passed to you by the window proc, it's valid. However, you should realize that when you receive WM_CREATE, even though your window is already created, it's not visible yet. So if your thread procedure wants some graphical information that is only available when the window is visible, that info may be missed. This is a situation when the "error" sometimes occurs and sometimes doesn't. If your thread procedure is slower than the main thread, the window will be visible by the time your thread proc wants to display the info. Otherwise, some info may be missing.
However, the above discussion is my guesswork. It might not be applicable in your case.
Posted on 2001-10-09 00:32:57 by Iczelion
Iczelion thanx

I think i found the problem

It may have been in this line:

invoke CreateCompatibleDC,NULL

I changed it to:

invoke CreateCompatibleDC,hdc


So far its working ok

Thanx again



:alright:
Posted on 2001-10-09 00:51:18 by titan
titan,

Iczelion has a good point there, at the stage of startup of an application using a window, the hWnd for the main window does not yet exist so if you use a handle for the window, you MUST use the one passed to the WndProc procedure in the WM_CREATE message processing.

Regards,

hutch@pbq.com.au
Posted on 2001-10-09 05:23:50 by hutch--