Hi,

I am trying to use win32gui.SendMessage API (or PostMessage), and
cannot figure out why
it is not working. I would appreciate any help! Simple test script I
am using is included below.

I am using pywin32-203 and python 2.4, on winxp pro sp2.

I am a total newbie to python, so if this is a really dumb question,
please do not be surprised. :) I thank you all in advance for any help
and guidance you can provide.

Daniel
---------------
#### Script to try to write something down in notepad
import win32api
import win32gui
import win32con
import time

# get the window handle of the blank, minimized notepad window
hwnd = win32gui.FindWindowEx(0, 0, 0, "Untitled - Notepad")

# print it just for kicks
print hwnd

win32gui.ShowWindow(hwnd, win32con.SW_SHOWNORMAL)
#this restores the proper window, so we know we have correct handle

#just to give it a little pause
time.sleep(2)

print "trying to post message"

#try to send it a return key
win32api.SendMessage(hwnd, win32con.WM_KEYDOWN, win32con.VK_RETURN, 0)
win32api.SendMessage(hwnd, win32con.WM_KEYUP, win32con.VK_RETURN, 0)

#the above generates absolutely no effect on the notepad window.
#same effect no matter what vk code i use (e.g. 65 for A, VK_SPACE for
space, etc)

#### end of script
_______________________________________________
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to