ich experimentiere schon ganz schön mit Python rum.
Mit tkinter komme ich mittlerweile auch ganz gut klar.
Ich probiere jetzt etwas mit der Win32-Api unter Windows10 herum.
Dafür habe ich mir "win32gui" installiert.
Wie bekomme ich folgendes Script unter Windows 10 zum laufen?
(Was mache ich falsch?)
//Zeichnen hinter den Desktop-Icons
Code: Alles auswählen
from win32gui import *
import win32.lib.win32con as win32con
global hWorkerW
hWorkerW = 0
def EnumProcedure(hWnd, Parameter):
h = FindWindowEx(hWnd, 0, "SHELLDLL_DefView", None)
print(h)
if h != 0 :
print("Alles Gut!")
hWorker = FindWindowEx(0, hWnd, "WorkerW", None)
if hWorker != 0 :
hWorkerW = hWorker
return 1
def Test():
hWnd = FindWindowEx(0, 0, "Progman", None)
print(int(hWnd))
if SendMessageTimeout(hWnd, win32con.WM_NULL, 0, 0, win32con.SMTO_ABORTIFHUNG, 1000):
if SendMessageTimeout(hWnd, 0x52C, 0, 0, win32con.SMTO_NORMAL, 1000) == 0 :
print("Error!")
else:
print("hier!!!")
EnumWindows(EnumProcedure, None)
if hWorkerW != 0 :
hdc = GetDCEx(hWorkerW, 0, 0x403)
hBrush = CreateSolidBrush(GetSysColor(RGB(255,0,0)))
(left, top, right, bottom) = GetClientRect(hWorkerW)
FillRect(hdc, (left, top, right, bottom), hBrush)
ReleaseDC(hWorkerW, hdc)
Test()
Danke!