在ActiveX中显示图片(其他程序中通用)

      CString szFilename ("c://temp//1678391_6878.bmp");
      
      CDC   *dc   =   GetDC(); 
      CDC bmDC;
       HBITMAP hBmp =
      (HBITMAP)::LoadImage(NULL,szFilename,IMAGE_BITMAP,0,0,LR_LOADFROMFILE|LR_CREATEDIBSECTION);
       CBitmap bmp;
       bmp.Attach(hBmp);
      bmDC.CreateCompatibleDC(dc);
      CBitmap *pOldbmp=bmDC.SelectObject(&bmp);
      BITMAP bi;
      bmp.GetBitmap(&bi);
      dc->BitBlt(0,0,bi.bmWidth,bi.bmHeight,&bmDC,0,0,SRCCOPY);
      bmDC.SelectObject(pOldbmp);

你可能感兴趣的:(c,image,null,BI)