wchar_t wch[MAX_PATH];
::PathCombine(wch, _T("D:"), _T(".//aa.caj"));
编译结果error C2039: 'PathCombine' : is not a member of '`global namespace''
error C2065: 'PathCombine' : undeclared identifier
如何解决啊

解决方案 »

  1.   

    #include <windows.h>
    #include <iostream.h>
    #include "Shlwapi.h"void main( void )
    {
    // Buffer to hold combined path.
    char buffer_1[MAX_PATH] = "";
    char *lpStr1;
    lpStr1 = buffer_1;// String for balance of path name.
    char buffer_2[] = "One\\Two\\Three";
    char *lpStr2;
    lpStr2 = buffer_2;// String for directory name.
    char buffer_3[] = "C:";
    char *lpStr3;
    lpStr3 = buffer_3;cout << "The file path to be combined is  " 
         << lpStr2<< endl;
    cout << "The directory name path is       " 
         << lpStr3<< endl;
    cout << "The combined path is             " 
         << PathCombine(lpStr1,lpStr3,lpStr2) << endl;}
    ------------
    INPUT:
    ------------
    Path for directory part: "C:"
    Path for file part: "One\Two\Three"
    ------------
    OUTPUT:
    ------------
    The file path to be combined is  One\Two\Three
    The directory name path is       C:
    The combined path is             C:\One\Two\Three
      

  2.   

    试试这个: CString  sPath;//可执行文件路径名
            CString fPath;//aa.caj的全路径名
    GetModuleFileName(NULL,sPath.GetBufferSetLength(MAX_PATH+1),MAX_PATH); 
    sPath.ReleaseBuffer(); 
    int nPos; 
    nPos=sPath.ReverseFind('\\'); 
    sPath=sPath.Left(nPos);  fPath = sPath+"\\Temp\\aa.caj";//假定aa.caj在你的可执行文件同路径下的temp文件夹下
    AfxMessageBox(fPath);//输出全路径名
      

  3.   

    俺是用MFC搭了个简单的架子,加了个按钮测试的~~