请大神帮忙看看这个C++判断程序是否在运行的代码,请问哪里错了,运行后总是输出xxx
#include<Windows.h>#include<stdio.h>#include<stdlib.h>intIsAppExist(void){HANDLEmutex...
#include <Windows.h>
#include <stdio.h>
#include <stdlib.h>
int IsAppExist(void)
{
HANDLE mutex;
mutex = CreateMutex(NULL, FALSE, TEXT("explorer.exe"));
if (GetLastError() == ERROR_ALREADY_EXISTS) {
return 1;
}
else {
return 0;
}
}
int main(void)
{
if (IsAppExist() != 0) {
printf("One instance of the application is running.\n");
}
else {
printf("xxx\n");
}
return 0;
} 展开
#include <stdio.h>
#include <stdlib.h>
int IsAppExist(void)
{
HANDLE mutex;
mutex = CreateMutex(NULL, FALSE, TEXT("explorer.exe"));
if (GetLastError() == ERROR_ALREADY_EXISTS) {
return 1;
}
else {
return 0;
}
}
int main(void)
{
if (IsAppExist() != 0) {
printf("One instance of the application is running.\n");
}
else {
printf("xxx\n");
}
return 0;
} 展开
- 你的回答被采纳后将获得:
- 系统奖励15(财富值+成长值)+难题奖励10(财富值+成长值)+提问者悬赏20(财富值+成长值)
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询