Compile Erros when Adding an icon in C++.NET using <windows.h>

A

agassi

hi guys,
i really need your help!! i want to add a toolbar with some push
buttons in which i put some icons. it works without including
<windows.h>. However, i really need this library so i dont know what
to do. HELP ME. i get this error:

d:\Generic Control\SMACT\Form1.h(473): error C2039: 'GetObjectA' :
n'est pas membre de 'System::Resources::ResourceManager'
and here is the code:

this->imageList1->ImageStream =
(__try_cast<System::Windows::Forms::ImageListStreamer *
(resources->GetObject(S"imageList1.ImageStream")));
Help me!!
 
B

Ben Schwehn

i really need your help!! i want to add a toolbar with some push
buttons in which i put some icons. it works without including
<windows.h>. However, i really need this library so i dont know what
to do. HELP ME. i get this error:

d:\Generic Control\SMACT\Form1.h(473): error C2039: 'GetObjectA' :
n'est pas membre de 'System::Resources::ResourceManager'
and here is the code:

this->imageList1->ImageStream =
(__try_cast<System::Windows::Forms::ImageListStreamer *


Help me!!

this problem is caused by several #defines in windows.h and other header
files like:

#ifdef _UNICODE
#define GetObject GetObjectW
#else
#define GetObject GetObjectA
#endif

so your code gets preprocessed to
resources->GetObjectA instead of
resources->GetObject

solution is to undef the offending define like
#undef GetObject or
#define GetObject GetObject

hth
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top