on windows 10 64 i want to draw a bitmap in a window, but i do not see something of the bitmap, but the rest works.
(in which library+dll is the wm_paint-constant?)
program Bmp2;
uses System.SysUtils,windows;
Var winc:WNDCLASSEx;
wname,wcl:PChar;
wnddc:hdc;
windbp,hwind:hwnd;
PStrc:TPAINTSTRUCT;
FH:THandle;
FBuf,Bmpf:Pointer;
fch:Pchar;
fba,fbb:longint;
F:File of byte;
BmpH:HBitmap;
Bmp:tagBitmap;
BmpDC1:Hdc;
bmpdc2:hdc;
bmpdc3:hdc;
BDC1,DC1:HDC;
Function wndproc(hwndow:HWND;msga,msgword:word;msglong:longint):LResult;stdcall;
Begin
case msga of
wm_paint:begin
BmpH:=CreateBitmapIndirect(bmp);
bmpdc1:=getdc(bmph);
selectobject(bmpdc2,Bmpdc1);
BmpDC3:=CreateCompatibleDC(Bmpdc2);
BitBlT(wnddc,30,10,700,500,BmpDC3,0,0,SRCCOPY);
BDC1:=CreateCompatibleDC(wnddc);
selectobject(BDC1,BmpH);
GetObject(BmpH,Sizeof(bmp),Addr(Bmp));
BitBlT(wnddc,30,10,700,500,BDC1,0,0,SRCCOPY);
DeleteDC(BDC1);
DC1:=CreateCompatibleDC(windbp);
GetObject(BmpH,Sizeof(bmp),Addr(Bmp));
BitBlT(windbp,30,10,700,500,DC1,0,0,SRCCOPY);
end;
end;
wndproc:=DefWindowProc(hwndow,msga,msgword,msglong);
End;
Begin
winc.cbSize:=sizeof(winc);
winc.style:=CS_HREDRAW Or CS_VREDRAW;
winc.lpfnWndProc:=Addr(wndproc);
winc.cbclsExtra:=0;
winc.cbWndExtra:=0;
winc.hInstance:=0;;
winc.hIcon:=LoadIcon(0, IDI_APPLICATION);
winc.hCursor:=0;
winc.hbrBackground:=(14 + 1);
winc.lpszMenuName:=NiL;
winc.lpszClassName:='Window'#0;
winc.hIconSm:=LoadIcon(winc.hInstance, IDI_APPLICATION);
RegisterClassEx(winc);
wcl:='Program'#0;
wname:='Window'#0;
hwind:=CreateWindow(wname,wcl,WS_OVERLAPPED+WS_SIZEBOX,300,100,750,
600,0,0,0,NiL);
ShowWindow(hwind,sw_show);
UpdateWindow(hwind);
wndDC:=GetDC(hwind);
PStrc.hdc:=wndDC;
PStrc.ferase:=false;
PStrc.rcpaint.left:=0;
PStrc.rcpaint.top:=0;
PStrc.rcpaint.right:=700;
PStrc.rcpaint.bottom:=500;
windBP:=BeginPaint(hwind,PStrc);
Bmpf:=GetMemory(1000000*2);
AsSign(F,'C:\Paints.bmp');
FH:=FileOpen('C:\Paints.bmp',fmOpenReadWrite);
FileRead(FH,Bmpf^,735829);
fch:=bmpf;
fch:=fch+10;
move(fch^,fba,4);
move(bmpf,fbb,4);
fba:=fba+fbb;
move(fba,fbuf,4);
bmp.bmtype:=0;
bmp.bmwidth:=700;
bmp.bmheight:=500;
bmp.bmWidthBytes:=2*3*bmp.bmwidth;
bmp.bmplanes:=1;
bmp.bmbitspixel:=24;
bmp.bmBits:=FBuf;
end.
What I have tried:
run all the versions which are by microsoft and other programming sites.