flat assembler
Message board for the users of flat assembler.
Index
> Windows > vk_escape |
Author |
|
decard 08 Feb 2006, 12:56
Maybe some child window traps this message?
|
|||
08 Feb 2006, 12:56 |
|
shoorick 08 Feb 2006, 13:21
try to catch wm_command and check 1 for ok and 2 for esc (?) what a window subclassed: child on dialog?
|
|||
08 Feb 2006, 13:21 |
|
Crukko 09 Feb 2006, 06:48
Decard: I don't know....may be....but wich one?
I think it's better put here the code Thx to Madis731 Code: proc WinConverterDialogProc hWnd,msg,wParam,lParam push ebx edi ;Preserve as needed cmp [msg],WM_COMMAND ;Are there any commands? je command ;then deal with them cmp [msg],WM_CLOSE ;or is it "close"? je close ;so, do it! cmp [msg],WM_INITDIALOG je initdialog xor eax,eax jmp processed command: cmp [wParam],EN_UPDATE shl 16 + ID_WINDEC je parseD ;compare and jump accordingly cmp [wParam],EN_UPDATE shl 16 + ID_WINHEX je parseH ;H-hexadecimal cmp [wParam],EN_UPDATE shl 16 + ID_WINBIN je parseB ;B-binary jmp processed ;If defaults have been re-set ;<<<-c800----CODE TO UPDATE CELLS WHEN TYPED---------------->>> parseD: ;Jump from above commands jmp processed ;we are finished parseH: jmp processed parseB: jmp processed initdialog: push [hWnd] pop [hWinConverterDialog] invoke GetDlgItem, [hWnd], ID_WINDEC;get a handle and use it mov [hwindec], eax invoke GetDlgItem, [hWnd], ID_WINBIN;get a handle and use it mov [hwinbin], eax invoke GetDlgItem, [hWnd], ID_WINHEX;get a handle and use it mov [hwinhex], eax invoke GetDlgItem, [hWnd], ID_WINEXP;get a handle and use it mov [hwinexp], eax invoke SendMessage, [hWnd], WM_SETFONT, _lf, TRUE invoke SendMessage, [hwindec], EM_SETLIMITTEXT, 10, 0 invoke SendMessage, [hwinhex], EM_SETLIMITTEXT, 8, 0 invoke SendMessage, [hwinbin], EM_SETLIMITTEXT, 32, 0 invoke GetWindowLong, [hwindec], GWL_WNDPROC mov [hwindec_proc], eax invoke SetWindowLong, [hwindec], GWL_WNDPROC, WinConverterNewProc invoke GetWindowLong, [hwinbin], GWL_WNDPROC mov [hwinbin_proc], eax invoke SetWindowLong, [hwinbin], GWL_WNDPROC, WinConverterNewProc invoke GetWindowLong, [hwinhex], GWL_WNDPROC mov [hwinhex_proc], eax invoke SetWindowLong, [hwinhex], GWL_WNDPROC, WinConverterNewProc invoke GetWindowLong, [hwinexp], GWL_WNDPROC mov [hwinexp_proc], eax invoke SetWindowLong, [hwinexp], GWL_WNDPROC, WinConverterNewProc mov eax, dword TRUE jmp processed close: invoke EndDialog,[hWnd],0 ;We only get here when closing processed: pop edi ebx ;Put values back ret endp proc WinConverterNewProc hWnd,msg,wParam,lParam mov ecx, [hWnd] cmp [msg], WM_KEYDOWN je .wmkeydown cmp [msg], WM_CHAR je .wmchar .oldcall: cmp ecx, [hwindec] jne .cnt1 mov ebx, [hwindec_proc] jmp .cnt_ok .cnt1: cmp ecx, [hwinbin] jne .cnt2 mov ebx, [hwinbin_proc] jmp .cnt_ok .cnt2: cmp ecx, [hwinhex] jne .cnt3 mov ebx, [hwinhex_proc] jmp .cnt_ok .cnt3: cmp ecx, [hwinexp] jne .cnt4 mov ebx, [hwinexp_proc] jmp .cnt_ok .cnt4: .cnt_ok: invoke CallWindowProc, ebx, [hWnd], [msg], [wParam], [lParam] ret .wmkeydown: cmp [wParam], VK_F1 je .tasto_F1 cmp [wParam], VK_RETURN je .tasto_escape ; cmp [wParam], VK_ESCAPE ; je .tasto_escape stdcall _Strs, [wParam], __Hex, Buff1 invoke MessageBox, NULL, Buff1, AppName, NULL jmp .oldcall .tasto_F1: invoke MessageBox, NULL, AppName, AppName, NULL jmp .oldcall .tasto_escape: invoke MessageBox, NULL, AppName, AppName, NULL invoke SetFocus, [hAsmEditwin] jmp .oldcall .wmchar: invoke MessageBox, NULL, AppName, AppName, NULL cmp [wParam], VK_ESCAPE je .tasto_escape jmp .oldcall and here the dialog Code: dialog WinConterdterD,'WinConterter', 560,234,240,80,WS_CAPTION+WS_POPUP+DS_MODALFRAME+WS_EX_TOOLWINDOW ;WS_SYSMENU+ dialogitem 'STATIC', 'Dec:', ID_WINDECstatic,0,7,22,12,WS_VISIBLE+ES_CENTER dialogitem 'STATIC', 'Bin:', ID_WINBINstatic,0,22,22,12,WS_VISIBLE+ES_CENTER dialogitem 'STATIC', 'Hex:', ID_WINHEXstatic,0,37,22,12,WS_VISIBLE+ES_CENTER dialogitem 'STATIC', 'Exp:', ID_WINEXPstatic,0,52,22,12,WS_VISIBLE+ES_CENTER dialogitem 'EDIT', '', ID_WINDEC,22,5,178,12,WS_VISIBLE+WS_BORDER+WS_TABSTOP+ES_AUTOHSCROLL+ES_UPPERCASE dialogitem 'EDIT', '', ID_WINBIN,22,20,178,12,WS_VISIBLE+WS_BORDER+WS_TABSTOP+ES_AUTOHSCROLL+ES_UPPERCASE dialogitem 'EDIT', '', ID_WINHEX,22,35,178,12,WS_VISIBLE+WS_BORDER+WS_TABSTOP+ES_AUTOHSCROLL+ES_UPPERCASE dialogitem 'EDIT', '', ID_WINEXP,22,52,206,12,WS_VISIBLE+WS_BORDER+WS_TABSTOP+ES_AUTOHSCROLL+ES_UPPERCASE enddialog |
|||
09 Feb 2006, 06:48 |
|
Crukko 09 Feb 2006, 06:55
shoorick: with subclass you can get msg of a window before the winproc process it so you can do something you want and then let the window process msg normally.
For code of subclass do a search in the forum, you'll find an example.....if you still need help, ask me again, ok? BtW: you can also find another way to do subclassing in the code I put in this post |
|||
09 Feb 2006, 06:55 |
|
shoorick 09 Feb 2006, 08:37
ok btw, i already found something there: http://board.flatassembler.net/topic.php?t=4359
also, you have note that dialog window do not send all messages to its children, for this you can read about WM_GETDLGCODE message regards! |
|||
09 Feb 2006, 08:37 |
|
Crukko 09 Feb 2006, 08:48
Great!
Do you have an example of using that msg ???? |
|||
09 Feb 2006, 08:48 |
|
shoorick 09 Feb 2006, 09:37
only in masm: http://www.winasm.net/forum/index.php?showtopic=385
|
|||
09 Feb 2006, 09:37 |
|
Crukko 09 Feb 2006, 09:58
can you post here the file, pls?
|
|||
09 Feb 2006, 09:58 |
|
shoorick 09 Feb 2006, 10:08
ok but it was written not by me!
_________________ UNICODE forever! |
|||
09 Feb 2006, 10:08 |
|
Crukko 09 Feb 2006, 10:20
ok, don't worry thx 1000
but there is a problem: using WM_GETDLGCODE now the tab key doesn't work! if I want to change the focus I have to write more code than process another key for my purpose |
|||
09 Feb 2006, 10:20 |
|
shoorick 09 Feb 2006, 10:41
i just know about this msg, but did not use it in own code. read more about codes returned on WM_GETDLGCODE : try another combinations instead of DLGC_WANTALLKEYS (eg.: DLGC_DEFPUSHBUTTON etc.)
|
|||
09 Feb 2006, 10:41 |
|
shoorick 06 Mar 2006, 14:59
here is test application: it will catch in upper editor pressing of enter, ctrl+enter, escape, arrows, tab, shift+tab, pgdn/pgup, ctrl+home and ctrl+end, and shift+del, and show matching number in lower editor.
_________________ UNICODE forever! |
|||||||||||
06 Mar 2006, 14:59 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.