![]() |
AW: Wie man das Handle von einem Screenshot entfernt
Zitat:
Example: prntscr.com/314rix - SUCESS IN WIN7 prntscr.com/314tj7 - FAILED IN WIN8 prntscr com/31502u - SUSPEND WINLOGON.EXE and KILL DWM.EXE IN WIN8 |
AW: Wie man das Handle von einem Screenshot entfernt
Okay maybe you should show us the code you are using (which seems to work on Win7 but noch on Win8).
|
AW: Wie man das Handle von einem Screenshot entfernt
Zitat:
Put the form in ALPHABLEND = TRUE;
Delphi-Quellcode:
unit Unit1;
interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, Clipbrd; type TForm1 = class(TForm) Button1: TButton; Image1: TImage; ScrollBox1: TScrollBox; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure ScreenShot(DestBitmap: TBitmap); var DC: HDC; begin DC:=GetDC(GetDesktopWindow); try DestBitmap.Width:=GetDeviceCaps(DC, HORZRES); DestBitmap.Height:=GetDeviceCaps(DC, VERTRES); BitBlt(DestBitmap.Canvas.Handle,0,0,DestBitmap.Width,DestBitmap.Height,DC,0,0,SRCCOPY); finally ReleaseDC(GetDesktopWindow, DC); end; end; procedure TForm1.Button1Click(Sender: TObject); begin ScreenShot(Image1.Picture.Bitmap); end; end. |
AW: Wie man das Handle von einem Screenshot entfernt
You can get a Hardcopy using Method GetFormImage from TForm.
![]() Zitat:
Delphi-Quellcode:
Not tested:
procedure HardCopy(sJpegFile : String; fm : TForm);
Var FStream : TStream; FBmp : TPicture; FJpeg : TJpegImage; begin if SysUtils.FileExists(sJpegFile) then SysUtils.DeleteFile(sJpegFile); FStream := TFileStream.Create(sJpegFile,fmCreate); fm.WindowState := wsNormal; fm.Show; fm.Refresh; FJpeg := TJpegImage.Create; FBmp := TPicture.Create; try FBmp.Bitmap.Assign(fm.GetFormImage); // <- get a Hardcopy from TForm FJpeg.Assign(FBmp.Bitmap); FJpeg.SaveToStream(FStream); finally FStream.Free; FJpeg.Free; FBmp.Free; end; end;
Delphi-Quellcode:
unit Unit1;
interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, Clipbrd; type TForm1 = class(TForm) Button1: TButton; Image1: TImage; ScrollBox1: TScrollBox; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure ScreenShot(DestBitmap: TBitmap; fm : TForm); begin DestBitmap.Assign(fm.GetFormImage); // <- get a Hardcopy from TForm end; procedure TForm1.Button1Click(Sender: TObject); begin ScreenShot(Image1.Picture.Bitmap; Form1); // <-- or any other TForm end; end. |
AW: Wie man das Handle von einem Screenshot entfernt
Zitat:
Do not work I need to take photo behind the form Thank you for trying to help me. |
AW: Wie man das Handle von einem Screenshot entfernt
As it seems to turn out hard to make it work under the different Windows versions, can you explain what you are trying to achieve in the end? What do you need this screenshot of the area behind the form for?
|
AW: Wie man das Handle von einem Screenshot entfernt
Zitat:
|
AW: Wie man das Handle von einem Screenshot entfernt
Please remove
Delphi-Quellcode:
from
fm.Show;
Delphi-Quellcode:
Does it work?
procedure HardCopy
Sorry for my poor english. |
AW: Wie man das Handle von einem Screenshot entfernt
I'm trying to use it, magnification but the screen comes out all black someone has a solution
?
Delphi-Quellcode:
unit Unit1;
interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls, Magnification, Vcl.StdCtrls; type TForm1 = class(TForm) Button1: TButton; procedure FormCreate(Sender: TObject); procedure FormDestroy(Sender: TObject); procedure Button1Click(Sender: TObject); private Initialized: BOOL; magWindowRect: TRect; hwndMag: HWND; HandleToMagnifier: HWND; function MyCreateDIBSection(DC: HDC; Width, Height: integer; BitCount: integer): HBITMAP; procedure DrawMagnifier(Width, Height: Integer); procedure RefreshMagnifier(rc:TRect); // procedure ResizeMagnifier; procedure InitializeMagnifier; public { Public declarations } end; const MagFactor = 2.0; var Form1: TForm1; implementation {$R *.dfm} function TForm1.MyCreateDIBSection(DC: HDC; Width, Height, BitCount: integer): HBITMAP; var lpbmi: TBitmapInfo; P: Pointer; AbITmAP : hbitmap; db : tbitmap; begin Fillchar(lpbmi, SizeOf(TBitmapInfo), 0); lpbmi.bmiHeader.biSize := sizeof(lpbmi.bmiHeader); lpbmi.bmiHeader.biHeight := - Height; lpbmi.bmiHeader.biWidth := width; lpbmi.bmiHeader.biPlanes := 1; lpbmi.bmiHeader.biBitCount := BitCount; lpbmi.bmiHeader.biCompression := BI_RGB; Result := CreateDIBSection(DC, lpbmi, DIB_RGB_COLORS, P, 0, 0); end; procedure TForm1.DrawMagnifier(Width, Height: Integer); var aBitmap: HBITMAP; DC: HDC; bmp: TBitmap; begin DC := GetWindowDC(HwndMag); bmp := TBitmap.Create; aBitmap := 0; try aBitmap := Form1.MyCreateDIBSection(DC, Width, Height, 32); SelectObject(DC, aBitmap); bmp.Handle := aBitmap; bmp.SaveToFile('Screen.bmp'); finally DeleteObject(aBitmap); DeleteDC(DC); bmp.Free; end; end; procedure TForm1.RefreshMagnifier(rc: TRect); begin MagSetWindowSource(hwndMag, rc); SetWindowPos(Handle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE or SWP_NOMOVE or SWP_NOSIZE); InvalidateRect(hwndMag, rc, true); end; procedure TForm1.InitializeMagnifier; var matrix: TMagTransform; desktop : hwnd; desktoprect, sourceRect: TRect; filterList: THWNDArray; m_ScreenX, m_ScreenY, m_ScreenT, m_ScreenL: Integer; begin desktop := GetDesktopWindow; GetWindowRect(desktop, desktoprect); m_ScreenT := desktoprect.Top; m_ScreenL := desktoprect.Left; m_ScreenX := desktoprect.right; m_ScreenY := desktoprect.bottom; hwndMag := CreateWindow(WC_MAGNIFIER, 'MagnifierWindow', WS_CHILD or MS_SHOWMAGNIFIEDCURSOR, 0, 0, m_ScreenX, m_ScreenY, Form1.handle, 0, hInstance, nil); if hwndMag = 0 then close; FillChar(matrix, Sizeof(matrix), 0); matrix.v[0][0] := MagFactor; matrix.v[1][1] := MagFactor; matrix.v[2][2] := 1.0; if MagSetWindowTransform(hWndMag, matrix) then // tmr1.Enabled := true; end; procedure MagScreenShot; var desktop : hwnd; desktoprect, sourceRect: TRect; filterList: THWNDArray; m_ScreenX, m_ScreenY, m_ScreenT, m_ScreenL: Integer; begin Form1.WindowState := wsMaximized; desktop := GetDesktopWindow; GetWindowRect(desktop, desktoprect); Form1.DrawMagnifier(desktoprect.Right, desktoprect.Bottom); Form1.RefreshMagnifier(desktoprect); end; procedure TForm1.Button1Click(Sender: TObject); begin MagScreenShot; end; procedure TForm1.FormCreate(Sender: TObject); begin Initialized := MagInitialize; if not Initialized then begin Application.MessageBox('Init magnification failed', 'Error', mb_Ok + mb_IconError); close; end; InitializeMagnifier; end; procedure TForm1.FormDestroy(Sender: TObject); begin if (initialized) then MagUninitialize; end; end. |
Alle Zeitangaben in WEZ +1. Es ist jetzt 03:44 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz