flat assembler
Message board for the users of flat assembler.
Index
> Windows > Message loop |
Author |
|
bitRAKE 03 Jun 2013, 14:36
_________________ ¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup |
|||
03 Jun 2013, 14:36 |
|
Sasha 03 Jun 2013, 14:46
Just after posting this, I understood, that my axample goes to error on ALL negative numbers. Here is another, better example:
Code: MessageLoop: invoke GetMessage,Msg,0,0,0 or eax,eax je finish inc eax je GetMessageError invoke TranslateMessage,Msg invoke DispatchMessage,Msg jmp MessageLoop |
|||
03 Jun 2013, 14:46 |
|
Sasha 03 Jun 2013, 14:55
bitRAKE wrote: http://blogs.msdn.com/b/oldnewthing/archive/2013/03/22/10404367.aspx Thanks. Your article says, that if you're sure in the parameters you are passing to GetMessage, means they are hardcoded and tested in compiler time you will never get a -1 |
|||
03 Jun 2013, 14:55 |
|
Sasha 03 Jun 2013, 15:07
The code in Ddraw example and also, I've seen this somewhere else, uses GetMessage after the PeekMessage shows that there is a message pending. Why not just get it with PM_REMOVE?
Code: messageLoop: invoke PeekMessage,Msg,NULL,0,0,PM_REMOVE or eax,eax jne ismessage dosomething: ;Do something jmp messageloop ismessage: cmp [Msg.message],WM_QUIT je finish invoke TranslateMessage,Msg invoke DispatchMessage,Msg jmp messageloop finish: invoke ExitProcess,[Msg.wParam] |
|||
03 Jun 2013, 15:07 |
|
baldr 04 Jun 2013, 21:16
Sasha wrote: Thanks. Your article says, that if you're sure in the parameters you are passing to GetMessage, means they are hardcoded and tested in compiler time you will never get a -1 As about PeekMessage(…, PM_REMOVE), it's better to handle input in separate thread than to intersperse output routine with occasional input checks. Your suggestion seems pretty valid though (another method may be using WM_TIMER for redraws). |
|||
04 Jun 2013, 21:16 |
|
Sasha 05 Jun 2013, 12:12
I'm thinking about putting the entire window creation to a separate thread. To have something like CreateWindowAsync.
I think that filtering messages and hwnds is not a good thing. |
|||
05 Jun 2013, 12:12 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.