help sending text to windows edit control
Richard Leahy
leahy_rich at hotmail.com
Wed Mar 24 16:26:51 EDT 2010
I am trying to write text into a windows edit
control using python. it seems to write to every control i try except
the edit box not sure if this is a security measure or not. here is my
code any help please.
import os,sys,subprocess,time
from subprocess import *
from os import *
from ctypes import *
from ctypes.wintypes import *
PROCESS_ALL_ACCESS = ( 0x000F0000 | 0x00100000 | 0xFFF )
kernel32 = windll.kernel32
pid = sys.argv[1]
h_process = kernel32.OpenProcess( PROCESS_ALL_ACCESS, False, int(pid) )
if not h_process:
print "[*] Couldn't acquire a handle to PID: %s" % pid
sys.exit(0)
user32 = windll.user32
# parent window
window_handle = windll.user32.FindWindowA(None, "Windows App")
if not window_handle:
print "[*] cant find window"
# 1 is the control id of the edit box child window
#below line has no effect on the control for some reason??
windll.user32.SetDlgItemTextA(window_handle, 1, "test")
# 2 is the control id of a button
# this line works and changes the button text? not sure whats going on
windll.user32.SetDlgItemTextA(window_handle, 2, "test")
_________________________________________________________________
Hotmail: Free, trusted and rich email service.
https://signup.live.com/signup.aspx?id=60969
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20100324/c215e772/attachment.html>
More information about the Python-list
mailing list