ok im mucking around with API calls and stuff. and i was just wondering how come this doesent work?
invoke FindWindow,addr WinampClass, NULL
.if(!eax)
invoke MessageBox,0,addr Error1,addr ErrorTitle,MB_OK
invoke ExitProcess,0
.endif
mov hWinamp,eax
invoke GetWindowTextLength,hWinamp
.if(!eax)
invoke MessageBox,0,addr Error2,addr ErrorTitle,MB_OK
invoke ExitProcess,0
.endif
mov hLength,eax
invoke GetWindowText,hWinamp,hText,512
.if(!eax)
invoke MessageBox,0,addr Error3,addr ErrorTitle,MB_OK
invoke ExitProcess,0
.endif
in the .data section i have this
.data
WinampClass db "Winamp v1.x", 0
ErrorTitle db "Error", 0
Error1 db "Error 1 : Unable to find the Winamp window", 0
Error2 db "Error 2 : Error getting the text from Winamp", 0
Error3 db "Error 3 : Error getting the text from Winamp", 0
.data
hWinamp HWND ?
hLength DWORD ?
hText DWORD ?
i have the code exected whena button is pressed on a window.
it keeps coming up with Error 3 which is getting the text from the window.
how come it doesent work. thanks in advance.
hText DWORD ?
should be
hText db 512 dup(?)
invoke GetWindowText,hWinamp,hText,512
should be
invoke GetWindowText,hWinamp,addr hText,hLength
thanks alot!
hText db 512 dup(?)
declares hText as a buffer, right?
Yes, that is correct !