技工之家

Let's talk about tech

导航

WinMain - 如何检测是否已有应用程序的实例运行

不能用hInstance参数

以下摘自MSDN:
hPrevInstance
[in] Handle to the previous instance of the application. This parameter is always NULL. If you need to detect whether another instance already exists, create a uniquely named mutex using the CreateMutex function. CreateMutex will succeed even if the mutex already exists, but the function will return ERROR_ALREADY_EXISTS. This indicates that another instance of your application exists, because it created the mutex first.

posted on 2005-01-23 16:47  techmania  阅读(385)  评论(0编辑  收藏  举报