HINSTANCE  是什么类型的变量,一般在什么地方使用?给一个例子

解决方案 »

  1.   

    The m_hInstance data member is a handle to the current instance of the application running under Windows
       HCURSOR hCursor;
       hCursor = ::LoadCursor(AfxGetApp()->m_hInstance, 
          MAKEINTRESOURCE(IDC_MYCURSOR));
      

  2.   

    BOOL CFixHtmlView::LoadFromResource(UINT nRes)
    {
        HINSTANCE hInstance = AfxGetResourceHandle();
        ASSERT(hInstance != NULL);    CString strResourceURL;
        BOOL bRetVal = TRUE;
        LPTSTR lpszModule = new TCHAR[_MAX_PATH];    if (GetModuleFileName(hInstance, lpszModule, _MAX_PATH))
        {
           strResourceURL.Format(_T("res://%s/%d"), lpszModule, nRes);
           Navigate(strResourceURL, 0, 0, 0);
        }
        else
           bRetVal = FALSE;    delete [] lpszModule;
        return bRetVal;
    }