VC CreateToolhelp32Snapshot函数使用
我用的VC6.0下面是我的代码:voidCAsdfasdfDlg::OnButton1(){//TODO:Addyourcontrolnotificationhandle...
我用的VC6.0 下面是我的代码:
void CAsdfasdfDlg::OnButton1()
{
// TODO: Add your control notification handler code here
HANDLE h=CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);
}
错误提示:
ompiling...
asdfasdfDlg.cpp
C:\Program Files\Microsoft Visual Studio\MyProjects\进程查找\asdfasdf\asdfasdfDlg.cpp(176) : error C2065: 'CreateToolhelp32Snapshot' : undeclared identifier
C:\Program Files\Microsoft Visual Studio\MyProjects\进程查找\asdfasdf\asdfasdfDlg.cpp(176) : error C2065: 'TH32CS_SNAPPROCESS' : undeclared identifier
C:\Program Files\Microsoft Visual Studio\MyProjects\进程查找\asdfasdf\asdfasdfDlg.cpp(176) : error C2440: 'initializing' : cannot convert from 'int' to 'void *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
Error executing cl.exe.
asdfasdf.exe - 3 error(s), 0 warning(s)
我实在是想不通就这样调用也会编译不通过。求高手指点迷津啊! 展开
void CAsdfasdfDlg::OnButton1()
{
// TODO: Add your control notification handler code here
HANDLE h=CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);
}
错误提示:
ompiling...
asdfasdfDlg.cpp
C:\Program Files\Microsoft Visual Studio\MyProjects\进程查找\asdfasdf\asdfasdfDlg.cpp(176) : error C2065: 'CreateToolhelp32Snapshot' : undeclared identifier
C:\Program Files\Microsoft Visual Studio\MyProjects\进程查找\asdfasdf\asdfasdfDlg.cpp(176) : error C2065: 'TH32CS_SNAPPROCESS' : undeclared identifier
C:\Program Files\Microsoft Visual Studio\MyProjects\进程查找\asdfasdf\asdfasdfDlg.cpp(176) : error C2440: 'initializing' : cannot convert from 'int' to 'void *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
Error executing cl.exe.
asdfasdf.exe - 3 error(s), 0 warning(s)
我实在是想不通就这样调用也会编译不通过。求高手指点迷津啊! 展开
1个回答
展开全部
CreateToolhelp32Snapshot
Requirements
Minimum supported clientWindows XP [desktop apps only]
Minimum supported serverWindows Server 2003 [desktop apps only]
Header TlHelp32.h
Library Kernel32.lib
DLL Kernel32.dll
_______
有没有包含头文件TlHelp32.h?
Requirements
Minimum supported clientWindows XP [desktop apps only]
Minimum supported serverWindows Server 2003 [desktop apps only]
Header TlHelp32.h
Library Kernel32.lib
DLL Kernel32.dll
_______
有没有包含头文件TlHelp32.h?
更多追问追答
追答
包含了还有错误? 可能是windows sdk的版本低吧,装个高版本,或者装新一点的visual studio
或者你用GetProcAddress(http://baike.baidu.com/view/1523523.htm)动态加载DLL中的函数
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询