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

  • Thread starter Thread starter agassi
  • Start date Start date
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!!
 
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
 
Back
Top