Groups | Blog | Home
all groups > dotnet windows forms > january 2006 >

dotnet windows forms : #include <windows.h> causes compile error


brian_harris
1/19/2006 10:02:03 AM
I am devloping a simple .net windows form using C++.
without includeing windows.h it compiles and runs, but is not really doing
anything.

when I add the #include <windows.h> then I get various compiler errors
listed below:
c:\T02010_NET_ora9\cgi-bin\programs\ManualKeeper\Form1.h(120): error C2039:
'GetObjectA' : is not a member of 'System::Resources::ResourceManager'

c:\T02010_NET_ora9\cgi-bin\programs\ManualKeeper\Form1.h(203): error C2653:
'MessageBoxA' : is not a class or namespace name

private: System::Void submit_Click(System::Object * sender,
System::EventArgs * e){
MessageBox::Show (S"Accept It worked!", S"Message...");
}


Below is the code that these errors occured on.
this->logo_1->Image = (__try_cast<System::Drawing::Image *
[quoted text, click to view]

Does any one know why this is causing a problem and how can I get around it.
The windows.h is actually in a 3rd party non managed dll that I need to use.
So I
need to use it, unless there is some other equivelent .h for windows.h that
I can include in this 3rd party .h to get around problem. I have used this
3rd party dll in another .net application and it worked fine. That
application was a windows service application.
To recreate problem you don't need 3rd party .dll, all you need to do is add
#include <windows.h> in forms1.h of a simple form and try to compile.

Thanks,
Mattias Sjögren
1/19/2006 9:42:01 PM

[quoted text, click to view]

Because windows.h (indirectly) adds things like

#define MessageBox MessageBoxA

You can try to add

#undef MessageBox

after the #include


Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
AddThis Social Bookmark Button