flat assembler
Message board for the users of flat assembler.
![]() Goto page Previous 1, 2, 3 Next |
Author |
|
Overclick 19 Aug 2020, 16:00
revolution, are you ok today? You see that example code. GetLastError IS the next API already.
|
|||
![]() |
|
Overclick 19 Aug 2020, 16:03
Test one test two means two different compilations, just to make sure you are satisfied. Both results, both rax zeroed
|
|||
![]() |
|
Overclick 19 Aug 2020, 16:05
Why don't you check it out for yourself if you think I'm stupid?
|
|||
![]() |
|
revolution 19 Aug 2020, 16:07
Show the code that you actually ran, and the results.
I can't believe that RAX=0 (failed) AND the last error code is zero (success). Not possible. So far you have only shown incorrect error checking code, so I don't trust the values you got are correct. |
|||
![]() |
|
revolution 19 Aug 2020, 16:08
Overclick wrote: Why don't you check it out for yourself if you think I'm stupid? It isn't about stupidity, it is about getting it correct so we don't deceive ourselves. |
|||
![]() |
|
Overclick 19 Aug 2020, 16:23
Microsoft says it's possible you believe that or not. I'm tired of proving my steps, have to ask someone else...
"If the thread does not own the window. Note that, in this case, AnimateWindow fails but GetLastError returns ERROR_SUCCESS." |
|||
![]() |
|
Overclick 19 Aug 2020, 16:38
Ok I find:
Code: sc_restore: invoke ShowWindow,[hWnd],SW_RESTORE invoke ShowWindow,[hWnd],SW_HIDE invoke AnimateWindow,[hWnd],DWORD 1000,0x00060004 Now it is working but I cannot hide window completely before animation -- frame still exist. Problem was hWnd disabled or something when it is minimized. I have to activate hWnd before AnimateWindow() somehow Actually my program doesn't have window frame, solution works fine. But let me know if there is better way to activate window. |
|||
![]() |
|
DimonSoft 19 Aug 2020, 21:26
Overclick wrote: I created little example code special for revolution Please, note that you’re wrong: you’ve created it for yourself to increase the chance that anyone helps you. And, as you can see, it was your fault in the code you didn’t want to show. And AFAICT this is not the first time it ends up this way. Maybe it’s a language barrier, but to me the quoted phrase just looks somewhat rude. Maybe it’s time to change your attitude towards people who are willing to help? |
|||
![]() |
|
Overclick 19 Aug 2020, 21:56
DimonSoft, what fault you talking about? Did you read the code? Do you understand it at all? Do you know better solution for this situation? Sure you don't. That is not my fault revolution doesn't trust people here and my measuring was absolutely correct.
AFAICT is you are local troll that for sure )) Don't message me that way. All you saying around the forum is only spam and flood. |
|||
![]() |
|
Overclick 19 Aug 2020, 23:06
AnimateWindow() is quite broken function. It also drops a styles for my EditText items until mouse over it.
The fastest solution I've got is to do the same to reload that styles after all. Just one update to ShowWindowAsync -- it works fast and perfect no more artifacts on animation. Code: sc_restore: invoke ShowWindowAsync,[hWnd],SW_RESTORE invoke ShowWindowAsync,[hWnd],SW_HIDE invoke AnimateWindow,[hWnd],DWORD 200,0x00020010 invoke ShowWindowAsync,[hWnd],SW_HIDE invoke ShowWindowAsync,[hWnd],SW_SHOW The same solution I use to initialize Dialogue Code: wminitdialog: invoke AnimateWindow,[hWnd],DWORD 200,0x00020010 invoke ShowWindowAsync,[hWnd],SW_HIDE invoke ShowWindowAsync,[hWnd],SW_SHOWDEFAULT |
|||
![]() |
|
bitRAKE 20 Aug 2020, 00:52
This is what you need to fix your message processing:
Code: wmshowwindow: test r8d,r8d jz do_default invoke AnimateWindow,[hWnd],2000,0x00040004 do_default: invoke DefWindowProc,[hWnd],[wMsg],[wParam],[lParam] xor eax,eax ret Darn, that doesn't appear to work right either. Windows will only animate from a hidden state it seems. This makes me want to try it on a regular window - dialog boxes give me so many problems when I try to push them beyond the basic functionality. |
|||
![]() |
|
Overclick 20 Aug 2020, 02:00
I still working on it. Problem is not resolved. I have random focus lose even if SetFocus or it's daughter SetActiveWindow used after ShowWindow. And I still have some visual artifacts randomly.
bitRAKE, I cannot use your example as ShowWindowAsync calls this messages in loop. Without my trick I lose styles for items. And yes, it's working for new created window only, the minimized needs to be called somehow else. Also I tried to minimize window by different keys -- no difference. But any way WM_SHOWWINDOW is good place to keep SetFocus,[hWnd] there, still testing for focus lose. |
|||
![]() |
|
bitRAKE 20 Aug 2020, 06:24
I had another go at it - love a good mystery:
Code: format PE64 GUI 5.0 entry start include 'win64a.inc' section '.text' code readable executable start: push rbp invoke GetModuleHandle,0 mov [hModule],rax invoke GetDesktopWindow mov [hDesktop],rax invoke DialogBoxParam,[hModule],37,[hDesktop],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_SHOWWINDOW je wmshowwindow cmp [wMsg],WM_SYSCOMMAND je wmsyscommand xor rax,rax jmp finish wmshowwindow: test r8d,r8d jz do_default invoke AnimateWindow,[hWnd],1000,0x00040004 do_default: invoke DefWindowProc,[hWnd],[wMsg],[wParam],[lParam] xor eax,eax ret wmsyscommand: cmp [wParam],SC_RESTORE je sc_restore invoke DefWindowProc,[hWnd],[wMsg],[wParam],[lParam] ret sc_restore: invoke ShowWindowAsync,[hWnd],SW_HIDE invoke ShowWindowAsync,[hWnd],SW_SHOWDEFAULT invoke DefWindowProc,[hWnd],[wMsg],[wParam],[lParam] mov rax,1 ret wmcommand: cmp [wParam],BN_CLICKED shl 16 + IDOK jne processed invoke ShowWindowAsync,[hWnd],SW_MINIMIZE ret wmclose: invoke EndDialog,[hWnd],0 processed: mov rax,1 finish: ret endp section '.data' data readable writeable hModule rq 1 hDesktop rq 1 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',\ GetDesktopWindow,'GetDesktopWindow',\ GetDlgItemText,'GetDlgItemTextA',\ IsDlgButtonChecked,'IsDlgButtonChecked',\ MessageBox,'MessageBoxA',\ DefWindowProc,'DefWindowProcA',\ EndDialog,'EndDialog',\ AnimateWindow,'AnimateWindow',\ ShowWindowAsync,'ShowWindowAsync' ID_EDIT_CODE=123 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 or WS_POPUP or WS_SYSMENU or DS_MODALFRAME or DS_CENTER dialogitem 'EDIT','<focus me please>',ID_EDIT_CODE,4,4,182,146,\ WS_TABSTOP\; needed to get default focus or WS_VISIBLE or WS_HSCROLL or ES_MULTILINE or ES_NOHIDESEL or ES_WANTRETURN or ES_AUTOVSCROLL dialogitem 'BUTTON','OK',IDOK,5,155,45,15,\ WS_VISIBLE+WS_TABSTOP+BS_DEFPUSHBUTTON enddialog |
|||
![]() |
|
bitRAKE 20 Aug 2020, 07:22
Moving from WM_SYSCOMMAND to WM_SIZE might be the way to go -- in the hope that however the window is being restored that it has a chance to animate.
Code: wmsize: cmp [wParam],SIZE_RESTORED jnz wmsize_process invoke ShowWindowAsync,[hWnd],SW_HIDE invoke ShowWindowAsync,[hWnd],SW_SHOWDEFAULT wmsize_process: invoke DefWindowProc,[hWnd],[wMsg],[wParam],[lParam] xor eax,eax ret |
|||
![]() |
|
Overclick 20 Aug 2020, 09:52
bitRAKE, what is a diference? You move funcs form one place to another but it still need to be run.
ShowWindowAsync sends new message to wmshowwindow for every single instance. It is loop if wmsize run after that. Otherwice I loose styles and no point to use ShowWindowAsync before animation at all. What I have: 1) ShowWindowAsync combination needed after animation to fix styles 2) ShowWindowAsync cause focus loss 3) ShowWindow combination needed before animation to restore window 4) Usage of ShowWindow and even ShowWindowAsync cause artifacts 5) ShowWindowAsync is much faster but random artifacts still happens Focus losing only for one of opened applications. Usually right side.
|
||||||||||||||||||||||||||||
![]() |
|
Overclick 20 Aug 2020, 11:05
Focus Loss fixed (I hope) by:
Code: invoke SendMessage,[hWnd],WM_LBUTTONDOWN,MK_LBUTTON,0 invoke SendMessage,[hWnd],WM_LBUTTONUP,MK_LBUTTON,0 It wasn't normal focus losing. It's some strange bug. I find that child item still marked by focus also window can be moved under popped up one. That mean SetFocus helps nothing and the best way is to send fake click on window. Can someone recognise what kind of style AnimateWindow forces to me? I'm ready to use it like that and give up to find better solution. |
|||
![]() |
|
Overclick 20 Aug 2020, 16:59
Button solution doesn't work. Any way I found new one. No more artifacts on initialisation. Just from time to time at restore. I have to let it be like that. Everything else works smooth as requested.
Code: sc_restore: invoke ShowWindow,[hWnd],SW_RESTORE invoke InvalidateRect,[hWnd],0,TRUE ;increases smooth chance I think invoke ShowWindow,[hWnd],SW_HIDE invoke AnimateWindow,[hWnd],200,0x00020010 invoke InvalidateRect,[hWnd],0,FALSE ;reloads items with corrupted by animation styles invoke UpdateWindow,[hWnd] Code: wm_initdialog: invoke AnimateWindow,[hWnd],DWORD 200,0x00020010 invoke InvalidateRect,[hWnd],0,FALSE invoke UpdateWindow,[hWnd] |
|||
![]() |
|
Roman 20 Aug 2020, 17:26
Try
invoke AnimateWindow,[hWnd],DWORD 200,DWORD 0x00020010 |
|||
![]() |
|
bitRAKE 21 Aug 2020, 11:06
Overclick wrote: bitRAKE, what is a diference? You move funcs form one place to another but it still need to be run. Also, I'm lazy and would rather use the default processing when possible. For example, if the default dialog handler is invalidating the window then I would position my changes around that so I don't need to invalidate again. Definately not required though. There is no loop in the code I posted - not sure why you keep mentioning this. |
|||
![]() |
|
Goto page Previous 1, 2, 3 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2023, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.