473,386 Members | 1,621 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.

problem using MFC in clr

ma
Hello;

I want to use some classes that I wrote (MFC based) in my .net
application. I did the following steps to achieve this:

1- I create a winform application. (The program compile and run
successfully).

2- I changed project setting as documented by MS:
(http://msdn2.microsoft.com/en-us/library/ms235211.aspx ) (The program
compile and run successfully).

3- I add the following line to stdafx.h

#include <afxwin.h> // MFC core and standard components

At this point, the program compiles but when I am trying to run it, I am
getting a heap error. The error message is assertion failed at line 1414 in
file dbgheap.c

What is the problem and how can I solve it?

Best regards



Mar 21 '06 #1
6 2000
Hi ma,
"ma" <ma@nowhere.com> wrote in message
news:uJ****************@TK2MSFTNGP12.phx.gbl...
Hello;

I want to use some classes that I wrote (MFC based) in my .net
application. I did the following steps to achieve this:

1- I create a winform application. (The program compile and run
successfully).

2- I changed project setting as documented by MS:
(http://msdn2.microsoft.com/en-us/library/ms235211.aspx ) (The program
compile and run successfully).

3- I add the following line to stdafx.h

#include <afxwin.h> // MFC core and standard components

At this point, the program compiles but when I am trying to run it, I am
getting a heap error. The error message is assertion failed at line 1414
in file dbgheap.c

What is the problem and how can I solve it?

Best regards


I had similar problems in the beta phases of VC2005. My feeling was that
these problems were solved with the VC release, but I can reproduce the bug,
so it seems isn't.

From what I can see so far, this might be a bug in the CRT initialization
code. It seems that DLL and EXE initialization is confused for some reason I
don't know yet.

I try to find out something more about it and let you know.

Marcus Heege
Mar 23 '06 #2
Hi ma!
I want to use some classes that I wrote (MFC based) in my .net
application. I did the following steps to achieve this:

1- I create a winform application. (The program compile and run
successfully).

2- I changed project setting as documented by MS:
(http://msdn2.microsoft.com/en-us/library/ms235211.aspx ) (The program
compile and run successfully).

3- I add the following line to stdafx.h

#include <afxwin.h> // MFC core and standard components


You should report this bug at
http://lab.msdn.microsoft.com/productfeedback/

And post the link to your bug-report here, so we can vote for it!

Greetings
Jochen
Mar 24 '06 #3
ma
Hello,
I report it and this is the link:
http://lab.msdn.microsoft.com/Produc...ckId=FDBK47757

the title is:
usning MFC in winform application generate heap error

Best regards
"Jochen Kalmbach [MVP]" <no********************@holzma.de> wrote in message
news:es*************@TK2MSFTNGP12.phx.gbl...
Hi ma!
I want to use some classes that I wrote (MFC based) in my .net
application. I did the following steps to achieve this:

1- I create a winform application. (The program compile and run
successfully).

2- I changed project setting as documented by MS:
(http://msdn2.microsoft.com/en-us/library/ms235211.aspx ) (The program
compile and run successfully).

3- I add the following line to stdafx.h

#include <afxwin.h> // MFC core and standard components


You should report this bug at
http://lab.msdn.microsoft.com/productfeedback/

And post the link to your bug-report here, so we can vote for it!

Greetings
Jochen

Mar 24 '06 #4
Hi ma!
I report it and this is the link:
http://lab.msdn.microsoft.com/Produc...ckId=FDBK47757


Validated and voted...

Also changed the title to include a "_CrtIsValidHeapPointer"; so it can
be easier found by others...

Thanks!

Greetings
Jochen
Mar 24 '06 #5
Hi ma!
I report it and this is the link:
http://lab.msdn.microsoft.com/Produc...ckId=FDBK47757


It seems that this bug should have been fixed in the RTM...
See also:

atlstr.h and /clr
http://lab.msdn.microsoft.com/produc...e-e0a40ba72821

An error arises at launching if an ATL header is included in the Managed
C++/CLI application project.
http://lab.msdn.microsoft.com/produc...b-739aae0855a5

Greetings
Jochen
Mar 24 '06 #6
Hi ma!
I report it and this is the link:
http://lab.msdn.microsoft.com/Produc...ckId=FDBK47757


There is a work-around for this problem:

1. Change the "entry point" in you linker settings from "main" to
"wWinMainCRTStartup"
2. Add "#include <afxwin.h>" to your "stdafx.h"
3. Replace your "main" method with the following:
class CMFCApp : public CWinApp
{
public:
virtual BOOL InitInstance()
{
// Enabling Windows XP visual effects before any controls are created
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(fal se);
// Create the main window and run it
Application::Run(gcnew Form1());
return FALSE;
}
} theApp;

See also: FDBK47757#1: Replace "main" with CWinApp
http://lab.msdn.microsoft.com/Produc...ID=FDBK47757#1

--
Greetings
Jochen

My blog about Win32 and .NET
http://blog.kalmbachnet.de/
Mar 24 '06 #7

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

Similar topics

7
by: Aaron Prohaska | last post by:
I have just run into a problem where I have a page that posts back to itself to execute code, except when the page does the post back it somehow executes code that is in our home page for the site....
9
by: Rajat Tandon | last post by:
Hello there, I am relatively new to the newsgroups and C#. I have never been disappointed with the groups and always got the prompt replies to my queries.This is yet another strange issue, I am...
5
by: IkBenHet | last post by:
Hello, I use this script to upload image files to a folder on a IIS6 server: ******************* START UPLOAD.ASPX FILE ********************** <%@ Page Language="VB" Debug="true" %>
8
by: Sarah | last post by:
I need to access some data on a server. I can access it directly using UNC (i.e. \\ComputerName\ShareName\Path\FileName) or using a mapped network drive resource (S:\Path\FileName). Here is my...
16
by: Dany | last post by:
Our web service was working fine until we installed .net Framework 1.1 service pack 1. Uninstalling SP1 is not an option because our largest customer says service packs marked as "critical" by...
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: 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: 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
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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.