flat assembler
Message board for the users of flat assembler.
Index
> Windows > Strange behaviour of function |
Author |
|
dmitriy566 06 Jul 2012, 17:31
Hello!
I want to describe my problem. I write code that switches screen into fullscreen mode and one can draw rectangles by mouse. Firstly i have initialisation: Code: invoke GetClientRect,[hwnd],rc mov [drawf],1 call Init_OpenGL If i comment Init_OpenGL call here but use the same call in WndProc on event WM_CREATE then I have no initialisation and no draw. If i copy code from Init_OpenGL to handler of WM_CREATE(it is commented) it works, but call Init_OpenGL not works. I cannot understand such behavior. Thank you for explanation.
|
|||||||||||
06 Jul 2012, 17:31 |
|
bzdashek 06 Jul 2012, 21:29
Please clarify, does the attached file work without modification?
Because I launched the program and it works - i can draw those rectangles. Win7 x64 |
|||
06 Jul 2012, 21:29 |
|
dmitriy566 07 Jul 2012, 05:50
Sorry, forget post
|
|||||||||||
07 Jul 2012, 05:50 |
|
bzdashek 07 Jul 2012, 06:37
The problem was, that you used global [hwnd] in InitOpen_GL, but it gets initialized only after CreateWindow, but WM_CREATEWINDOW get processed during CreateWindow call. So when you call InitOpen_GL, the global [hwnd] variable is NULL.
Code: proc Init_OpenGL invoke GetDC,[hwnd] ;hwnd is null I modified the InitOpen_GL, added [hwnd] parameter, so hwnd can be passed to it. Now it works. Code: ;... .wmcreate stdcall Init_OpenGL,[hwnd] ;... proc Init_OpenGL uses edi,hwnd:DWORD invoke GetDC,[hwnd] ;... The second variant: you can also initialize global [hwnd] from WM_CREATEWINDOW handler, but then you should rename it to [hWnd] for example, otherwise you won't be able to access it.
|
|||||||||||
07 Jul 2012, 06:37 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.