视觉c++ 2010年将User32.dll导入64位win7时出错

发布于 2024-12-08 02:10:36 字数 720 浏览 3 评论 0原文

在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

秋风の叶未落 2024-12-15 02:10:36

这不是导入库的方式。您只是试图包含一个二进制文件。这与 32/64 位无关。

您需要执行的操作是将 user32.lib 添加到您的库路径中。

您可以通过以下方式在 Visual Studio 中导入库:

Project -> Properties -> Linker -> Additional Dependencies

将“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:

Project -> Properties -> Linker -> Additional Dependencies

Add "user32.lib" to the list.

鱼窥荷 2024-12-15 02:10:36

使用 #include 代替

Use #include <windows.h> instead

囍笑 2024-12-15 02:10:36

你通过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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文