问题描述
我正在尝试使用 WINAPI :: Process32First,WINAPI :: Process32Next,
和 WINAPI :: CreateToolhelp32Snapsho t函数来获取和迭代我当前正在运行的进程。
I am trying to use the WINAPI::Process32First, WINAPI::Process32Next, and WINAPI::CreateToolhelp32Snapshot functions to get and iterate through my current running processes.
这是我的函数
void KillRunningProcess()
{
std::wstring process;
std::wstring compare = L"myprocess.exe";
HANDLE hProcessSnap;
PROCESSENTRY32 pe32;
hProcessSnap = WINAPI::CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
pe32.dwSize = sizeof(PROCESSENTRY32);
//Get first running process
Process32First(hProcessSnap, &pe32);
while (WINAPI::Process32Next(hProcessSnap, &pe32))
{
process = pe32.szExeFile;
if(compare == process)
{
//kill process
break;
}
}
CloseHandle(hProcessSnap);
}
我在我的文件中包含了tlhelp32.h,但是我收到了以下错误:
3 错误
错误C2059:语法错误:' __cdecl'{log =" C:\ WWINCE700 \Subprojects \\\\\\\\\\\\\\\\\\\\\\\\\\\\\
c:\ wince700 \subprojects \ server \ parser.cpp
310
4 错误
错误C2059:语法错误:'__ cdecl'{log =" C:\WINCE700 \Subprojects \\\\\\\\\\\\ )"}
c:\ wince700 \subprojects\server\parser.cpp
315
5 错误
错误C2143:语法错误:缺少';'之前'{'{log = "C:\ WINCE700 \Subprojects\server \ bldsys.log(33)"}
c:\wince700\subprojects\server\parser.cpp
316
3 Errorerror C2059: syntax error : '__cdecl' {log="C:\WINCE700\Subprojects\server\bldsys.log(31)"}c:\wince700\subprojects\server\parser.cpp310
4 Errorerror C2059: syntax error : '__cdecl' {log="C:\WINCE700\Subprojects\server\bldsys.log(32)"}c:\wince700\subprojects\server\parser.cpp315
5 Errorerror C2143: syntax error : missing ';' before '{' {log="C:\WINCE700\Subprojects\server\bldsys.log(33)"}c:\wince700\subprojects\server\parser.cpp316
我不知道该如何处理。任何帮助将不胜感激。
Im not sure what to do with this. Any help would be appreciated.
谢谢,
推荐答案
这篇关于未解析的外部符号Process32First的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!