如果是自己的程序不让启动两个,
可以加上互斥变量。
// Create mutex, because there cannot be 2 instances of Updater for same application
HANDLE hMutex = CreateMutex(NULL, FALSE, "update_" + pSettings->GetAppName());
这样就可以了!
楼上的兄弟,我怎么编译出错?------ Rebuild All started: Project: www, Configuration: Debug Win32 ------
Deleting intermediate files and output files for project 'www', configuration 'Debug|Win32'.
Compiling...
gggg.cpp
Linking...
gggg.obj : error LNK2019: unresolved external symbol _GetModuleBaseNameA@16 referenced in function "void __cdecl PrintProcessNameAndID(unsigned long)" (?PrintProcessNameAndID@@YAXK@Z)
gggg.obj : error LNK2019: unresolved external symbol _EnumProcessModules@16 referenced in function "void __cdecl PrintProcessNameAndID(unsigned long)" (?PrintProcessNameAndID@@YAXK@Z)
gggg.obj : error LNK2019: unresolved external symbol _EnumProcesses@12 referenced in function _main
Debug/www.exe : fatal error LNK1120: 3 unresolved externals
Build log was saved at "file://c:\Documents and Settings\andy.huang.01\My Documents\Visual Studio Projects\www\Debug\BuildLog.htm"
www - 4 error(s), 0 warning(s)