我想监视某个程序是否启动,主要是想得到该程序所在的目录在哪里?
谢谢

解决方案 »

  1.   

    DWORD GetModuleFileName(
      HMODULE hModule,    // handle to module
      LPTSTR lpFilename,  // path buffer
      DWORD nSize         // size of buffer
    );
      

  2.   

    6:如何得到当前应用程序路径?
     char *str = new char[256]; 
     ::GetModuleFileName(NULL,str,MAX_PATH);
     //str即为所求
     delete []str;
     str=NULL;
      

  3.   

    hModule不能是空,我是要取得"其他"程序而不是本程序的所在目录
      

  4.   

    用GetModuleHandle函数:
    The GetModuleHandle function retrieves a module handle for the specified module if the file has been mapped into the address space of the calling process.HMODULE GetModuleHandle(
      LPCTSTR lpModuleName
    );
    HINSTANCE hInst=GetModelHandle("MyDll.dll");
      

  5.   

    这个我看了,对你有帮助:http://www.vckbase.com/code/listcode.asp?mclsid=13&sclsid=1305&page=2
    如何获取某个进程的主窗口以及创建进程的程序名?