EnableExplicit Define EventID LoadFont(1,"",20,#PB_Font_Bold) Procedure CaptureActiveWindow() Protected Handle Protected hDC Protected RECT.RECT Protected hPrinterDC Handle = GetForegroundWindow_() hDC = GetWindowDC_(Handle) GetWindowRect_(Handle,@RECT.RECT) With RECT \right-\left \bottom-\top CreateImage(0,\right,\bottom) hPrinterDC = StartDrawing(ImageOutput(0)) If hPrinterDC BitBlt_(hPrinterDC,0,0,\right,\bottom,hDC,0,0,#SRCCOPY) StopDrawing() EndIf EndWith ReleaseDC_(Handle,hDC) SetClipboardImage(0) MessageRequester("Information","Es wird jetzt Microsoft Paint gestartet."+Chr(13)+"Drücke anschließend Strg + V, um das erstellte Fensterbild einzufügen."+Chr(13)+"Viel Spaß. ;)",#MB_ICONINFORMATION) RunProgram("mspaint.exe") End EndProcedure If OpenWindow(0,0,0,500,400,"Window",#PB_Window_SystemMenu|#PB_Window_ScreenCentered) ButtonGadget(1,100,100,300,200,"Los, drück mich :)",0) SetGadgetFont(1,FontID(1)) Repeat EventID=WaitWindowEvent() If EventID=#PB_Event_Gadget Select EventGadget() Case 1 CaptureActiveWindow() EndSelect EndIf If EventID = #PB_Event_CloseWindow End EndIf ForEver EndIf