I'd like to draw some text ON the desktop, I've heard of three ways to do this so far, Drawing it directly to the desktop with GetDesktopWindow() (so far this only puts text above everything and is erased as soon as things are redrawn), Making A child of the desktop with GetDesktopWindow(), or Making inactive window and placing at the bottom of everything and using PaintDesktop(), I've opted for the second of the three but I've run into some weird behavior.
I create a new window but as soon it's drawn it is invisible, no titlebar, no anything. I draw text on it and it becomes white still has no titlebar and puts the text on twice. when I kill it from the interpeter the window finally becomes visible but not repsonsive as I've killed it's handling? I've gathered this from some sample code on line: http://www.theroyweb.com/getpage.php?pageID=21 which has about the same errors. [code] from win32api import * from win32gui import * import win32ui import win32con # Create and register new window class def WndProc(hWnd, msg, wparam, lparam): print msg if msg == win32con.WM_PAINT: print "Painting" hdc,paintstruct = BeginPaint(hWnd) PaintDesktop(hdc) #ExtTextOut(hdc, 100,100,win32con.ETO_OPAQUE,None, "TEST") EndPaint(hWnd,paintstruct) return 0 if msg == 522: PostQuitMessage(0) return 0 hInst = GetModuleHandle(None) wc = WNDCLASS() wc.style = win32con.CS_HREDRAW | win32con.CS_VREDRAW wc.lpfnWndProc = WndProc wc.hInstance = hInst wc.hIcon = LoadIcon(0, win32con.IDI_APPLICATION) wc.hCursor = LoadCursor(0, win32con.IDC_ARROW) wc.hbrBackground = GetStockObject(win32con.GRAY_BRUSH) wc.lpszClassName = "SimpleWin" #"SimpleWin" try: RegisterClass(wc) except error: # most probably class is already registered pass hWnd = CreateWindow( "SimpleWin", # class # title "Hello Win32 World!", # style win32con.WS_OVERLAPPED, # location win32con.CW_USEDEFAULT, win32con.CW_USEDEFAULT, # size 300, 300, # parent 0, # menu 0, # instance handle hInst, # reserved - must be None None) ShowWindow(hWnd,win32con.SW_SHOWNORMAL) UpdateWindow(hWnd) PumpMessages() [/code] _______________________________________________ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32