flat assembler
Message board for the users of flat assembler.
Index
> Windows > FindWindow with dynamically classname |
Author |
|
Ali.Z 16 May 2024, 01:21
if i understand correctly then, you are trying to change a window title that belong to another process?
you can use SetWindowText or send the title directly to window's main proc using SendMessage (wm_settext) note that if the target tend to change its title based on user action, then you need to obtain hwnd by supplying the class atom or class name. _________________ Asm For Wise Humans |
|||
16 May 2024, 01:21 |
|
semiono 16 May 2024, 01:40
I want to find window and set size: with and height.
But window class every time changes the name. JUCE_18f7ea58f3e JUCE_18f7ae781a JUCE_18f58f3ezzz Every new start app class name different. I can't find this win. |
|||
16 May 2024, 01:40 |
|
Ali.Z 16 May 2024, 01:52
sorry i didnt realize you're trying to change class name.
there is no known method of changing class name once it is registered(*), your best bet is to hook window creation function and change class name there or hook createwindowexa/w. if you just want to change window TITLE or name then you can safely ignore the class. try executing the target with CreateProcess, fill STARTUPINO struct, after window created you will get its hwnd. (may not work for every target) the other method is by using toolhelp32snapshot, looping thru a list of all tasks, just compare the executable name, if found get main thread id, use thread id to get main window's hwnd. (*) not technically correct, but require some serious hacking into windows structure, it has been done in past. _________________ Asm For Wise Humans |
|||
16 May 2024, 01:52 |
|
semiono 16 May 2024, 02:46
No, I don't want to change name. I don't need to change name.
I want to set window size. I need catch an application window and send screen X and screen Y rectangle. https://www.autohotkey.com/docs/v2/misc/WinTitle.htm#ahk_class «ClassName accepts a regular expression.» With AHK I can FindWindow with bla-bla name class, but with Fasm probably. invoke FindWindow - required full name vs wild card. |
|||
16 May 2024, 02:46 |
|
Ali.Z 16 May 2024, 02:59
ah im not ahk expert, but based on docs.
Code: WinMove, ,JUCE,x,y if for some reason it didnt work, Code: Run, <file.exe> ; might not be required WinWait, , JUCE WinActivate ; last found window WinMove, ,,x,y ; last window _________________ Asm For Wise Humans |
|||
16 May 2024, 02:59 |
|
Ali.Z 16 May 2024, 03:12
semiono wrote: invoke FindWindow - required full name vs wild card. Ali.Z wrote: try executing the target with CreateProcess, fill STARTUPINO struct, after window created you will get its hwnd. (may not work for every target) both methods will give you hwnd, first easier but wont work for some win32 programs, 2nd (toolhelp) require more setup, but guaranteed to work. _________________ Asm For Wise Humans |
|||
16 May 2024, 03:12 |
|
Hrstka 16 May 2024, 08:21
You will probably need to call EnumWindows. Inside the callback function you can use GetClassName and compare the strings to find the appropriate window.
|
|||
16 May 2024, 08:21 |
|
semiono 16 May 2024, 19:04
Code: include '%fasm%/win64ax.inc' section '.code' executable start: sub rsp,8 invoke EnumWindows,EnumWindowsProc,NULL invoke MessageBoxTimeout,HWND_DESKTOP,_sb,'',MB_TOPMOST,LANG_NEUTRAL,5000 exit: invoke ExitProcess,NULL proc EnumWindowsProc,hWnd,lParam mov [hWnd],rcx mov [lParam],rdx invoke GetWindowText,[hWnd],_wt,128 test eax,eax jz @f invoke lstrcat,_sb,_wt invoke lstrcat,_sb,_nl @@: mov eax,TRUE ret endp section '.data' readable writeable _nl db 13,10,NULL _sb rb 4096 _wt rb 128 I have a list. How to scasb only 'Calc' example text ? How scan string? |
|||
16 May 2024, 19:04 |
|
macomics 16 May 2024, 21:18
Code: lea rdx, [_wt] lea r9, [_template] xor rcx, rcx @@: cmp byte [r9 + rcx], 0 jz @f cmp byte [rdx + rcx], 0 jz not_found mov al, [rdx + rcx] cmp al, [r9 + rcx] jnz not_found inc rcx jmp @b @@: cmp byte [rdx + rcx], 0 jz match_found ; str starts with template jmp next_window not_found: ; str != template jmp next_window match_found: ; str == template next_window: ; ... _template db 'JUCE_18', 0 |
|||
16 May 2024, 21:18 |
|
semiono 17 May 2024, 00:08
Thanks!!!
|
|||
17 May 2024, 00:08 |
|
bitRAKE 17 May 2024, 07:16
semiono wrote: How scan string? Code: lea rdi, [_template] lea rsi, [_wt] mov ecx, _template_bytes repz cmpsb jz .found .not_found: ; ... .found: Code: mov ecx, _template_bytes @@: mov al, [_template + rcx - 1] cmp al, [_wt + rcx - 1] loopz @B jz .found .not_found: ; ... .found: Code: _template db 'JUCE_18' _template_bytes = $ - _template Code: mov rdx, 'JUCE_18' shl 8 mov rax, [_wt] shl rax, 8 cmp rax, rdx jz .found .not_found: ; ... .found: Code: mov rax, 'JUCE_18' shl 8 cmp [_wt-1], rax jz .found .not_found: ; ... .found: db 0 ; fixed prefix byte _wt rb 128 _________________ ¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup |
|||
17 May 2024, 07:16 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.