Click to See Complete Forum and Search --> : Begginer question


joblemar
July 31st, 2003, 05:05 AM
Hello.

I'm a beginner in working with Managed C++ and I have a question.
I have read that it's possible to mix managed and unmanaged code in the same application, and I have been testing this.

I have created a simple Windows Form application and do some little things.
Then I have tryed to use a class that's its written in unmanaged C++ that make some things with CStrings.

After I have compiled this file ( I only added some includes to make it work ) I tried to use some functions of this class in my form file.

So when I added the include to this class, and build the application some error messages appear like this:

" error C2039: 'GetObjectA' : is not a member of 'System::Resources::ResourceManager'
stdafx.cpp(0) : see declaration of 'System::Resources::ResourceManager' "

In the error line the code that the Visual Studio wizard wrote it's this :

"this->imageList1->ImageStream = (__try_cast(resources->GetObject(S"imageList1.ImageStream")));"

As you can see there is not GetObjetA call, instead its GetObject.

Any idea ? Thanks.

evschu
August 28th, 2003, 05:39 PM
hi, i have gotten the same error when i tried to put the ms chart control on my windows form (using VC++ 2003, windows form designer). i think i solved the problem by putting:
#undef GetObject
at the top of my file.

below is a link to the page where i got this solution. hope that helps.

http://www.dotnet247.com/247reference/msgs/28/140741.aspx

indiocolifa
September 16th, 2003, 10:33 AM
I think THERE IS GetObjectA and GetObjectW, each for ANSI and Unicode functions respectively.

I don't know if this works like in the Win32 API. The USER32.DLL, for example, does not have an entry for MessageBox but for MessageBoxA (ANSI) and MEssageBoxW (Unicode). You can still use the MessageBox function which is defined as a macro in WINDOWS.H that parses to the ANSI/Unicode version of the function depending on your program settings.

It's like:


#ifdef _UNICODE
#define MessageBox MessageBoxW
#else
#define MessageBox MessageBoxA
#endif

Hope this helps :)