473,386 Members | 1,832 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,386 software developers and data experts.

Managed Code Pls help me!

Hello!

Could anyone help me please.
I tried the following - I created an application in .NET 2003. The project
is a MFC Application a CDialog. I ran the application fine. I changed the
properties for the app - so I should use Managed Code (Use Managed
Extensions = YES). It still ran fine. I should now be able to add new
things like Windows Forms. Am I right?
You see I tried to add a Windows Form(:NET) item in my app, but when I tried
to add it in my application I receive an error during compile:

error C3828: 'MFC02::Form01': placement arguments not allowed while creating
instances of managed classes

The application is called MFC02 - the WindowsForm is called Form01. Here is
my code to get this error
MFC02::Form01* myform = new MFC02::Form01();

What am I missing?
Is it so that I can't use unmanaged code togheter with managed code? Is my
code unmanaged when I selected that I should use Use Managed Extensions =
YES

Could anyone please help me
Thanks
--
- Lars
Nov 17 '05 #1
2 2174
Hi
MFC02::Form01* myform = new MFC02::Form01();

What am I missing?
Is it so that I can't use unmanaged code togheter with managed code? Is my
code unmanaged when I selected that I should use Use Managed Extensions =
YES


have you added apriopriate references to your project?
did you add reference to mscorlib.dll?

Regards, Robert
Nov 17 '05 #2
The problem is that if you do a debug build of MFC apps, in one of the
windows header files, 'new' is #defined to be something else (DEBUG_NEW
actually, which is itself a macro) (try right-clicking on the new and
selecting go to definition).

You could try something like:

#ifdef new
#undef new
#endif

ManagedClass *pManagedObject = new ManagedClass();

#ifdef _DEBUG
#define new DEBUG_NEW
#endif
Macros are evil, basically.

"Lars Grøtteland" <lars@nospam> wrote in message
news:u%******************@TK2MSFTNGP12.phx.gbl...
Hello!

Could anyone help me please.
I tried the following - I created an application in .NET 2003. The project
is a MFC Application a CDialog. I ran the application fine. I changed the
properties for the app - so I should use Managed Code (Use Managed
Extensions = YES). It still ran fine. I should now be able to add new
things like Windows Forms. Am I right?
You see I tried to add a Windows Form(:NET) item in my app, but when I tried to add it in my application I receive an error during compile:

error C3828: 'MFC02::Form01': placement arguments not allowed while creating instances of managed classes

The application is called MFC02 - the WindowsForm is called Form01. Here is my code to get this error
MFC02::Form01* myform = new MFC02::Form01();

What am I missing?
Is it so that I can't use unmanaged code togheter with managed code? Is my
code unmanaged when I selected that I should use Use Managed Extensions =
YES

Could anyone please help me
Thanks
--
- Lars

Nov 17 '05 #3

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

Similar topics

1
by: lolomgwtf | last post by:
I have a managed C++ method that wraps unmanaged code and creates a managed object holding data retrieved form an unmanged one. I want create an instance of this managed class in C#, pass it to...
16
by: Ekim | last post by:
hello, I'm allocating a byte-Array in C# with byte byteArray = new byte; Now I want to pass this byte-Array to a managed C++-function by reference, so that I'm able to change the content of the...
2
by: lolomgwtf | last post by:
I have a managed C++ method that wraps unmanaged code and creates a managed object holding data retrieved form an unmanged one. I want create an instance of this managed class in C#, pass it to...
2
by: asanford | last post by:
We use StackWalk(StackWalk64) from dbghelp.dll to walk our callstacksas needed, using the various Sym* methods (SymGetSymFromAddr, SymGetLineFromAddr) to resolve source file, function name, and...
4
by: William F. Kinsley | last post by:
My understanding is that when I re-compile a existing MFC application with the /clr switch, that the code generated is managed(with some exceptions) but that the data isn't, i.e. not garbage...
3
by: Steve Marsden | last post by:
Hi I am an experienced C programmer and we have a large app written in C which I have just recompiled with /clr to start to add in managed code to use .NET framework and windows forms bit by...
12
by: doug | last post by:
I understand the basics of what managed code offers and that you open yourself up to security issues if you allow unmanaged code. We already have a decent amount of VB6 code to include COM DLLs. ...
5
by: Maxwell | last post by:
Hello, Newbie question here. I have a VS.NET 2003 MC++ (not C++/cli) project where I have a managed class reference in a unmanaged class...simple enough. To keep things short I am for the most...
25
by: Koliber (js) | last post by:
sorry for my not perfect english i am really f&*ckin angry in this common pattern about dispose: ////////////////////////////////////////////////////////// Public class...
3
by: Klaus | last post by:
Hi, I have an existing VC 6 MFC application which communicates asynchronly with a VC 2005 managed code dll. I use an unmanaged base class with virtual functions to access methods in the MFC...
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
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

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.