Jump to content

milurt

Members
  • Content Count

    34
  • Joined

  • Last visited

Everything posted by milurt

  1. milurt

    bitmap is not displayed

    is a procedure missing or the sequence wrong? var B001:tagBitmap; HB:hbitmap; bitmap1-3:hdc; begin hwnd001:=createwindow; wdc:=getdc;hbp:=beginpaint; PB:=getmemory; B001.bmBits:=PB; HB:=CreateBitmapIndirect(B001); bitmapdc1:=getdc(HB); selectobject(bitmapdc2,bitmapdc1); bitmapdc3:=CreateCompatibleDC(bitmapdc2); bitblt(wdc,300,300,200,100,bitmapdc3,0,0,SRCCOPY); end.
  2. milurt

    bitmap is not displayed

    kodezwerg: citate: you said nothing to mine you citated me: pointer^:=rgb , that was i sayed to your code and what i want to do, the pointer^ should drawn in a window x,y how you call it in non-vcl i need not only a hbitmap, but a pointer, if the window-procedures need some handles. converted remy lebeau without the libraries, drawing no bitmap even bitblt is true.
  3. milurt

    bitmap is not displayed

    sysinit: he says it is redeclared and has 6 compiler-errors
  4. milurt

    bitmap is not displayed

    and kodezwerg: my question was pointer^:=rgb;
  5. milurt

    bitmap is not displayed

    last example of remy lebau: my embarcadero could not find System.SysInit but the other both libraries.
  6. milurt

    bitmap is not displayed

    but even than there is this runtime error with the cpu-window in my embarcadero 10.4 for windows 10 64-bit WinOpen; PaintOpen; while GetMessage(msg, 0, 0, 0) do begin TranslateMessage(msg); DispatchMessage(msg); end; Repeat Until GetAsyncKeyState(32)=-32768; End.
  7. milurt

    bitmap is not displayed

    and improved the main with this winopen gives a runtime error with opening the cpu-window: Begin FMem:=GetMemory(1000000); AsSign(F,'D:\15333842.bmp'); FH:=FileOpen('D:\15333842.bmp',fmOpenReadWrite); FR:=FileRead(FH,FMem^,909594{FileSize(F)}); Longint(BMem):=longint(FMem)+Longint(Pointer(longint(FMem)+10)^); PicWidth:=LongInt(Pointer(longint(FMem)+18)^); PicHeight:=LongInt(Pointer(longint(FMem)+22)^); WinWidth:=PicWidth+20;WinHeight:=PicHeight+20; WinX:=(1920-WinWidth) Div 2;WinY:=(1080-WinHeight) Div 2; WinOpen; PaintOpen; Repeat Until GetAsyncKeyState(32)=-32768; end.
  8. milurt

    bitmap is not displayed

    and with WCls1.lpfnWndProc:=Addr(wndproc); it is not working too
  9. milurt

    bitmap is not displayed

    with the wndproc the program works not better: i can see no window anymore program BmpToWinWP; {$APPTYPE GUI} uses WinProcs,System.SysUtils; var FMem:Pointer; FH:THandle; F:File of Byte; FR:LongInt; BMem:Pointer; PicWidth,PicHeight:Integer; WinX,WinY,WinWidth,WinHeight, HWnd1:HWND; WCls1:WndClassEx; WinDC:HDC; PS:TPaintStruct; WinBP:HDC; PB:Boolean; BmpH:HBitmap; CDC:HDC; SelO:HGDIObj; BmpT:tagBitmap; Procedure WinOpen; Var WCN,WT:PChar; WReg:Integer; WH1:HWnd; Begin WCls1.cbSize:=sizeof(WCls1); WCls1.style:=CS_HREDRAW Or CS_VREDRAW; WCls1.lpfnWndProc:=Addr(DefWindowProc); WCls1.cbclsExtra:=0; WCls1.cbWndExtra:=0; WCls1.hInstance:=GetModuleHandle(nil);; WCls1.hIcon:=winprocs.LoadIcon(0, IDI_APPLICATION); WCls1.hCursor:=0; WCls1.hbrBackground:=(14 + 1); WCls1.lpszMenuName:=NiL; WCls1.lpszClassName:='My Window'#0; WCls1.hIconSm:=LoadIcon(WCls1.hInstance, IDI_APPLICATION); WReg:=WinProcs.RegisterClassEx(WCls1); WT:='My Program'#0; WCN:='My Window'#0; HWnd1:=WinProcs.CreateWindow(WCN,WT, {{} ws_popup+ws_tabstop, {NoFrame,NoTitle,NoMenu,NoMove,NoTabStop,00XY00} {{ WS_OVERLAPPED+WS_SIZEBOX+WS_TABSTOP, {ThickFrame,Title,NoMenu,NoMove,NoTabStop,ThanXY00} WinX,WinY,WinWidth,WinHeight, 0,0,GetModuleHandle(NiL),NiL); ShowWindow(HWnd1,sw_show); UpdateWindow(HWnd1); End; Procedure PaintOpen; Begin WinDC:=WinProcs.GetDC(HWnd1); {device context of window} PS.hdc:=WinDC; PS.ferase:=false; PS.rcpaint.left:=WinX; PS.rcpaint.top:=WinY; PS.rcpaint.right:=WinWidth; PS.rcpaint.bottom:=WinHeight; WinBP:=WinProcs.BeginPaint(HWnd1,PS); End; Procedure PaintRect(RX,RY,RWidth,RHeight:Integer;R,G,B:Byte); Var R1:TRect;B1:HBrush; Begin R1.left:=RX; R1.right:=RX+RWidth; R1.top:=RY; R1.bottom:=RY+RHeight; B1:=CreateSolidBrush(((B*256)+G)*256+R); fillrect(WinDC,r1,b1); DeleteObject(B1); End; procedure wndproc(hwnd:hwnd;msg,pw:word;pl:longint); begin case msg of wm_paint:begin WinWidth:=PicWidth+20;WinHeight:=PicHeight+20; WinX:=(1920-WinWidth) Div 2;WinY:=(1080-WinHeight) Div 2; WinOpen; PaintOpen; PaintRect(0,0,WinWidth,WinHeight,0,200,0); PaintRect(10,10,PicWidth,PicHeight,200,0,0); BmpT.bmtype:=0; BmpT.bmwidth:=PicWidth; BmpT.bmheight:=PicHeight; BmpT.bmWidthBytes:=2*BmpT.bmwidth; BmpT.bmplanes:=1; BmpT.bmbitspixel:=24; BmpT.bmBits:=BMem; BmpH:=CreateBitmap(PicWidth,PicHeight,1,24,BMem); CDC:=CreateCompatibleDC(WinDC); SelO:=SelectObject(CDC,BmpH); getobject(BmpH,sizeof(bmpT),Addr(bmpT)); PB:=BitBlT(WinDC,00,00,PicWidth,PicHeight,CDC,00,00,SRCCopy); SelectObject(CDC,SelO); DeleteObject(CDC); end; end; end; Begin FMem:=GetMemory(1000000); AsSign(F,'D:\15333842.bmp'); FH:=FileOpen('D:\15333842.bmp',fmOpenReadWrite); FR:=FileRead(FH,FMem^,909594{FileSize(F)}); Longint(BMem):=longint(FMem)+Longint(Pointer(longint(FMem)+10)^); PicWidth:=LongInt(Pointer(longint(FMem)+18)^); PicHeight:=LongInt(Pointer(longint(FMem)+22)^); Repeat Until GetAsyncKeyState(32)=-32768; end.
  10. milurt

    bitmap is not displayed

    now i have this and i can not see the picture: program BitmapToWindow; {$APPTYPE GUI} uses WinProcs,System.SysUtils; var FMem:Pointer; FH:THandle; F:File of Byte; FR:LongInt; BMem:Pointer; PicWidth,PicHeight:Integer; WinX,WinY,WinWidth,WinHeight, HWnd1:HWND; WCls1:WndClassEx; WinDC:HDC; PS:TPaintStruct; WinBP:HDC; PB:Boolean; BmpH:HBitmap; CDC:HDC; SelO:HGDIObj; BmpT:tagBitmap; Procedure WinOpen; Var WCN,WT:PChar; WReg:Integer; WH1:HWnd; Begin WCls1.cbSize:=sizeof(WCls1); WCls1.style:=CS_HREDRAW Or CS_VREDRAW; WCls1.lpfnWndProc:=Addr(DefWindowProc); WCls1.cbclsExtra:=0; WCls1.cbWndExtra:=0; WCls1.hInstance:=GetModuleHandle(nil);; WCls1.hIcon:=winprocs.LoadIcon(0, IDI_APPLICATION); WCls1.hCursor:=0; WCls1.hbrBackground:=(14 + 1); WCls1.lpszMenuName:=NiL; WCls1.lpszClassName:='My Window'#0; WCls1.hIconSm:=LoadIcon(WCls1.hInstance, IDI_APPLICATION); WReg:=WinProcs.RegisterClassEx(WCls1); WT:='My Program'#0; WCN:='My Window'#0; HWnd1:=WinProcs.CreateWindow(WCN,WT, WS_OVERLAPPED+WS_SIZEBOX+WS_TABSTOP, WinX,WinY,WinWidth,WinHeight, 0,0,GetModuleHandle(NiL),NiL); ShowWindow(HWnd1,sw_show); UpdateWindow(HWnd1); End; Procedure PaintOpen; Begin WinDC:=WinProcs.GetDC(HWnd1); PS.hdc:=WinDC; PS.ferase:=false; PS.rcpaint.left:=WinX; PS.rcpaint.top:=WinY; PS.rcpaint.right:=WinWidth; PS.rcpaint.bottom:=WinHeight; WinBP:=WinProcs.BeginPaint(HWnd1,PS); End; Procedure PaintRect(RX,RY,RWidth,RHeight:Integer;R,G,B:Byte); Var R1:TRect;B1:HBrush; Begin R1.left:=RX; R1.right:=RX+RWidth; R1.top:=RY; R1.bottom:=RY+RHeight; B1:=CreateSolidBrush(((B*256)+G)*256+R); fillrect(WinDC,r1,b1); DeleteObject(B1); End; Begin FMem:=GetMemory(1000000); AsSign(F,'D:\15333842.bmp'); FH:=FileOpen('D:\15333842.bmp',fmOpenReadWrite); FR:=FileRead(FH,FMem^,909594{FileSize(F)}); Longint(BMem):=longint(FMem)+Longint(Pointer(longint(FMem)+10)^); PicWidth:=LongInt(Pointer(longint(FMem)+18)^); PicHeight:=LongInt(Pointer(longint(FMem)+22)^); WinWidth:=PicWidth+20;WinHeight:=PicHeight+20; WinX:=(1920-WinWidth) Div 2;WinY:=(1080-WinHeight) Div 2; WinOpen; PaintOpen; PaintRect(0,0,WinWidth,WinHeight,0,200,0); BmpT.bmtype:=0; BmpT.bmwidth:=PicWidth; BmpT.bmheight:=PicHeight; BmpT.bmWidthBytes:=2*BmpT.bmwidth; BmpT.bmplanes:=1; BmpT.bmbitspixel:=24; BmpT.bmBits:=BMem; BmpH:=CreateBitmap(PicWidth,PicHeight,1,24,BMem); CDC:=CreateCompatibleDC(WinDC); SelO:=SelectObject(CDC,BmpH); getobject(BmpH,sizeof(bmpT),Addr(bmpT)); PB:=BitBlT(WinDC,00,00,PicWidth,PicHeight,CDC,00,00,SRCCopy); SelectObject(CDC,SelO); DeleteObject(CDC); Repeat Until GetAsyncKeyState(32)=-32768; end.
  11. milurt

    bitmap is not displayed

    that before has not worked
  12. milurt

    bitmap is not displayed

    hdcBmp := CreateCompatibleDC(PS.hdc); hOldBmp := SelectObject(hdcBmp, hBmp); BitBlt(PS.hdc, 30, 10, 620, 489, hdcBmp, 0, 0, SRCCOPY); SelectObject(hdcBmp, hOldBmp); DeleteDC(hdcBmp);
  13. milurt

    bitmap is not displayed

    that i don't have inserted
  14. milurt

    bitmap is not displayed

    now i have this and it is still nothing to see, but b=True bmpw:tagbitmap; hbmp:=CreateBitmap(100,100,1,24,RGBMem); bc:=CreateCompatibleDC(winddc); boss:=SelectObject(bc,hbmp); ???: getobject(hbmp,sizeof(bmpw),Addr(bmpw)); b:=bitblt(winddc,0,0,620,489,bc,0,0,SRCCOPY); SelectObject(bc,boss); DeleteObject(bc);
  15. milurt

    bitmap is not displayed

    mister anders melander, do you want to say, what is missed to be a valid GUI? kodezwerg has only made procedure for the createwindow-theme, that types are not my questions. this means no more procedures are to add to show the bitmap? i have no runtime error.
  16. milurt

    bitmap is not displayed

    but who can say the error in my program?
  17. milurt

    bitmap is not displayed

    now compile it: is there a procedure missed? why the picture is not to see in the window? </> program ForumBitmap2023; {$APPTYPE GUI} uses System.SysUtils,windows; Var winc:WNDCLASSEx; wname,wcl:PChar; wnddc:hdc; windbp,hwind:hwnd; PStrc:TPAINTSTRUCT; FH:THandle; FBuf,Bmpf:Pointer; fch:Pchar; F:File of byte; BmpH:HBitmap; Bmp:tagBitmap; BmpDC1:Hdc; bmpdc2:hdc; bmpdc3:hdc; Function wndproc(hwndow:HWND;msga,msgword:word;msglong:longint):LResult;stdcall; Begin 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,700, 500,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:=690; PStrc.rcpaint.bottom:=495; windBP:=BeginPaint(hwind,PStrc); Bmpf:=GetMemory(1000000*2); fch:=bmpf; fch:=fch+10; FBuf:=fch; AsSign(F,'C:\Paints.bmp'); FH:=FileOpen('C:\Paints.bmp',fmOpenReadWrite); FileRead(FH,FBuf^,735829); bmp.bmtype:=0; bmp.bmwidth:=630; bmp.bmheight:=492; bmp.bmWidthBytes:=2*3*bmp.bmwidth; bmp.bmplanes:=1; bmp.bmbitspixel:=24; bmp.bmBits:=FBuf; BmpH:=CreateBitmapIndirect(bmp); bmpdc1:=getdc(bmph); selectobject(bmpdc2,Bmpdc1); BmpDC3:=CreateCompatibleDC(Bmpdc2); BitBlT(wnddc,30,10,620,489,BmpDC3,0,0,SRCCOPY); end. </>
  18. milurt

    bitmap is not displayed

    no tips anymore? why my program does not work.
  19. milurt

    bitmap is not displayed

    the paintstruct defines the area to paint, but after my set of bitmap-drawing procedure i see the window and other drawings but not the bitmap, which i want from tagbitmap place on beginpaint.
  20. if i use getmem's it seems that i need memory paging or segmentation to get the values. can somebody explain an asm,c,delphi source, that is usable like number=Pointer1^;
  21. milurt

    bitmap is not displayed

    i think it is better, if i do not write the complete registerclass and createwindow. than you have more overview. why is that the problem? and the second part of the program are the bitmap-drawing- procedures, where i asked which procedure can be absent. are the variables:=procedures better readable, if i make some spaces at the beginning of the line?
  22. milurt

    memory paging or segmentation

    no, suddenly, but the problem was a half year long.
  23. milurt

    memory paging or segmentation

    now my program works.
  24. milurt

    memory paging or segmentation

    i see nowhere sizeof(char) in my program. why is a +1 a +2? for does not change it and getmemory is done for 1x3000000, which was not so important, because i get the runtime error at each segm:0000 and segm:0001 where i write to not at 3000000+1
×