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.DoModal() 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
AfxGetResourceHandle() 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.DoModal();

I've tried this too: CMyDialog theDialog(AfxGetMainWnd());
, 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


0
david1294 (6)
1/3/2005 11:14:20 AM
vc.mfc 33608 articles. 0 followers. Follow

1 Replies
463 Views

Similar Articles

[PageSpeed] 39

What kind of application have you written? What have you done to adjust the 
dialog from a default dialog class? Are the resources for your app in a 
seperate dll? Does this happen with a new dialog class or just yours? If 
it's just yours then strip out all the code from your dialog until it 
works. More info required please.

Andy Mortimer [MS]
Please do not send email directly to this alias. This alias is for 
newsgroup purposes only

This posting is provided "AS IS" with no warranties, and confers no rights. 
OR if you wish to include a script sample in your post please add "Use of 
included script samples are subject to the terms specified at 
http://www.microsoft.com/info/cpyright.htm" 

0
andmort (67)
1/5/2005 3:54:11 PM
Reply:

Similar Artilces:

Dialogs
Hi Is there any arguments to I can add to the statement below for the dialogue's "Look in:" to default to a specific folder? Application.Dialogs(xlDialogOpen).Show Thanks. >-----Original Message----- >Hi > >Is there any arguments to I can add to the statement >below for the dialogue's "Look in:" to default to a >specific folder? > >Application.Dialogs(xlDialogOpen).Show > > >Thanks. >. > You can try FileFilter = FileFilter + "Look in: name of directory,," ...

How to Move Two Dialogs at Once
Hello, One of my work's project specifications is to allow users to move two Dialog boxes together so when a user moves one box, the other one moves together with the first. This is what I am trying to do: 1) Create OnMove() event //Import a function to create a Second Dialog extern "C" __declspec(dllimport) long CallDlg(); //Import a function to move a Second Dialog extern "C" __declspec(dllimport) long CallDlg2(int x, int y); void CSvg::OnMove(int x, int y) { //Detect if a user selected two-dialogs move option if (m_attach) { ...

Links in Outlook 2003 open Save As... dialog box
I'm not sure exactly when this started happening. Whenever I click a link in Outlook 2003 now, it opens the Save As... dialog box as well as the Website connected to the link. It doesn't matter what type of link it is; the dialog always shows up with the .exe file type selected. Any ideas? Does it oen the Save As dialog or does it open the Locate Link Browser dialog? In case of the last direct it to iexplore.exe -- Robert Sparnaaij [MVP-Outlook] www.howto-outlook.com Tips of the month: -Backup and Restore -Create an Office XP CD slipstreamed with Service Pack 3 ----- "S...

Windows Installer "Failed to connect to server. Error: 0x800401F0"
I am having a tough problem with a Windows 2003 server. One of the symptoms is that if I reinstall Apache, I get the Windows Installer error "Failed to connect to server. Error: 0x800401F0." This is after installing Windows Installer 4.5. I am constantly repointed to KB 319624, but that article applies only to Windows 2000 Server. Since messing with things such as DCOM permissions is tricky stuff, I am extremely reluctant to make changes on a production server unless I know that it is safe. Does anyone know if a similar article has been written for Windows 2003 or i...

Dialog form Linked To Report
I have created a dialog form, on this form I select the company name from the dropdown list. when a company name is selected, then the report should be generated. presently I have a button on the form when i click on it the macro is set to propt the dialog where i have to type the name of the company, if the company name is wrong the report opens with no values, if the company name is right then I get the report. whereas what i want is insted of button I should have the List Box with company names. Which I have created. But am stuck linking this form with the report Name &q...

Dialog on Dialog?
Hello, Following up from a request several days ago regarding frames, I would like to ask for a little assistance on actually implimenting it! I have creating my 2 dialog templates, both have a class associated with them already. I have added an object of the kind i wish to make child of the main dialog, but I can not figure out how to go from here with rgeards to actually creating it. Could someone give me some indication pleasE? - MR MR, You will now want to investigate creating modeless dialogs. CDialog::Create is the call you use for this. Add a member variable of one of the s...

Operation failed after DST Update OL97
After I ran the daylight savings time update, outlook 97 has been acting up. Everytime outlook is started up I get "operation failed"-- I click okay and then I can go into inbox and send messages fine. Reminders do not come up at the right time or they sometimes don't come up at all when they do I get the same message "operation failed" nothing else. We are running exchange 2000 and OL97 in coporate workgroup mode with Windows 2000 operation system with latest service packs and updates. I have tried the run outlook /cleanreminders switch and /resetfolders switch and...

Modal dialog box question
Hi, I've created a dialog called InfoWindow. Previously I had called it like so: c_InfoWindow = new InfoWindow(); c_InfoWindow->Create(InfoWindow::IDD, this); c_InfoWindow->SetWindowPos(NULL, r, t, w, h, SWP_NOZORDER); c_InfoWindow->ShowWindow(SW_SHOW); Now I want to create it as a Modal dialog, but I can't work out how to set it's size / position at runtime. InfoWindow IW(); // somehow set properties here (SetWindowPos gives runtime error) IW.DoModal(); Hi, Could you try to pass some variables to InfoWindow before calling its DoModal()? For example: MyDlg dlg; ...

How to show icon for a dialog.
Hi, I am adding a simple dialog to my aplication. This dialog is not having any customized code..I want to add my custom icon for that dialog. i mean whenever the dialog is shown it should display 16 X 16 icon in the titlebar.. so, how to do that ? Jigar In OnInitDialog method of your dialog box class load the icon using ::LoadIcon(..) and the call the dialog box's SetIcon(..) method. AliR. "Jigar Mehta" <jigar.programmer@gmail.com> wrote in message news:1141156992.695173.29930@v46g2000cwv.googlegroups.com... > Hi, > > I am adding a simple dialog to my aplic...

Common dialog not registered
When trying to load the common dialog tool I get the message 'not registered' why is this and how do I register? Hi, As the message says that control isn't licensed for use in Excel except 'as I understand' in the Developer edition. I believe this performs a similar function fname = Application.GetOpenfileName(.... Mike "Cash" wrote: > When trying to load the common dialog tool I get the message 'not registered' > why is this and how do I register? ...

Reimport XML fails
Followed the instructions here: http://office.microsoft.com/en-us/excel/HA011019641033.aspx#create_map to import an RSS feed for Craig's List: http://newjersey.craigslist.org/zip/index.rss. It works great the first time, but if I want to update it, nothing happens??? Do I have to save the file each time and start with a fresh empty file with just the mapping? LMK - TIA ed ...

DNS test connect to mail servers failed
I ran a DNS test from dnsreport.com and got a failure on "Connect to mail servers". The message was: ERROR: I could not complete a connection to one or more of your mailservers: mail.itsatx.com: The mailserver terminated the connection before the transaction was complete (state 4). This is not RFC compliant, and therefore either due to an error, or it may be the result of a non-RFC-compliant mailserver or non-RFC-compliant anti-spam program. Does anyone know how to correct this or what properties I need to adjust? Bruce Along the lines of my response to your other post, do yo...

Dynamic creation of owner-drawn button inside a dialog
Hi some months ago I created a owner-drawn button class that works really fine when assigning this class to a resource id via a DDX member variable. But now we want to reuse this class for dynamic creation of a button control inside the OnInitDialog member funtion of a dialog. Creating the control like that MyButton.CreateNULL,NULL,WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON|BS_OWNERDRAW,CRec t(0,0,100,100),this,2); seems to be OK. But the button never appeared inside the dialog. DrawItem of the button class is never called. So what may be missing? Thanks in advance Bernd How have you declared My...

Outlook '02 Network Password Dialog box
Help! I have recently added 1 additional email account to my outlook. Now everytime the email checks for messages I get a dialog box with "Enter Network Password". It comes up in the middle of the screen no matter what I am doing. I have clicked on "Save this password in your password list" box but it continues to come up everytime. Is there a way to get rid of this box? Thank you. Kris ...

how to pass a value to a modeless dialog?
hi all.. i have created a modeless dialog i had no compiler errors. i want it to take a global value (buffer) from the parent dialog and do some processing to it. i tried putting the processing code i need immediately after i create & show the modeless dialog.but it didn`t work.i also tried to override the constructor for modeless dialog & make it take a pointer to the parent dialog as a parameter& reach the buffer i want but it didn`t work also.what`s the problem?? There are a couple of things you can do. First let me ask you. if the data is global why do you have to pass anyth...

MFC Dialog app "Including" another MFC Dialog app problems.
WIN XP, VC6 I'm trying to use a CDialog based app from another CDialog based app and can't get around the following error: bla,bla\..\WagCom\DlgThreadmill.h(27) : error C2065: 'IDD_THREADMILL' : undeclared identifier IDD_THREADMILL is obviosly resource in the "Included" app. I don't know how to make that resource visible to the calling app. I have the Include statement in the calling object : #include "..\WagCom\DlgThreadmill.h" and I know that the path is correct.. Any help appreciated. Thanks Is the ID in the using applications resource.h...

modeless dialog boxes #2
I have a VS 6.0 MFC dialog-based application. The main dialog has an edit box for displaying messages as things happen. A button on the main dialog starts a modeless dialog. The modeless dialog has a 'DoIt' button which executes a long process, updating the main dialog edit box. I'm finding that the main dialog and modeless dialog are unresponsive as long as I'm in the 'OnDoIt' routine. I had thought that a modeless dialog box would essentially run 'independent' of the main dialog but that doesn't seem to be the case. What have I misunderstood? ...

How to hide the dialog in a dialog based application..
Hi, I have a dialog based application which has MFC support.. (developed from class wizard...) Now, according to the my database situation, i want to show / hide the dialog.. so, what should i do ? What i do currently is, inside, oninit i start a thread and pass a dialog pointer.. now, after 500 ms of initialization, i will call ShowWindow(SW_HIDE) to hide the dialog.. and to work in invisible mode.. but this is not a good way.. so, any other way to hide the dialog before it gets shown.. ?? My exe should run in processes but it should not show the dialog only.. Hope you understand my...

Dialog::OnOK....
I want my dialog box to show a messagebox when I click "ok". With certain conditions I want my dialog box to return to it's original state and not close which nomally happens after clicking "ok" Is there an easy way to do this or do I need to create a command button? Thanks, RABMissouri Override the virtual function OnOK. If you don't call CDialog::OnOK then the dialog box does not close. void CMyDlg::OnOK() { if (MessageBox("Are you sure?","Exit",ID_YESNO) == IDYES) { CDialog::OnOK(); } } You can do the same thi...

Operation failed. An object could not be found
I am presently using outlook express only because my outlook stopped working. Express works fine, but in Outlook, everytime I try to send any type of email I get the error message: "The operation failed. An object could not be found." It is Outlook 2002, w/SP-2 installed I've tried reinstalling the program but with no effect. Any ideas? Can you give more information on the actual error? What object? -- Nikki Peterson [MVP - Outlook] "Bill Thaden" <wathaden@writeme.com> wrote in message news:8f6001c34599$0f976a00$a401280a@phx.gbl... I am presently using o...

Howto: Place icon in a Wizard dialog?
Being new to MFC, I was happy to read how the SetWizardMode() call of a CPropertySheet could reprecent a Wizard dialog automatically. I have one major problem with this build-in shortcut for creating wizards and that has to do with the icon - or lack there of - in the application. Apparently CPropertySheet is a specialization of CDialog WITHOUT the possebility of setting style for including an icon in the caption area. I tried: <CPropertySheet>.SetIcon(LoadIcon(IDR_MAINFRAME),FALSE); And many other things but neither yields an icon. I am quessing it is simply impossible to have...

Is there a way to unload the loaded XLL file in Excel? Hi all, I am debugging XLL link library using Visual C++. Everytime I rebuild the XLL, I have to close the whole Excel program and relaunch t
Is there a way to unload the loaded XLL file in Excel? Hi all, I am debugging XLL link library using Visual C++. Everytime I rebuild the XLL, I have to close the whole Excel program and relaunch the Excel program again, and then load in the newly generated XLL library again... This is tedious... I am looking for a way to unload XLL (already loaded) from within EXCEL program... Any thoughts? (I find just close the currently active worksheet doesn't get the XLL unloaded...) ...

How to display a dialog as part of a dialog
Hello, i have two dialog-resources in my project IDD_DIALOG1 and IDD_DIALOG2 and i want to be the second a "real" part of my first one. I don't want to show it modal or modeless, the user should not recognize that this are two dialogs. How can i do this or where can i get a simple example? Thx. This must be the third time we have had this question in the past week. The short answer to your question is : Declare the second dialog in your dialog editor as a Child not a popup. And then in the OnInitDialog of the first dialog create the second dialog like you would a modless (...

File name list in the open dialog box.
In the open dialog box, how to delete the list of files appearing in the file name drag down menu in excel 2007? Not sure where you are finding this list. Do you mean the Recent Documents you see when you click on the Button? You can clear that by setting your MRU list to 0 under Button>Excel Options>Advanced>Display. If you mean the list you see when you go to Button>Open then you will have to set a new default file path to a folder that is empty. Gord Dibben MS Excel MVP On Thu, 4 Mar 2010 09:10:01 -0800, Acs <Acs@discussions.microsoft.com> wrote: ...

Handling mouse messages for a ListBox in a dialog created in the editor
I created a dialog in MSVC resource editor and placed a listbox in there for which I need to handle certain mouse messages (WM_LBUTTONDOWN) to get the cursor position when the button was clicked. I can't solve this by inheriting my own class from CListBox because the dialog is created in the resource editor? TIA. Sure you can; I do it all the time. Twice, this morning. Just create your subclass, and the use the classWizard to create a control member variable. Done. Take a look at my essay on Avoiding GetDlgItem for more details. joe On Thu, 06 Nov 2003 17:20:21 GMT, Daar <user@is...