thanks

解决方案 »

  1.   

    补充:MSDN上说
    The MAKEINTRESOURCE macro converts an integer value to a resource type compatible with the resource-management functions. This macro is used in place of a string containing the name of the resource. LPTSTR MAKEINTRESOURCE(
      WORD wInteger  
    );
    这个参数是什么意识?
    假如我insert一bmp图片 资源id IDB_BITMAP1
    那么如果我想用
    HBITMAP LoadBitmap(
    HINSTANCE hInstance, 
    LPCTSTR lpBitmapName
    ); 
    其中MSDN上说 lpBitmapName参数
    [in] Long pointer to a null-terminated string that contains the name of the bitmap resource to be loaded. Alternatively, this parameter can consist of the resource identifier in the low-order word and zero in the high-order word. The MAKEINTRESOURCE macro can be used to create this value. 
    那么如何用MAKEINTRESOURCE宏来做呢?GIVE ME SAMPLE/. 
      

  2.   

    疑问:dnyz(hcl)说 MAKEINTRESOURCE(SOURCE_ID)用(MFC)APPWIZARD生成基于对话框程序。
    添加picture控件对应的成员变量m_pic
    BOOL CMy123Dlg::OnInitDialog()
    {
    CDialog::OnInitDialog();
     .........................
     m_pic.SetBitmap(::LoadBitmap(NULL,MAKEINTRESOURCE(IDB_BITMAP1)));  return TRUE; 
    }为什么不能显示图片呢?????
      

  3.   

    你也可以这样用:
    ASSERT(lpBitmapName);HBITMAP hBitmap = NULL; 
    hBitmap = (HBITMAP)LoadImage(NULL, lpBitmapName, IMAGE_BITMAP, 0, 0,
    LR_LOADFROMFILE | LR_CREATEDIBSECTION | LR_DEFAULTSIZE);
      

  4.   

    HICON hIcon = LoadIcon(hInst,MAKEINTRESOURCE(IDI_FOLDER1));
    這是一個裝載圖標的語句。 bmp也類似吧。
      

  5.   

    to  masterdog()
    thanks your code 
    但是,我想知道的是MAKEINTRESOURCE macro的用法,而不是如何load图片
      

  6.   

    to rokia()
    那么 masterdog(掌门狗) 楼上那位(也就是我)的代码错在哪呢?
      

  7.   

    其实picture控件可以非常方便的使用:插入该控件,选择属性/Type: 为Bitmap; /Image: 为IDB_BITMAP1然后确保IDB_BITMAP1已经加入到工程,此时就可以显示了,至于你那个问题,其实是::LoadBitmap函数返回了空位图句柄。原因是它的第一个参数被你给设成了NULL,如果设置成AfxGetInstanceHandle()就好了,即:m_pic.SetBitmap(::LoadBitmap(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_BITMAP1)));