[python-win32] Help calling a windows function in user32
Tim Roberts
timr at probo.com
Wed Mar 24 00:08:14 CET 2010
Richard Leahy wrote:
> So basically your saying that if i just use this
>
> test = windll.user32.FindWindowA(None, "Windows App")
>
> if not test:
> print "[*] cant find window"
>
> print test // which returns 7471154 the handle
>
> windll.user32.SetDlgItemTextA(test,1,"test")
>
> this doesn't seem to set my edit box with the value of test sorry if i
> am not making sense and thank you for your help.
It shouldn't be any more complicated than that. I was under the
impression that SetDlgItemText marshaled the string pointer so it would
work between processes, but perhaps I am mistaken. SetDlgItemInt should
CERTAINLY work -- perhaps you should try that first.
BTW, you don't need to use ctypes for this. FindWindow, SetDlgItemText
and SetDlgItemInt are all exported from win32gui.
import win32gui
t = win32gui.FindWindow( None, "Windows App" )
win32gui.SetDlgItemInt( t, 1, 37 )
--
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.
More information about the python-win32
mailing list