flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
mindcooler 10 Mar 2011, 12:12
Are you trying to us calc.exe for your in-program calculations?
![]() |
|||
![]() |
|
Overflowz 10 Mar 2011, 12:22
mindcooler
No no mate, it's just example cause I need to work with another programs and having same trouble there. I even can't get title of button cause it doesn't have it. Only info I have is class name "Button", nothing else.. Any solutions for this ? |
|||
![]() |
|
cod3b453 10 Mar 2011, 18:22
I think you can use SendMessage and WM_GETTEXT
![]() |
|||
![]() |
|
Overflowz 10 Mar 2011, 19:30
but how ? I don't know handle of the child window there..
|
|||
![]() |
|
cod3b453 10 Mar 2011, 19:39
The return value of FindWindow is the hWnd or you can use EnumChildWindows.
|
|||
![]() |
|
Overflowz 10 Mar 2011, 20:12
Wow, didn't knew that. Can you write small example of all of this for me ? Cause I'm doing those things first time and I can't understand much.. Thanks for your support!
|
|||
![]() |
|
Overflowz 10 Mar 2011, 21:46
Another problem is that I don't know which class, ID or caption it has. How can I find then with EnumChildWindow ?
|
|||
![]() |
|
cod3b453 11 Mar 2011, 18:27
Most of the functions you need are defined in user32 and have references on MSDN. If you read up on EnumChildWindows it'll tell you how the handle is given to you in the EnumChildWindowsProc you give it.
To get the class ID use GetWindowClass and SendMessage with WM_GETTEXT or GetWindowText to get its caption. |
|||
![]() |
|
Overflowz 11 Mar 2011, 19:45
cod3b453
I got it but I will get all buttons and I don't know which one is button 4 from there. I'm just asking for little example if you can.. I don't understand other way sorry ![]() |
|||
![]() |
|
cod3b453 11 Mar 2011, 23:02
This will print the hWnd for button 6
Code: include '%fasminc%/macro/import32.inc' include '%fasminc%/macro/proc32.inc' format PE entry Main BUFFER_SIZE equ 32 FALSE equ 0 TRUE equ (not FALSE) WM_GETTEXT equ 0x000D NULL equ 0 section '.code' code readable executable proc Main ; Top level window invoke FindWindowEx,NULL,NULL,pszCalcFrame,NULL or eax,eax jz @f ; Sub level window invoke FindWindowEx,eax,NULL,pszCalcFrame,NULL or eax,eax jz @f ; Scan invoke EnumChildWindows,eax,EnumChildWindowsProc,NULL @@: xor eax,eax ret endp proc EnumChildWindowsProc,hWnd,lParam push ebx invoke FindWindowEx,[hWnd],NULL,pszButton,NULL or eax,eax jz @f .next: mov ebx,eax invoke SendMessage,ebx,WM_GETTEXT,BUFFER_SIZE,buffer or eax,eax jz @f invoke lstrcmp,psz6,buffer or eax,eax jnz .fail push ecx esi edi mov ecx,8 mov esi,pszHex mov edi,pszHexEnd .loop: dec ecx dec edi mov eax,ebx and eax,0x0F mov al,byte [esi+eax] mov byte [edi],al shr ebx,4 or ecx,ecx jnz .loop pop edi esi ecx invoke MessageBox,NULL,pszHexOut,psz6,NULL jmp @f .fail: invoke FindWindowEx,[hWnd],ebx,pszButton,NULL jmp .next @@: xor eax,eax not eax pop ebx ret endp section '.data' data readable writable pszCalculator db 'Calculator',0 pszCalcFrame db 'CalcFrame',0 pszButton db 'Button',0 psz6 db '6',0 pszFmt db '%08x',0 pszHexOut db ' ' pszHexEnd db 0 pszHex db '0123456789ABCDEF',0 buffer rb BUFFER_SIZE section '.idata' import data readable writable library kernel32,'KERNEL32.DLL',\ user32,'USER32.DLL' import kernel32,\ lstrcmp,'lstrcmpA',\ Sleep,'Sleep' import user32,\ EnumChildWindows,'EnumChildWindows',\ FindWindowEx,'FindWindowExA',\ MessageBox,'MessageBoxA',\ SendMessage,'SendMessageA' |
|||
![]() |
|
Overflowz 11 Mar 2011, 23:36
cod3b453
EnumChildWindows function returns 0xFFFFFFFF and no messagebox or print are shown.. |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2023, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.