flat assembler
Message board for the users of flat assembler.
Index
> Windows > AnimateWindow() worst f at all Goto page 1, 2, 3 Next |
Author |
|
revolution 19 Aug 2020, 13:44
What value does AnimateWindow return? True or False?
BTW: We can't test your code because you appear to be using some custom macros that we don't have. .data and .code, along with a three operand form of cmp. If you want better help it would be helpful to post something we can assemble ourselves. |
|||
19 Aug 2020, 13:44 |
|
DimonSoft 19 Aug 2020, 14:43
revolution wrote: to post something we can assemble ourselves. Is there some feature on the forum to avoid typing frequently used phrases? |
|||
19 Aug 2020, 14:43 |
|
Overclick 19 Aug 2020, 14:51
Don't look at my macros. It just to show where it is and how I call it. U can insert it to any Dialogue example file.
It returns ZERO at rax, that mean: 1 If the window is already visible and you are trying to show the window. 2 If the window is already hidden and you are trying to hide the window. 3 If there is no direction specified for the slide or roll animation. 4 When trying to animate a child window with AW_BLEND. 5 If the thread does not own the window. Note that, in this case, AnimateWindow fails but GetLastError returns ERROR_SUCCESS. 1)No it is minimized 2)No I don't use AW_HIDE 3)No 4)It is not Child 5)GetLastError shows nothing Does it work at Dialogue at all??? |
|||
19 Aug 2020, 14:51 |
|
revolution 19 Aug 2020, 15:09
Overclick wrote: 5)GetLastError shows nothing When you say "shows nothing", do you mean GetLastError returns zero? https://docs.microsoft.com/en-us/windows/win32/debug/system-error-codes |
|||
19 Aug 2020, 15:09 |
|
Overclick 19 Aug 2020, 15:14
Yes
|
|||
19 Aug 2020, 15:14 |
|
revolution 19 Aug 2020, 15:20
Perhaps you can show your error check code. I think you have a mistake in there. GetLastError will return an error code, not zero, when a function fails.
|
|||
19 Aug 2020, 15:20 |
|
Overclick 19 Aug 2020, 15:23
Trust me )
|
||||||||||
19 Aug 2020, 15:23 |
|
revolution 19 Aug 2020, 15:26
When do you call GetLastError? Immediately, or after some other API calls?
|
|||
19 Aug 2020, 15:26 |
|
Overclick 19 Aug 2020, 15:26
I created little example code special for revolution
Code: format PE64 GUI 5.0 entry start include 'win64a.inc' section '.text' code readable executable start: push rbp invoke GetModuleHandle,0 invoke DialogBoxParam,rax,37,HWND_DESKTOP,DialogProc,0 invoke ExitProcess,0 proc DialogProc uses rbx rsi rdi,hWnd,wMsg,wParam,lParam mov [hWnd],rcx mov [wMsg],rdx mov [wParam],r8 mov [lParam],r9 cmp [wMsg],WM_COMMAND je wmcommand cmp [wMsg],WM_CLOSE je wmclose cmp [wMsg],WM_SYSCOMMAND je wmsyscommand xor rax,rax jmp finish wmsyscommand: cmp [wParam],SC_RESTORE je sc_restore invoke DefWindowProc,[hWnd],[wMsg],[wParam],[lParam] ret sc_restore: invoke AnimateWindow,[hWnd],DWORD 1000,0x00040004 ;HERE IT IS invoke ShowWindow,[hWnd],SW_RESTORE mov rax,1 ret wmcommand: cmp [wParam],BN_CLICKED shl 16 + IDOK jne processed invoke ShowWindow,[hWnd],SW_MINIMIZE ret wmclose: invoke EndDialog,[hWnd],0 processed: mov rax,1 finish: ret endp section '.idata' import data readable writeable library kernel,'KERNEL32.DLL',\ user,'USER32.DLL' import kernel,\ GetModuleHandle,'GetModuleHandleA',\ ExitProcess,'ExitProcess' import user,\ DialogBoxParam,'DialogBoxParamA',\ CheckRadioButton,'CheckRadioButton',\ GetDlgItemText,'GetDlgItemTextA',\ IsDlgButtonChecked,'IsDlgButtonChecked',\ MessageBox,'MessageBoxA',\ DefWindowProc,'DefWindowProcA',\ EndDialog,'EndDialog',\ AnimateWindow,'AnimateWindow',\ ShowWindow,'ShowWindow' section '.rsrc' resource data readable directory RT_DIALOG,dialogs resource dialogs,\ 37,LANG_ENGLISH+SUBLANG_DEFAULT,demonstration dialog demonstration,'Create message box',70,70,190,175,WS_CAPTION+WS_POPUP+WS_SYSMENU+DS_MODALFRAME dialogitem 'BUTTON','OK',IDOK,85,150,45,15,WS_VISIBLE+WS_TABSTOP+BS_DEFPUSHBUTTON enddialog |
|||
19 Aug 2020, 15:26 |
|
revolution 19 Aug 2020, 15:27
I don't see any error checking code there. You blindly execute AnimateWindow without checking anything.
|
|||
19 Aug 2020, 15:27 |
|
Overclick 19 Aug 2020, 15:30
As I told you, it is not working. Default animation only. LastError=0, rax=0
|
|||
19 Aug 2020, 15:30 |
|
revolution 19 Aug 2020, 15:32
Overclick wrote: LastError=0, rax=0 |
|||
19 Aug 2020, 15:32 |
|
Overclick 19 Aug 2020, 15:35
Did you see attached picture? What else you want to see?
insert Code: cmp rax,0 je ... invoke GetLastError cmp rax,0 je ... |
|||
19 Aug 2020, 15:35 |
|
revolution 19 Aug 2020, 15:42
Overclick wrote: Did you see attached picture? What else you want to see? |
|||
19 Aug 2020, 15:42 |
|
revolution 19 Aug 2020, 15:45
Overclick wrote:
|
|||
19 Aug 2020, 15:45 |
|
Overclick 19 Aug 2020, 15:47
OMG, how did I use it before? ))
You are quite difficult person... Code: format PE64 GUI 5.0 entry start include 'win64a.inc' section '.text' code readable executable start: push rbp invoke GetModuleHandle,0 invoke DialogBoxParam,rax,37,HWND_DESKTOP,DialogProc,0 invoke ExitProcess,0 proc DialogProc uses rbx rsi rdi,hWnd,wMsg,wParam,lParam mov [hWnd],rcx mov [wMsg],rdx mov [wParam],r8 mov [lParam],r9 cmp [wMsg],WM_COMMAND je wmcommand cmp [wMsg],WM_CLOSE je wmclose cmp [wMsg],WM_SYSCOMMAND je wmsyscommand xor rax,rax jmp finish wmsyscommand: cmp [wParam],SC_RESTORE je sc_restore invoke DefWindowProc,[hWnd],[wMsg],[wParam],[lParam] ret sc_restore: invoke AnimateWindow,[hWnd],DWORD 1000,0x00040004 ;cmp rax,0 ;test number 1 ;je show_error invoke GetLastError ;test number 2 (switch them) cmp rax,0 je show_error invoke ShowWindow,[hWnd],SW_RESTORE mov rax,1 ret show_error: invoke MessageBox,NULL,'it is zero',NULL,MB_ICONERROR+MB_OK wmcommand: cmp [wParam],BN_CLICKED shl 16 + IDOK jne processed invoke ShowWindow,[hWnd],SW_MINIMIZE ret wmclose: invoke EndDialog,[hWnd],0 processed: mov rax,1 finish: ret endp section '.idata' import data readable writeable library kernel,'KERNEL32.DLL',\ user,'USER32.DLL' import kernel,\ GetModuleHandle,'GetModuleHandleA',\ ExitProcess,'ExitProcess',\ GetLastError,'GetLastError' import user,\ DialogBoxParam,'DialogBoxParamA',\ CheckRadioButton,'CheckRadioButton',\ GetDlgItemText,'GetDlgItemTextA',\ IsDlgButtonChecked,'IsDlgButtonChecked',\ MessageBox,'MessageBoxA',\ DefWindowProc,'DefWindowProcA',\ EndDialog,'EndDialog',\ AnimateWindow,'AnimateWindow',\ ShowWindow,'ShowWindow' section '.rsrc' resource data readable directory RT_DIALOG,dialogs resource dialogs,\ 37,LANG_ENGLISH+SUBLANG_DEFAULT,demonstration dialog demonstration,'Create message box',70,70,190,175,WS_CAPTION+WS_POPUP+WS_SYSMENU+DS_MODALFRAME dialogitem 'BUTTON','OK',IDOK,85,150,45,15,WS_VISIBLE+WS_TABSTOP+BS_DEFPUSHBUTTON enddialog |
|||
19 Aug 2020, 15:47 |
|
revolution 19 Aug 2020, 15:51
Your error code is incorrect.
More like this: Code: invoke AnimateWindow,[hWnd],DWORD 1000,0x00040004 cmp rax,0 je show_error ;... show_error: invoke GetLastError ;must call this first and save the result before doing anything else invoke wsprintf,... invoke MessageBox,... |
|||
19 Aug 2020, 15:51 |
|
Overclick 19 Aug 2020, 15:55
What it changes if rax is already ZERO??? (after GetLastError)
It have to return ERROR code to be translated later but it is ZERO. What do you want to translate ERROR_SUCCESS ? I gived to you full example code to test it as you know how to do that. Show me that strange error code I don't see Last edited by Overclick on 19 Aug 2020, 15:58; edited 1 time in total |
|||
19 Aug 2020, 15:55 |
|
revolution 19 Aug 2020, 15:57
If RAX is zero (failure) then you need to call GetLastError to know what the error was. But you must call it immediately, before any other API calls, else the error code is overwritten and you lose it.
|
|||
19 Aug 2020, 15:57 |
|
Goto page 1, 2, 3 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.