![]() |
AW: MagSetWindowFilterList function not remove specified window of screenshot
Zitat:
i think not. greets |
AW: MagSetWindowFilterList function not remove specified window of screenshot
Zitat:
Delphi-Quellcode:
. Callstack points to `msvcrt.memcpi` so I guess there's something fishy somewhere else. Could be anything like wrong types, calling conventions, buffer overreads, ... Same problem might cause your black image. Buffer overreads/overflows can be tricky sometimes and do not always result in reproducable problems.
MagSetWindowSource
|
AW: MagSetWindowFilterList function not remove specified window of screenshot
Zitat:
but it works on W7 32 BIT. i think you can nothing do on it. greets |
AW: MagSetWindowFilterList function not remove specified window of screenshot
Liste der Anhänge anzeigen (Anzahl: 1)
Here is project solved and working 100% like must be.
Delphi-Quellcode:
var
Form1: TForm1; implementation uses Unit3, Magnification; {$R *.dfm} function MagImageScalingCallback(hwnd: hwnd; srcdata: Pointer; srcheader: MAGIMAGEHEADER; destdata: Pointer; destheader: MAGIMAGEHEADER; unclipped: TRect; clipped: TRect; dirty: HRGN): BOOL; stdcall; var lpbmi: TBitmapInfo; bmp: TBitmap; aDC: HDC; abitmap: HBitmap; begin Fillchar(lpbmi, sizeof(lpbmi), 0); lpbmi.bmiHeader.biSize := sizeof(lpbmi.bmiHeader); lpbmi.bmiHeader.biHeight := -srcheader.height; // Otherwise the image is upside down. lpbmi.bmiHeader.biWidth := srcheader.width; lpbmi.bmiHeader.biSizeImage := srcheader.cbSize; lpbmi.bmiHeader.biPlanes := 1; lpbmi.bmiHeader.biBitCount := 32; lpbmi.bmiHeader.biCompression := BI_RGB; aDC := GetWindowDC(hwnd); bmp := TBitmap.Create; abitmap := 0; try abitmap := CreateDIBitmap(aDC, lpbmi.bmiHeader, CBM_INIT, srcdata, lpbmi, DIB_RGB_COLORS); bmp.handle := abitmap; bmp.SaveToFile('c:\screen.bmp'); finally DeleteObject(abitmap); DeleteDC(aDC); bmp.Free; end; Result := True; end; procedure MagScreenShot; var desktop, hwndMag: hwnd; desktoprect, sourceRect: TRect; filterList: THWNDArray; m_ScreenX, m_ScreenY, m_ScreenT, m_ScreenL: Integer; begin Form1.WindowState := wsMaximized; if not Form3.Showing then Form3.Show; desktop := GetDesktopWindow; GetWindowRect(desktop, desktoprect); m_ScreenT := desktoprect.Top; m_ScreenL := desktoprect.Left; m_ScreenX := desktoprect.right; m_ScreenY := desktoprect.bottom; if (not MagInitialize) then begin Application.MessageBox('Init magnification failed', 'Error', mb_Ok + mb_IconError); Exit; end; hwndMag := CreateWindow(WC_MAGNIFIER, 'MagnifierWindow', WS_CHILD or MS_SHOWMAGNIFIEDCURSOR or WS_VISIBLE, 0, 0, m_ScreenX, m_ScreenY, Form1.handle, 0, hInstance, nil); if (hwndMag = 0) then begin Application.MessageBox('MagnifierWindow creation failed', 'Error', mb_Ok + mb_IconError); Exit; end; if (not MagSetImageScalingCallback(hwndMag, MagImageScalingCallback)) then begin Application.MessageBox('Cannot set callback', 'Error', mb_Ok + mb_IconError); Exit; end; try filterList[0] := Form3.handle; except end; if (not MagSetWindowFilterList(hwndMag, MW_FILTERMODE_EXCLUDE, 1, @filterList[0])) then begin Application.MessageBox('Cannot exclude main window', 'Error', mb_Ok + mb_IconError); Exit; end; sourceRect.Top := m_ScreenT; sourceRect.Left := m_ScreenL; sourceRect.right := m_ScreenX; sourceRect.bottom := m_ScreenY; Sleep(200); if (not MagSetWindowSource(hwndMag, sourceRect)) then begin Application.MessageBox('Cannot set source to MagnifierWindow', 'Error', mb_Ok + mb_IconError); Exit; end; { if (not MagUninitialize) then begin Application.MessageBox('Finalize magnification failed', 'Error', mb_Ok + mb_IconError); Exit; end; } end; procedure TForm1.btn1Click(Sender: TObject); begin MagScreenShot; end; |
AW: MagSetWindowFilterList function not remove specified window of screenshot
Zitat:
|
AW: MagSetWindowFilterList function not remove specified window of screenshot
Zitat:
it works and does not work. MagImageScalingCallback is not needed. and if you deactivate Desktop Theme then it Crash always.. on this line
Delphi-Quellcode:
if (not MagSetWindowSource(hwndMag, sourceRect)) then
with Floating Point invalid Operation. ![]() which works without Crash, please deactivate Desktop Themes before run. sorry your source text is fully flawed. 1. Each new call creates a new instance of the Magnification Dll without uninitializing the old one before. 2. Each new call creates a new Window without destroy the old one before. 3. Array of tagMAGTRANSFORM is wrong. 4. Filterlist is not Needed. 5. a second form is not needed. 6. the callback also if your use a Timer. .. and so on. greets |
AW: MagSetWindowFilterList function not remove specified window of screenshot
Zitat:
![]() About item 5º, is necessary because i not want show Magnifier window to user (i still will hide Form1 in my project), based on C++ example. Please, read item 2 on page of ![]() Relative to black screen, see in my last updated that is black only on Magnifier window, but on bmp file not. |
Alle Zeitangaben in WEZ +1. Es ist jetzt 01:48 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