现有一个程序,须用程序判断其是否运行及运行状态
我知道可以用句柄但不知道具体如何做?
请各位大侠帮帮忙

解决方案 »

  1.   

    每次运行其句柄不一样,你可以用findwind()来得到主窗口的句柄,
      

  2.   

    用SOCKET来进行两个程序的通信.
      

  3.   

    findwindow比较简单,不过需要依赖于特定的窗口标题,
    还是用CreateMutex创建互斥对象好一些
      

  4.   

    FindWindow+GetWindowProcessID+OpenProcess
      

  5.   

    HWND FindWindow(    LPCTSTR lpClassName, // pointer to class name
        LPCTSTR lpWindowName  // pointer to window name
       );If the function succeeds, the return value is the handle to the window that has the specified class name and window name.
    If the function fails, the return value is NULL. To get extended error information, call GetLastError.