views:

98

answers:

2

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.

+2  A: 

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>
Igor Zevaka
+1  A: 

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.

Hans Passant