#include <windows.h>
#include <winperf.h> // for Windows NT
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <tlhelp32.h> // for Windows 95
#include <psapi.h>.......func() {
......... HANDLE hProcessSnap = NULL;
BOOL bRet = FALSE;
PROCESSENTRY32 pe32 = {0}; hProcessSnap = CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 );
pe32.dwSize = sizeof(PROCESSENTRY32); BOOL pOK = Process32First( hProcessSnap, pe32 ); for ( ; pOK; pOK = Process32Next( hProcessSnap, pe32 ) ) {
}
.........}
编译报错:
--------------------Configuration: WatchDog - Win32 Debug--------------------
Compiling...
WatchDogDlg.cpp
E:\VCProject\chinalife\WatchDog\WatchDogDlg.cpp(277) : error C2065: 'PROCESSENTRY32' : undeclared identifierE:\VCProject\chinalife\WatchDog\WatchDogDlg.cpp(277) : error C2065: 'pe32' : undeclared identifierE:\VCProject\chinalife\WatchDog\WatchDogDlg.cpp(279) : error C2065: 'CreateToolhelp32Snapshot' : undeclared identifierE:\VCProject\chinalife\WatchDog\WatchDogDlg.cpp(279) : error C2065: 'TH32CS_SNAPPROCESS' : undeclared identifierE:\VCProject\chinalife\WatchDog\WatchDogDlg.cpp(279) : error C2440: '=' : cannot convert from 'int' to 'void *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style castE:\VCProject\chinalife\WatchDog\WatchDogDlg.cpp(282) : error C2065: 'Process32First' : undeclared identifier
E:\VCProject\chinalife\WatchDog\WatchDogDlg.cpp(284) : error C2065: 'Process32Next' : undeclared identifier..........怎么会这样?我是在2000Server上编译的,难道跟系统有关?我把msdn上的sample code拿过来编译也是如此!!哪位高手指点一二,小弟不胜感激!
#include <winperf.h> // for Windows NT
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <tlhelp32.h> // for Windows 95
#include <psapi.h>.......func() {
......... HANDLE hProcessSnap = NULL;
BOOL bRet = FALSE;
PROCESSENTRY32 pe32 = {0}; hProcessSnap = CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 );
pe32.dwSize = sizeof(PROCESSENTRY32); BOOL pOK = Process32First( hProcessSnap, pe32 ); for ( ; pOK; pOK = Process32Next( hProcessSnap, pe32 ) ) {
}
.........}
编译报错:
--------------------Configuration: WatchDog - Win32 Debug--------------------
Compiling...
WatchDogDlg.cpp
E:\VCProject\chinalife\WatchDog\WatchDogDlg.cpp(277) : error C2065: 'PROCESSENTRY32' : undeclared identifierE:\VCProject\chinalife\WatchDog\WatchDogDlg.cpp(277) : error C2065: 'pe32' : undeclared identifierE:\VCProject\chinalife\WatchDog\WatchDogDlg.cpp(279) : error C2065: 'CreateToolhelp32Snapshot' : undeclared identifierE:\VCProject\chinalife\WatchDog\WatchDogDlg.cpp(279) : error C2065: 'TH32CS_SNAPPROCESS' : undeclared identifierE:\VCProject\chinalife\WatchDog\WatchDogDlg.cpp(279) : error C2440: '=' : cannot convert from 'int' to 'void *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style castE:\VCProject\chinalife\WatchDog\WatchDogDlg.cpp(282) : error C2065: 'Process32First' : undeclared identifier
E:\VCProject\chinalife\WatchDog\WatchDogDlg.cpp(284) : error C2065: 'Process32Next' : undeclared identifier..........怎么会这样?我是在2000Server上编译的,难道跟系统有关?我把msdn上的sample code拿过来编译也是如此!!哪位高手指点一二,小弟不胜感激!
下载SDK应该是一个办法,但在微软网站上找不到,不知哪儿有下载