Revision: 38429
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at January 2, 2011 08:45 by mouseroot
Initial Code
from ctypes import *
class Win32api():
def __init__(self):
self.SetWindowText = windll.user32.SetWindowTextA #msdn for what dll to use
self.FindWindow = windll.user32.FindWindowA # i dont use unicode(maybe i should?)
def String(self,s):
return c_char_p(s)
def Int(self,i):
return c_int(i)
def Long(self,l):
return c_long(l)
#small test open command prompt type title lol
test = Win32api()
#none in python is == NULL in C(more or less)
ret = test.FindWindow(None,test.String("lol"))
#ret holds the window handle HWND(which is really a long/int)
test.SetWindowText(ret,test.String("Command Prompt :D"))
print("done")
#just for good measure!
Initial URL
Initial Description
here i call some win32 api stuff using ctypes i wrote wrappers for c_char_p() and c_int aswell as c_long as always comments and criticism is welcomed :D
Initial Title
Python mini Win32 Api Usage using ctypes :D
Initial Tags
Initial Language
Python