d:\program files\microsoft visual studio\myprojects\6\6.cpp(35) : fatal error C1010: unexpected end of file while looking for precompiled header directive
Error executing cl.exe.
6.obj - 1 error(s), 0 warning(s)
编译时出现的这个是什么问题???
时一个进程pid码的小程序源码如下,求大虾指导!!
其实是想由一个程序完成进程的pid以及对应端口等属性的查询。。。汗!!
#include <stdio.h>
#include <windows.h>
#include "PSAPI.H"
#pragma comment( lib, "PSAPI.LIB" )
int main(void)
{
DWORD processid[1024],needed,processcount,i;
HANDLE hProcess;
HMODULE hModule;
char path[MAX_PATH] = "",temp[256];
printf("ShowProcessPath with [Process Status API]\n\n");
EnumProcesses(processid, sizeof(processid), &needed);
processcount=needed/sizeof(DWORD);
for (i=0;i<processcount;i++)
{
hProcess=OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ,false,processid[i]);
if (hProcess)
{
EnumProcessModules(hProcess, &hModule, sizeof(hModule), &needed);
GetModuleFileNameEx(hProcess, hModule, path, sizeof(path));
GetShortPathName(path,path,256);
itoa(processid[i],temp,10);
printf("%s --- %s\n",path,temp);
}
else
printf("Failed!!!\n");
}
CloseHandle(hProcess);
CloseHandle(hModule);
itoa(processcount,temp,10);
printf("\nProcess Count:%s\n\n",temp);
return 0;
}
[注意]传递专业知识、拓宽行业人脉——看雪讲师团队等你加入!