/ Published in: Python
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
as always comments and criticism is welcomed :D
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
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!