视觉c++ 2010年将User32.dll导入64位win7时出错
在 64 位 win7 上运行 Visual C++ 2010,这一行
#include "C:\Windows\SysWOW64\user32.dll"
是正确的路径,但是错误包括
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
我使用它来获取 keybd_event() 工作的变体,因为 msdn 说 User32.dll 是一个要求。谢谢 ! *注意:错误位于代码格式块中,因为否则它不会让我提交它
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这不是导入库的方式。您只是试图包含一个二进制文件。这与 32/64 位无关。
您需要执行的操作是将
user32.lib
添加到您的库路径中。您可以通过以下方式在 Visual Studio 中导入库:
将“user32.lib”添加到列表中。
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:
Add "user32.lib" to the list.
使用
#include
代替Use
#include <windows.h>
instead你通过LoadLibrary()函数加载dll文件,它需要“windows.h”,但是Visual Studio在运行时默认添加重要的lib文件,如“user32.lib”和“kernal32.lib”等,所以你只需要包含头文件使该功能发挥作用。
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.