Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function WindowSnap(windowHandle: HWND; bmp: TBitmap): boolean;
- var
- r: TRect;
- begin
- GetWindowRect(windowHandle, r) ;
- bmp.Width := r.Right - r.Left;
- bmp.Height := r.Bottom - r.Top;
- bmp.Canvas.Lock;
- try
- result := PrintWindow(windowHandle, bmp.Canvas.Handle, 0) ;
- finally
- bmp.Canvas.Unlock;
- end;
- end; (*WindowSnap*)
- procedure TForm1.Button1Click(Sender: TObject);
- var
- Handle : Hwnd;
- bmp: tbitmap;
- begin
- handle := FindWindow('IEFrame', nil);
- handle := FindWindowEx(handle, 0, 'Frame Tab', nil);
- handle := FindWindowEx(handle, 0, 'TabWindowClass', nil);
- handle := FindWindowEx(handle, 0, 'Shell DocObject View', nil);
- handle := FindWindowEx(handle, 0, 'Internet Explorer_Server', nil);
- if handle > 0 then
- begin
- bmp := tbitmap.Create;
- try
- WindowSnap(handle, bmp);
- bmp.SaveToFile('c:\temp\test.bmp');
- finally
- bmp.Free;
- end;
- end;
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement