Another newbie question...

  • Thread starter Thread starter Victor
  • Start date Start date
V

Victor

Hi everybody!

I am just trying to switch from C++ 6 to the C++.NET and face an
immediate problem I cannot tackle. Please help!

I created a new VC++ standard SDI project in the Visual Studio .NET
2003. Now I want to have a bitmap on the background of the mainframe
window. So, I added to the MyAppView.h the following :

#include <gdiplus.h>
using namespace Gdiplus;

and to the definition of the class CMyAppView added a new member -
Bitmap* bm.

Now I am going to instantiate this member within the constructor
CMyAppView, creating a bitmap from a file, say "a.bmp".

bm = new Bitmap( ... ? ... ) -- and here is my problem...

I found in the MSDN a Bitmap constructor Bitmap(String* fileName) and
think that will be a proper one in my case.
But what type is that misterious String ? If I declare a local variable
String bmString within the CMyAppView constructor (in
the CMyAppView.cpp), the compiler laments the type 'String' is unknown.
The old good type 'string' (needs for implementation #include <string>
and using namespace std;) is not the one needed by the Bitmap
constructor. When I try to declare System::String, I have even more
problems, because the namespace System does not allegedly exist...

What is wrong ?

Many thanks in advance.
 
Victor said:
#include <gdiplus.h>
using namespace Gdiplus;

and to the definition of the class CMyAppView added a new member -
Bitmap* bm.

Now I am going to instantiate this member within the constructor
CMyAppView, creating a bitmap from a file, say "a.bmp".

bm = new Bitmap( ... ? ... ) -- and here is my problem...

I found in the MSDN a Bitmap constructor Bitmap(String* fileName) and
think that will be a proper one in my case.
But what type is that misterious String ?
What is wrong ?

My guess is that you are looking at the ctor of a Bitmap object from another
technology. The Gdiplus::Bitmap has a ctor that takes a const WCHAR* and an
optional BOOL.
 
Jeff said:
My guess is that you are looking at the ctor of a Bitmap object from another
technology. The Gdiplus::Bitmap has a ctor that takes a const WCHAR* and an
optional BOOL.

Thank you, Jeff!

It seems you are right -

but there is another problem now...

I changed my constructor like this :

bm = new Bitmap(L"a.bmp");

The compiler reports:

error C2660: 'Gdiplus::GdiplusBase::operator new' : function does not
take 3 arguments

The same result appears when I use the following :

WCHAR bmFile[] = L"a.bmp";
bm = new Bitmap(bmFile);

or alternately

bm = new Bitmap(&bmFile[0]);

What is it about ???

Victor
 
Victor said:
but there is another problem now...

I changed my constructor like this :

bm = new Bitmap(L"a.bmp");

The compiler reports:

error C2660: 'Gdiplus::GdiplusBase::operator new' : function does not
take 3 arguments

The same result appears when I use the following :

WCHAR bmFile[] = L"a.bmp";
bm = new Bitmap(bmFile);

or alternately

bm = new Bitmap(&bmFile[0]);

What is it about ???

http://support.microsoft.com/default.aspx?scid=kb;en-us;317799
 
Back
Top