Einzelnen Beitrag anzeigen

minimops

Registriert seit: 22. Jan 2004
56 Beiträge
 
Delphi 2005 Professional
 
#1

Aus DIB ein Bitmap erzeugen

  Alt 14. Feb 2006, 22:38
Ich möchte Informationen aus dem Internet Explorer in mein Programm via Drag and Drop ziehen. Text + HTML klappen prima, nur mit den Bildern komme ich nicht zurecht.

Es wird immer nur ein weisses Rechteck angezeigt...

Delphi-Quellcode:
procedure TForm1.HandleDIB( dataObj : IDataObject; fetc : TFormatEtc );
var
   p : pointer;
   stgm : TSTGMEDIUM;
   BMIH : TBITMAPINFO;
   bmp :HBITMAP;
    _HDC, hDC : windows.HDC;
begin
      {Make certain the data rendering is available}
   if( dataObj.QueryGetData( fetc ) = NOERROR ) then
   begin
         {Get the data}
      dataObj.GetData( fetc, stgm );

         {Lock the global memory handle to get
           a pointer to the data}


      BMIH := TBITMAPINFO(GlobalLock(stgm.hGlobal)^);

      with bmih.bmiHeader do bmp:=CreateBitmap (biWidth,biHeight,biPlanes,biBitCount,@bmih.bmiColors);


        _HDC := GetDC(Self.Handle);
         hDC := CreateCompatibleDC(_HDC);
        SelectObject(hDC, bmp);

        BitBlt (hDC, 0, 0, bmih.bmiHeader.biWidth, bmih.bmiHeader.biHeight, img.Canvas.Handle, 0, 0, cmSrcCopy); // Nur zum Füllen von bmp
        BitBlt(_HDC, 0, 0, bmih.bmiHeader.biWidth, bmih.bmiHeader.biHeight, hDC, 0, 0, cmSrcCopy);

         {Finished with the pointer}
      GlobalFree( stgm.hGlobal );

         {Free the memory}
      ReleaseStgMedium( stgm );
   end;
end;
Was mach ich falsch????

Danke Axel
Angehängte Dateien
Dateityp: zip testpog_534.zip (2,3 KB, 15x aufgerufen)
  Mit Zitat antworten Zitat