473,383 Members | 1,963 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Compiler error from setting icon

TGF
Hello,

When I attempt to set the icon property on a Windows form (.NET), when I
go to compile, I get the following error....

e:\Projects\MyApp\AboutForm.h(108): error C2039: 'GetObjectA' : is not a
member of 'System::Resources::ResourceManager'

....Does anyone know why this happens, and the way to correct it....I looked
up the function member "GetObject", and it is a valid member function. Note
that this error occurs in the InitializeComponent() function where the VS
code generator says not to edit it. So what gives?

--
TGF
Jul 21 '05 #1
3 1397
...Does anyone know why this happens,
Because GetObject is #defined to GetObjectA in WinGDI.h, so the
preprocessor replaces your call to ResourceManager::GetObject with
ResourceManager::GetObjectA.
and the way to correct it....


You can #undef the GetObject macro, or if possible avoid to #include
Windows.h altogether.

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/
Please reply only to the newsgroup.
Jul 21 '05 #2
TGF
Mattias,

In the header file where the problem occurs, I have no <windows.h>
included, or any other header file for that matter. I do however, have the
following namespaces included...

using namespace System;
using namespace System::Threading;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
using namespace System::IO;
using namespace System::Resources;
using namespace Microsoft::Win32;
using namespace System::Collections::Specialized;

-TGF
"Mattias Sjögren" <ma********************@mvps.org> wrote in message
news:uw**************@TK2MSFTNGP12.phx.gbl...
...Does anyone know why this happens,


Because GetObject is #defined to GetObjectA in WinGDI.h, so the
preprocessor replaces your call to ResourceManager::GetObject with
ResourceManager::GetObjectA.
and the way to correct it....


You can #undef the GetObject macro, or if possible avoid to #include
Windows.h altogether.

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/
Please reply only to the newsgroup.

Jul 21 '05 #3
In the header file where the problem occurs, I have no <windows.h>
included,
Perhaps your header file is included in some other source file where
windows.h is used?

or any other header file for that matter.


Well, the GetObject macro must be defined somehow. You can always try
to just #undef GetObject before the call to
ResourceManager::GetObject.

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/
Please reply only to the newsgroup.
Jul 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Grant Edwards | last post by:
I'm trying in vain to set the icon for the executable generated by py2exe. According to various sources there are two answers: 1) Do it on the command line: python setup.py py2exe --icon...
0
by: TGF | last post by:
Hello, When I attempt to set the icon property on a Windows form (.NET), when I go to compile, I get the following error.... e:\Projects\MyApp\AboutForm.h(108): error C2039: 'GetObjectA' : is...
7
by: Kathryn Townsend | last post by:
We have a customer using our Acc97 Runtime application on a Win 98 machine that was recently upgraded to WinXP Home Edition Service Pack 1. Shes states RAM is 228, CPU Pentium II 398 MHz , Hard...
0
by: Steve Le Monnier | last post by:
(Using Visual Studio 2003 v7.1.3088, Framework 1.1 v1.1.4322) When you hover over the error provider icon the error message is displayed okay, but if you move the mouse away and then back over...
3
by: TGF | last post by:
Hello, When I attempt to set the icon property on a Windows form (.NET), when I go to compile, I get the following error.... e:\Projects\MyApp\AboutForm.h(108): error C2039: 'GetObjectA' : is...
1
by: Lucvdv | last post by:
In an app that was working, all I did was specify an icon for the main form (through the form designer) and recompile it. Result: MissingManifestResourceException After digging around, I found...
3
by: TGF | last post by:
Hello, When I attempt to set the icon property on a Windows form (.NET), when I go to compile, I get the following error.... e:\Projects\MyApp\AboutForm.h(108): error C2039: 'GetObjectA' : is...
4
by: Gary | last post by:
Hi, I get this error " " when my web page run, what does it mean? Hope someone can help!!! Gary
5
by: DosR | last post by:
By setting a custom icon for a mdb and setting it also to be shown in any form it is successfully used in the taksbar when I open the database and one or two single forms. However, as soon as I...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.