Zitat von
Zacherl:
This function works only when Desktop Window Manager (DWM) is off.
@Zacherl,
The C++ example works fine with DWM enable
.
And i followed your suggestion below, thank you:
Zitat von
Zacherl:
The calling convention of the callback should be stdcall
Delphi-Quellcode:
TMagImageScalingCallback =
function (hwnd: HWND; srcdata: Pointer;
srcheader: MAGIMAGEHEADER; destdata: Pointer; destheader: MAGIMAGEHEADER;
unclipped: TRect; clipped: TRect; dirty: HRGN): BOOL;
stdcall;
// definition found in Magnification.pas posted on question
function ImageScaling(hwnd: hwnd; srcdata: Pointer; srcheader: MAGIMAGEHEADER;
destdata: Pointer; destheader: MAGIMAGEHEADER; unclipped: TRect;
clipped: TRect; dirty: HRGN): BOOL;
stdcall;
var
lpbmih: TBitmapInfoHeader;
lpbmi: TBitmapInfo;
aBitmap: HBITMAP;
aDC: HDC;
bmp: TBitmap;
begin
Fillchar(lpbmih, SizeOf(lpbmih), 0);
lpbmih.biSize := SizeOf(lpbmih);
lpbmih.biWidth := srcheader.width;
lpbmih.biHeight := srcheader.height;
//...
end;
//...
// calling in MagSetImageScalingCallback api
if (
not MagSetImageScalingCallback(hwndMag, TMagImageScalingCallback(@ImageScaling)))
then
So, like already said, when i put breakpoint inside my ImageScaling function, debug not go to function, then i noted that this callback function not is executed.
Here is how be is C++ code:
Code:
typedef BOOL (CALLBACK* MagImageScalingCallback)(HWND hwnd, void * srcdata, MAGIMAGEHEADER srcheader, void * destdata, MAGIMAGEHEADER destheader, RECT unclipped, RECT clipped, HRGN dirty );
//...
BOOL MagImageScaling(HWND hwnd, void *srcdata, MAGIMAGEHEADER srcheader,
void *destdata, MAGIMAGEHEADER destheader,
RECT unclipped, RECT clipped, HRGN dirty)
{
// Setup the bitmap info header
bmif.biSize = sizeof(BITMAPINFOHEADER);
bmif.biHeight = srcheader.height;
bmif.biWidth = srcheader.width;
//...
}
if (!MagSetImageScalingCallback(hwndMag, (MagImageScalingCallback)MagImageScaling))