: error C2664: 'NetShareEnum' : cannot convert parameter 1 from 'unsigned short [18]' to 'char *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast 
: error C2664: 'NetServerDiskEnum' : cannot convert parameter 1 from 'unsigned short [18]' to 'char *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
 : error C2664: 'NetWkstaGetInfo' : cannot convert parameter 1 from 'unsigned short [18]' to 'char *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
 : error C2664: 'NetServerGetInfo' : cannot convert parameter 1 from 'unsigned short [18]' to 'char *'Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
: error C2664: 'NetSessionEnum' : cannot convert parameter 1 from 'unsigned short [18]' to 'char *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
 : error C2664: 'NetServerTransportEnum' : cannot convert parameter 1 from 'unsigned short [18]' to 'char *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast

解决方案 »

  1.   

    代码呢? 好象是不同类型的串. 可以使用转换宏来试试:USES_CONVERSION;char name[18] = "MyServer";
    state = NetServerGetInfo(A2W(name), 101, &p101);
      

  2.   

    能不能详细一点啊,我定义了WCHAR servername[20];但是NetShareEnum这个函数第一个参数需要是LPWSTR,怎么样能使用NetShareEnum这个函数??
    NetShareEnum(
      LPWSTR servername,
      DWORD level,
      LPBYTE* bufptr,
      DWORD prefmaxlen,
      LPDWORD entriesread,
      LPDWORD totalentries,
      LPDWORD resume_handle
    );