visual c++ 2010 errors importing User32.dll into 64bit win7

被刻印的时光 ゝ 提交于 2019-12-31 02:46:20

问题


Running visual c++ 2010 on 64bit win7, this line

#include "C:\Windows\SysWOW64\user32.dll"

its the correct path, the errors however include variations of

1>C:\Windows\SysWOW64\user32.dll(1): error C2018: unknown character '0x3'
1>C:\Windows\SysWOW64\user32.dll(1): error C2018: unknown character '0x4'
1>C:\Windows\SysWOW64\user32.dll(1): error C2018: unknown character '0x40'
1>C:\Windows\SysWOW64\user32.dll(1): error C2146: syntax error : missing ';' before identifier 'ÿÿ¸'
1>C:\Windows\SysWOW64\user32.dll(1): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

I am using it to get keybd_event() working as msdn says User32.dll is a requirement. Thanks ! *Note: The errors are in a code format block because it wouldn't let me submit it otherwise


回答1:


That's not how you import libraries. You just tried to include a binary. This has nothing to do with 32/64 bits.

What you need to do it add user32.lib to your library path.

You can import a library in Visual Studio by:

Project -> Properties -> Linker -> Additional Dependencies

Add "user32.lib" to the list.




回答2:


Use #include <windows.h> instead




回答3:


u load dll files by LoadLibrary() function which requires "windows.h" ,however visual studio add importatnt lib files like "user32.lib" and "kernal32.lib" etc defaultly at run time,so u just have to include header file to get that function work.



来源:https://stackoverflow.com/questions/7642125/visual-c-2010-errors-importing-user32-dll-into-64bit-win7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!