如何知道我的某一个进程正在运行?

uk 2002-02-01 09:15:06
有什么比较高效的方法吗?
...全文
115 9 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
uk 2002-02-01
  • 打赏
  • 举报
回复
Process Viewer 也不能实时刷新
Koshima 2002-02-01
  • 打赏
  • 举报
回复
还是用vss自带的“Process Viewer"吧,这个最省事!
你可以观察当前正在运行的所有进程!
kimryo 2002-02-01
  • 打赏
  • 举报
回复
用个特殊的类名称,直接FindWindow就行了。
masterz 2002-02-01
  • 打赏
  • 举报
回复
http://www.codeguru.com/win32/previnst.shtml
// CPreviousInstance.h

class CPreviousInstance
{
public:
CPreviousInstance();
virtual ~CPreviousInstance();

LONG Count() const
{
return m_previous;
}

private:
static LONG s_count;
LONG m_previous;

CPreviousInstance(const CPreviousInstance&);
CPreviousInstance& operator=(const CPreviousInstance&);
};

// CPreviousInstance.cpp

// static instance count stored in a shared read/write section

#pragma data_seg("Instance")

LONG CPreviousInstance::s_count = 0;

#pragma data_seg()
#pragma comment(linker,"/section:Instance,rws")


// Construction/Destruction

CPreviousInstance::CPreviousInstance():
m_previous(0)
{
m_previous = ::InterlockedIncrement(&s_count);
--m_previous;
}

CPreviousInstance::~CPreviousInstance()
{
::InterlockedDecrement(&s_count);
}
uk 2002-02-01
  • 打赏
  • 举报
回复
我想知道程序启动时他会向系统发送一个什么消息,这样我就不用枚举系统里所有的进程信息了,那样太慢了。
各位能谈谈CMutex具体做法吗?我很急,谢谢各位!
masterz 2002-02-01
  • 打赏
  • 举报
回复
create a named CMutex in your program, to detect the existence of your, program, you can try to do the samething , if success, no previous instance exists, otherwise there is a previous instance running.
scklotz 2002-02-01
  • 打赏
  • 举报
回复
在你的程序里建立一个信号量或则mutex,
然后就可以监测到.
scklotz 2002-02-01
  • 打赏
  • 举报
回复
在你的程序里建立一个信号量或则mutex,
然后就可以监测到.
storein 2002-02-01
  • 打赏
  • 举报
回复
使用FINDWINDOW()

1,658

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 非技术类
社区管理员
  • 非技术类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧