如题

解决方案 »

  1.   

    FindWindow应该只能得到窗口句柄,而非进程句柄吧然后通过GetWindowThreadProcessId可以取得进程ID
    再以Process32First、Process32Next枚举当前的进程,可以得到进程的执行文件名,但得不到路径
      

  2.   

    试一下这个:
    DWORD GetModuleFileName(
      HMODULE hModule,    // handle to module
      LPTSTR lpFilename,  // path buffer
      DWORD nSize         // size of buffer
    );
      

  3.   

    DWORD GetModuleFileNameEx(
      HANDLE hProcess,    // handle to process
      HMODULE hModule,    // handle to module
      LPTSTR lpFilename,  // path buffer
      DWORD nSize         // maximum characters to retrieve
    );
    Parameters
    hProcess 
    [in] Handle to the process that contains the module. 
    hModule 
    [in] Handle to the module. 
    lpFilename 
    [out] Pointer to the buffer that receives the fully qualified path to the module. If the file name is longer than maximum number of characters specified by the nSize parameter, the file name is truncated. 
    nSize 
    [in] Specifies the maximum number of characters to copy to the lpFilename buffer.