当前位置: 代码迷 >> VC >> 如何用C++生成动态连接库
  详细解决方案

如何用C++生成动态连接库

热度:3692   发布时间:2013-02-25 00:00:00.0
怎么用C++生成动态连接库
要用C++做个DLL,程序代码是网上找的但是无法生成

代码如下:
HRESULT CShortCutDlg::CreateThumbnail(DWORD dwWidth, DWORD dwHeight, HBITMAP* pThumbnail) 

     LPITEMIDLIST pidlItems = NULL, pidlURL = NULL, pidlWorkDir = NULL; 
     ULONG   ulParseLen = 0;
     HRESULT hr; 
     WCHAR pszPath[MAX_PATH]; 
     DWORD dwPriority = 0, dwFlags = IEIFLAG_ASPECT; 
     SIZE size = { dwWidth, dwHeight }; 
     IExtractImage* peiURL = NULL;    // nterface is used to request a thumbnail image from a Shell folder
     IShellFolder* psfDesktop = NULL; 
     IShellFolder* psfWorkDir = NULL; 
     IMalloc*  pMalloc = NULL;
 
     wstring wsDir,wsFile,wsTempFile; 
 
     // 初始化Com库
     if ( CoInitialize( NULL ) != 0 )
     {
         AfxMessageBox( _T( "初始化Com库失败!" ) );
         goto OnExit;
     }
 
     // 获得 IMalloc接口
     hr = SHGetMalloc( &pMalloc );
     if ( FAILED( hr ) )
     {
         goto OnExit;
     }
 
     // 获得桌面文件夹
     hr = SHGetDesktopFolder(&psfDesktop); 
     if(FAILED(hr)) goto OnExit; 
 
     //// create shortcut if URL 
     //if(PathIsURLW(m_wsPath.c_str())) { 
     //   wsTempFile = m_wsTempPath; wsTempFile += TEMP_URL; 
     //   // 自定义函数CreateURLShortcut
     //   if(!CreateURLShortcut(m_wsPath.c_str(), wsTempFile.c_str())) goto OnExit; 
     //   wsDir = m_wsTempPath; 
     //   wsFile = TEMP_URL; 
     //} 
     //else { 
     //   wsDir = m_wsDir; 
     //   wsFile = m_wsFile; 
     //} 
     wsDir = m_wsDir;
     wsFile = m_wsFile;
     // get working directory 
     wcscpy(m_wsBuffer,wsDir.c_str()); 
     // ParseDisplayName:Translates a file object's or folder's display name into an item identifier list.
     hr = psfDesktop->ParseDisplayName(NULL, NULL, m_wsBuffer, &ulParseLen, &pidlWorkDir, NULL); 
  相关解决方案