编译器找不到结构,我应该包括什么

发布于 2024-08-16 11:57:43 字数 1170 浏览 7 评论 0原文

更新: 我以为是 Windsows.hi 需要包含,并且您已经确认了这一点,但是当我包含它时,我收到了一堆类似以下的消息...

1>C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\objidl.h(5934) : error C2872: 'IDataObject' : ambiguous symbol
1>        could be 'C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\objidl.h(251) : System::Windows::Forms::IDataObject IDataObject'
1>        or       'c:\windows\microsoft.net\framework\v2.0.50727\system.windows.forms.dll : System::Windows::Forms::IDataObject

我不知道如何解决这个问题,eik!


我正在尝试调用 PeekMessage 但当我尝试编译时出现以下错误。

'MSG':未声明的标识符 'HWND':未声明的标识符 'PM_REMOVE':未声明的标识符

我的代码如下...

MSG message;
    while(form->Created)
                {
                    while( PeekMessage( &message, (HWND)form->Handle.ToPointer(), 0, 0, PM_REMOVE ) )
                    {
                        TranslateMessage( &message );
                        DispatchMessage( &message );
                        if( !mainWindow->Created )
                            break;
                    }
                }

我知道这些结构是什么,但可以让编译器识别它们。我是否缺少参考或者是否有 VC++ 别名'?

干杯。

UPDATE:
I thought it was Windsows.h i need to include and you have confirmed this, but when i do include it i get a bunch of messages like the following...

1>C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\objidl.h(5934) : error C2872: 'IDataObject' : ambiguous symbol
1>        could be 'C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\objidl.h(251) : System::Windows::Forms::IDataObject IDataObject'
1>        or       'c:\windows\microsoft.net\framework\v2.0.50727\system.windows.forms.dll : System::Windows::Forms::IDataObject

I Don't know how to fix this, eik!


I'm trying to call PeekMessage but when I try to compile I get the following errors.

'MSG' : undeclared identifier
'HWND' : undeclared identifier
'PM_REMOVE' : undeclared identifier

my code is as below...

MSG message;
    while(form->Created)
                {
                    while( PeekMessage( &message, (HWND)form->Handle.ToPointer(), 0, 0, PM_REMOVE ) )
                    {
                        TranslateMessage( &message );
                        DispatchMessage( &message );
                        if( !mainWindow->Created )
                            break;
                    }
                }

I know what these structures are but can get the compiler to recognise them. Am i missing a ref or are there VC++ alias' for the same?

Cheers.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

当梦初醒 2024-08-23 11:57:43

您需要包含一个包含这些定义的头文件。来自 http://msdn.microsoft.com/en -us/library/ms644943%28VS.85%29.aspx

在Winuser.h中声明,包括
Windows.h

所以,只需这样做:

#include <Windows.h>

You need to include a header file containing those definitions. From http://msdn.microsoft.com/en-us/library/ms644943%28VS.85%29.aspx :

Declared in Winuser.h, include
Windows.h

So, just do this:

#include <Windows.h>
陌伤ぢ 2024-08-23 11:57:43

当您在 C++/CLI Windows 窗体应用程序中#include windows.h 时,您会遇到一些令人讨厌的符号名称冲突。但这是自我诱导的。在 WF 应用程序中泵送您自己的消息循环合适。它已经有一个,Application::Run()。您无法编写自己的内容,也无法适当地预处理消息以使键盘快捷键等功能正常工作。

在尝试此操作之前,请先完成一些 C++/CLI 编程教程。

You'll get several nasty symbol name collisions when you #include windows.h in a C++/CLI Windows Forms app. But this is self-induced. Pumping your own message loop in a WF app is not appropriate. It already has one, Application::Run(). You can't write your own, you won't be able to preprocess the message appropriately to make stuff like keyboard shortcuts work.

Work through some C++/CLI programming tutorials before you try this.

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