473,769 Members | 5,910 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dialogs fail in debug mode

Hi!

This is my first post here, so please excuse me for any mistakes I make.

---------------------

I'm having a hard time displaying modal/non-modal dialog boxes in a Windows
Forms Application project, because of the following problem:

If building a project in debug mode, I get a Debug Assertion when doing a
myDialog.DoModa l() call, seemingly because a valid parent window handle for
the dialog cannot be found.
I've debugged the application, and found that a call to
AfxGetResourceH andle() triggers the assertion.

When building the same project with debugging disabled (in Release mode), no
exceptions are thrown, and the application runs flawlessly.

This is how I use the dialog (which has a class added, and extends from
CDialog):

CMyDialog theDialog;
theDialog.DoMod al();

I've tried this too: CMyDialog theDialog(AfxGe tMainWnd());
, but the error is the same.

(I'm using Visual C++ .NET 2003 Standard)

Any help would GREATLY be appreciated!

Thank you in advance,
-David
Nov 17 '05 #1
7 1412
>This is how I use the dialog (which has a class added, and extends from
CDialog):

CMyDialog theDialog;
theDialog.DoMo dal();

I've tried this too: CMyDialog theDialog(AfxGe tMainWnd());
, but the error is the same.


David,

Where in your application do you invoke the dialog?

From what you say, I'd guess that you're trying to invoke the dialog
before aspects of the application are initialised.

Dave Lowndes
--
MVP VC++ FAQ: http://www.mvps.org/vcfaq
Nov 17 '05 #2
I try to invoke it when pressing a button, like so:
private: System::Void button2_Click(S ystem::Object * sender,
System::EventAr gs * e)

{
CMyDialog theDialog;
theDialog.DoMod al();
}

David,

Where in your application do you invoke the dialog?

From what you say, I'd guess that you're trying to invoke the dialog
before aspects of the application are initialised.

Dave Lowndes
--
MVP VC++ FAQ: http://www.mvps.org/vcfaq


Nov 17 '05 #3
>I try to invoke it when pressing a button, like so:

Have you somehow got a mix of MFC and managed .Net code in your
project - things don't seem consistent in what you've mentioned.

Dave
--
MVP VC++ FAQ: http://www.mvps.org/vcfaq
Nov 17 '05 #4
I'm just trying to show a simple dialog from a managed application - it
can't be that hard! :-)

What's the non-mixed mode of implementing dialog controls, then?

Btw, using an MFC DLL with a dialog resource in it worked correctly; it's
just this application that can't display its own dialog resources...

Have you somehow got a mix of MFC and managed .Net code in your
project - things don't seem consistent in what you've mentioned.

Dave
--
MVP VC++ FAQ: http://www.mvps.org/vcfaq

Nov 17 '05 #5
>I'm just trying to show a simple dialog from a managed application - it
can't be that hard! :-)


Mixing MFC with managed code isn't supported as far as I know until
VS2005 is available. It's not something I've attempted to do anyhow.

Dave
--
MVP VC++ FAQ: http://www.mvps.org/vcfaq
Nov 17 '05 #6
I try to invoke it when pressing a button, like so:
private: System::Void button2_Click(S ystem::Object * sender,
System::EventAr gs * e)

{
CMyDialog theDialog;
theDialog.DoMod al();
}

David,

Where in your application do you invoke the dialog?

From what you say, I'd guess that you're trying to invoke the dialog
before aspects of the application are initialised.

Dave Lowndes
--
MVP VC++ FAQ: http://www.mvps.org/vcfaq

Nov 17 '05 #7
>
David,

Where in your application do you invoke the dialog?

From what you say, I'd guess that you're trying to invoke the dialog
before aspects of the application are initialised.

Dave Lowndes


I try to invoke it when pressing a button, like so:
private: System::Void button2_Click(S ystem::Object * sender,
System::EventAr gs * e)

{
CMyDialog theDialog;
theDialog.DoMod al();
}
Nov 17 '05 #8

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

Similar topics

3
3372
by: Mike C. Fletcher | last post by:
Every few months I get to working on a Python C extension (built with distutils) and discover a pointer error or the like where I'd like to be able to step into my DLL and see where the extension is going wonky. Now, the "proper" way to debug a DLL is apparently to build Python in debug mode (i.e. with the _d form dll), then build each and every extension I depend on (in debug mode), and then build each of my own extensions in debug...
1
3374
by: sebastien maraux | last post by:
Hello NG, I would like to display dialogs such as CDialog and CMenu in fullscreen exclusive mode. I noticed that CMenu always display under openGL drivers (my app is a 3D Renderer window) but seldomly under DirectX 8. Also, even by calling SetForegroundWindow or SetFocus, I don't manage to display a CDialog in foreground of my FS app.
1
2578
by: rayt | last post by:
I’m relatively new to XSLT and must admit I’m finding it refreshing, but every now and again something comes along which floors me. Maybe it’s the old imperative language background that is hard to shake. This is an example of a dark cloud in my brave new declarative world. Clearing duplication is bread and butter but in XSLT it’s not. The old preceding axis method is both too slow and destined to failure. The Muenchian method, although sublime...
12
3422
by: nospam | last post by:
All the documentation says that leaving an ASP.NET application in debug mode has a big performance hit. I can't detect any difference between debug and non-debug modes. Am I missing something or is the documentation wrong? I've been load testing an ASP.NET website (built in VS.NET 2003 in C#). I've used the ACT to generate heavy loads over several minutes. Debug or no debug produces almost identical performance results.
7
2914
by: Srinivasa Rao | last post by:
I have read in one article that when we compile the application in release mode, all the debug classes and properties will be automatically removed from the code. I tried to implement this thing by using the following code in Page_Load event handler. Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim intcount As Integer intcount = 0 For intcount = 0 To 4
3
4036
by: Haldun ALIML | last post by:
Suppose that you have below property in some class, #if DEBUG public string DebugInfo { get { return "INDEX : " + _name + "\n" + "Index Owner : " + _owner.Name + "\n" + "Index Column Count: " + _columns.Count + "\n"; }
6
3665
by: pauldepstein | last post by:
To help me debug, I am writing a lot of information into a stream which I call debug. However, because of the large amount of time taken to print this information, I only want this printed while I am in debugging mode as indicated by a preprocessor directive: #define DEBUG In other words, I need code which says "Whenever I write debug <<
3
14510
by: =?Utf-8?B?Tmljaw==?= | last post by:
Hi all, i have a web application and one of the function is to generate a word document by button click. it works fine in debug mode when i run this web application. But after i deploy to my local IIS server, it always show this error when i click the button which trying to generate a word document. Error msg:
4
2439
by: Ronny | last post by:
I have a mixed solution -most of its projects are in C# and some are in C++?MFC. Problem is that when I compile the solution with batch build the MFC files end up wit compilation errors, but if I compile them personally everything is OK. One more note- the MFC project is independent on any other project. Can some advise please? Regards Ronny
0
9423
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10214
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10048
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9996
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9865
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8872
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5304
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.