flat assembler
Message board for the users of flat assembler.
Index
> Windows > Windows 10 combobox exit from my program. |
Author |
|
revolution 15 Dec 2020, 08:46
Using SendMessage will place a new message into the queue. So if your loop keeps sending itself messages then the stack eventually overflows and problems happen.
|
|||
15 Dec 2020, 08:46 |
|
Roman 15 Dec 2020, 08:50
How i do peekmessage
Code: .1: invoke PeekMessage,msg, 0, 0, 0, PM_REMOVE test eax,eax jz .2 invoke TranslateMessage, msg invoke DispatchMessage, msg .2: IfPressedKey VK_F6,.3 ;if not pressed jmp .3 invoke SendMessage,[ComboUserTxt],dword WM_GETTEXT,dword 10,Status22+2000 invoke MessageBoxA,0,Status22+2000,0,0 ;i see text from combobox .3: invoke Sleep,10 jmp .1 I not SendMessage always , only if VK_F6 key pressed ! But one pressed VK_F6 and my prograg after MessageBox close. |
|||
15 Dec 2020, 08:50 |
|
revolution 15 Dec 2020, 09:04
Try using PostMessage instead.
|
|||
15 Dec 2020, 09:04 |
|
Roman 15 Dec 2020, 09:14
invoke PostMessage,[ComboUserTxt],dword WM_GETTEXT,dword 20,Status22+2000
as like SendMessage close my program too. |
|||
15 Dec 2020, 09:14 |
|
Roman 15 Dec 2020, 09:17
Hm ?! Maybe i write wrong MSG struct (32 bits ) ?
Code: struct MSG 32 bits hwnd dd ? message dd ? wParam dd ? lParam dd ? time dd ? pt POINT ends struct MSG 64 bits hwnd dq ? message dd ?,? wParam dq ? lParam dq ? time dd ? pt POINT dd ? ends Not help. |
|||
15 Dec 2020, 09:17 |
|
Roman 15 Dec 2020, 09:38
I using FEDIT.dll
without FEDIT window my program not close ! Strange ? I try without FEDIT window ,but some time my program work fine and some times close. |
|||
15 Dec 2020, 09:38 |
|
Roman 15 Dec 2020, 11:06
I found my problem in IDA Pro 64 bits !
SendMessage change stack values ! And after SendMessage i do my cominvk Direct2D ! And Direct2D drawBitmap crash on stack ! I fix. Clear stack Code: mov qword [rsp+40h-20h+8],0 And do Direct2D drawBitmap. Now all work fine ! PS: I am scared, and already thought its problem Windows 10. |
|||
15 Dec 2020, 11:06 |
|
revolution 15 Dec 2020, 11:19
Roman wrote: SendMessage change stack values ! |
|||
15 Dec 2020, 11:19 |
|
Roman 15 Dec 2020, 14:44
Quote:
Yes. You right. Its my mistake. |
|||
15 Dec 2020, 14:44 |
|
Ali.Z 16 Dec 2020, 03:21
Roman wrote:
instead use WaitMessage function, as for getting notified for key presses just register a hotkey and make a CALLBACK procedure then do whatever you wish there. this way you can keep your message loop clean and you should not experience delay in messages when your application under heavy load. _________________ Asm For Wise Humans |
|||
16 Dec 2020, 03:21 |
|
Furs 16 Dec 2020, 15:35
revolution wrote: Using SendMessage will place a new message into the queue. So if your loop keeps sending itself messages then the stack eventually overflows and problems happen. Note that GetMessage will actually process the SendMessage queue (sent from another thread), but it won't return it as a message, so it happens "behind the scenes", unlike messages posted by PostMessage (which you'll have to dispatch after with DispatchMessage or simply inspect/drop them). What it does is it calls the respective window proc with the message, waiting for it to return and all. When it's cross-thread/process, it still waits for result (via synchronization) but then the target thread needs to be processing messages. tl;dr: Assume SendMessage doesn't work with queues. Microsoft clearly tried to make it seem this way. |
|||
16 Dec 2020, 15:35 |
|
Ali.Z 17 Dec 2020, 00:25
basically same as what Furs said regarding SendMessage.
WIN32.HLP wrote: If the specified window was created by the calling thread, the window procedure is called immediately as a subroutine. If the specified window was created by a different thread, Windows switches to that thread and calls the appropriate window procedure. Messages sent between threads are processed only when the receiving thread executes message retrieval code. The sending thread is blocked until the receiving thread processes the message. but to be honest, i dont believe most documentation as a result with microsoft windows the expectation based on documents is not identical to the reality when using those functions. _________________ Asm For Wise Humans |
|||
17 Dec 2020, 00:25 |
|
Furs 17 Dec 2020, 16:50
Yeah it's good to be cautious like that. In this case, though, it's true, since Wine implements it that way as well, and it has a lot of unit tests to test the actual behavior of the Windows API (rather than blindly trust the docs, which are sometimes wrong).
|
|||
17 Dec 2020, 16:50 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.