如题,我是在dll中调用这两个函数的,但是它们都没有获得相关内容 都是空,使用getlasterror返回0,不知道这是怎么回事,请大家指导指导

解决方案 »

  1.   

    GetModuleFileName吧?哪来的GetModuleName
      

  2.   

    GetLastError()返回值0说明成功了
    看下传进的参数对不对
    lpBuffer 
    Pointer to a buffer that receives a null-terminated string containing the computer name. The buffer size should be large enough to contain MAX_COMPUTERNAME_LENGTH + 1 characters. 
    nSize 
    Pointer to a DWORD variable. On input, the variable specifies the size, in bytes or characters, of the buffer. On output, the variable returns the number of bytes or characters copied to the destination buffer, not including the terminating null character. 
    If the buffer is too small, the function fails, GetLastError returns ERROR_BUFFER_OVERRUN, and the variable returns the required buffer size including the terminating null character.