Danke Dir.
Ich habe diesen Quellcode um Screenshots zu erstellen:
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38:
| function ScreenshotHidden(wnd: HWND; const bmp: TBitmap): Boolean; var rec: TRect; dllh: THandle; PrintWindow: function(sHandle: HWND; dHandle: HDC; nFlags: UINT): BOOL; stdcall; begin Result := False; dllh := GetModuleHandle(user32); if dllh <> 0 then begin @PrintWindow:= GetProcAddress(dllh , 'PrintWindow'); if @PrintWindow <> nil then begin GetWindowRect(wnd, rec); bmp.Width := rec.Right - rec.Left; bmp.Height := rec.Bottom - rec.Top; bmp.Canvas.Lock; try result := PrintWindow(wnd, bmp.Canvas.Handle, 0); finally bmp.Canvas.Unlock; end; end; end; end;
procedure TForm1.Button2Click(Sender: TObject); var wnd: HWnd; begin wnd := FindWindow('Notepad',nil); if (wnd > 0) then begin ScreenshotHidden(wnd, Image1.Picture.Bitmap); Image1.Invalidate; Button3.Click; end; end; |
Das Problem ist, das diese funktion ScreenshotHidden nicht sonderlich schnell ist, da ich über Timer1 diese funktion jede Millisekunde ausführe und das Programm sich dann einwenig aufhängt.
Gibt es eine bessere und schnellere Methode?
Vielen Dank schonmal.
MfG