Trouble with CDialog DoModal()

I created a new dialog with two buttons and a richedit area. I used the
wizard to create a new class and the code.

Now, I got:

// CStatDialog dialog

CStatDialog::CStatDialog(CWnd* pParent /*=NULL*/)
	: CDialog(CStatDialog::IDD, pParent)
	m_StatisticText = _T("");

void CStatDialog::DoDataExchange(CDataExchange* pDX)
	DDX_Text(pDX, IDC_RICHEDIT1, m_StatisticText);


// CStatDialog message handlers

void CStatDialog::OnRefreshStatistics()
	// TODO: Add your control notification handler code here


void CStatDialog::OnResetStatistics()
	// TODO: Add your control notification handler code here


BOOL CStatDialog::OnInitDialog()

	// TODO: Add extra initialization here

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE

I try to open the dialog window with:

	CStatDialog Statdialog;
	int ret = Statdialog.DoModal();

Problem is: The dialog box is never opened. I always get a ret = -1 and
that's it. Never even goes into OnInitDialog() and I have no idea what
could be the cause of that and how to resolve it. Can somebody give me
some pointers?

Heldron (2)
12/8/2006 3:01:26 PM
vc.mfc 33608 articles. 0 followers. Follow

3 Replies

Similar Articles

[PageSpeed] 29

Chris Kuehn wrote:

> I created a new dialog with two buttons and a richedit area. I used the
> wizard to create a new class and the code.
> Problem is: The dialog box is never opened. I always get a ret = -1 and
> that's it. Never even goes into OnInitDialog() and I have no idea what
> could be the cause of that and how to resolve it. Can somebody give me
> some pointers?

Because of the richedit: See InitCommonControls and InitCommonControlsEx.

Scott McPhillips [VC++ MVP]

12/8/2006 3:10:14 PM
Scott McPhillips [MVP] schrieb:

> Because of the richedit: See InitCommonControls and InitCommonControlsEx.
> -- 
> Scott McPhillips [VC++ MVP]

Where would I put that?


Heldron (2)
12/8/2006 3:25:55 PM

"Chris Kuehn" <> wrote in message
> Scott McPhillips [MVP] schrieb:
> > Because of the richedit: See InitCommonControls and
> >
> > -- 
> > Scott McPhillips [VC++ MVP]
> Where would I put that?

One place would be to in your app's InitInstance (beginning of this method).
Ajay Kalra [MVP - VC++]

ajaykalra (6840)
12/8/2006 3:37:06 PM

Similar Artilces:

Email trouble with New User in Active Directory
Below is a trail of posts that have been made. My problem has yet to resolved and I need some help quickly. The only other thing I can think of is to reinstall Exchange Server 2003. Hopefully someone will know the answer. Thanks! Subject: Re: Email not Setup when new user created in Active Directory From: "Bryan Hill" <> Sent: 8/15/2004 12:30:21 PM We have other clients that are working fine. Just when we try to set up new ones - it will create the SMTP address but not the X400 address. I tried manually forcing the X400 but it will...

Trouble with the template.
I want to reset the 'normal' template to default to "Times New Roman" 10point font, and the pages numbered centre top. This seems to work when I set and reopen Word2003 from the Administrator Template vis: C:\Documents and Settings\Administrator\Application Data\Microsoft\Templates. But it will not work when I open Word2003 normally from the desktop. I have deleted the "" from the following and copied in the "" from the Administrator above: C:\Documents and Settings\All Users\Application Data\Microsoft\Templates...

trouble with CrmIsapi.dll
I was experiencing the same problem with the SDK as many have posted to this group ... "the WhoAmI() call results in a http error 405 when running sample code" I followed some of the advice; checked my .srf mapping to CrmIsapi.dll and re-registered the CrmIsapi.dll. when I re-register CrmIsapi.dll I get an error 80004005 - unspecified. ??? I copied it to various places and retried it ... same result. I got the original from the disk and retried ... same result. unmapped it from .srf, restarted and retried to register it ... same result. Anyone experienced this. What's up with m...

unexpected conversion trouble
I wanted to open an Excel file I hadn't been working on for a while, an Excel couldn't do it. After some investigations, I found that even if the file still had th .xls extension, it seemed to be conveted in .doc format (in fact, whe I open it in notepad, I can see at the end some words that look like MSWord signature). I don't know how this happened, but I'm reall embarassed beacause i really need the data in this file. I tried to change the extension to .doc, open the file in Word and the import in Excel, but I can hardly see part of the file. What's more, i is a 3-she...

Trouble with Outlook 2003 and PST File
Hi, We have a user who is using Outlook 2003 and moves most emails to a PST file which is considered archived email data. They have reached the Max limited on this PST file of 1.99GBs and its not letting them open the PST file. It is trying to repair it when they try to open the PST file. Here is the message they receive: "Can't move the items. The file <path>\<filename>.pst has reached its maximum size. To reduce the amount of data in this file, select some items that you no longer need, and then permanently delete them." I can't even get it open to delete...

Trouble with Pivot Tables & Named Ranges
Can I use a dynamic named range setup in one file as a range in pivot tables in another file? When I have the data source file (with the named range) and the pivot report files open, the pivot reports update just fine. But the moment I close the source data, the pivot reports no longer can update and I get a message that the source can't be found. If I reopen the source, the pivot tables work fine again - but as soon as I close it up, the reports no longer work. The source file is very large and I don't want to open it every time I have to update all the reports tha...

I am in trouble
Hi, I am a student in Cambodia.I don't have any girlfriend. I tried everything. I looked at them wrote poem to them it doesnt work. I got an account from facebook, hi5 friendster myspace. I have 0 girl friend. What should I do? I am so desperate. I am good looking and 250 kg only. Please help me or at least send me some foood I am hungry Best Regards Hungry Guy __________ Information from ESET NOD32 Antivirus, version of virus signature database 4944 (20100314) __________ The message was checked by ESET NOD32 Antivirus. You're tr...

Back to CDialog from child window ?
Hi, I created a dialog app and derived a class from CEdit and made it a member (child?) of CDialog named CClientDlg In the derived class in override OnChar(). From the OnChar() i want to call a method of the dialog. How do i do this ? How do you get from a child window to the parent window. I have tried something like : ((CClientDlg*)GetParent())->Test() The method shows up in the codecompletion window, but the CClientDlg is not known. Till now i always used messaging to get back to the main window. (!?) RAN wrote: > Hi, > > I created a dialog app and derived a class from...

Trouble sorting a table???
Using Excel 2002) I am relatively new to Excel and can only really perform simple functions in a basic spreadsheet. The spreadsheet I'm having trouble with is pretty basic, but I'm having trouble sorting some of the results from a table. (I'll try and explain as best as I can) I have 10 people that I'm tracking 5 different things for (dates, debts, credits, items, number of transactions, and their balance as calculated in this table by simple SUM functions) I then have another table with these same 10 people with their total balance. This is the table I'm having t...

I have been using my MS Publisher 2000 for over 3 years. Just recently I attempted to access the Publisher program and got the following message: "This application must be installed to run. Please run setup fom the location where you originally installed the application." I have done everything I know to fix this including uninstalling and reinstalling the program. I don't understand what happened overnight nor do I understand the instruction "run from the location you originally installed the program". I can not access the numerous publicaions that I have cr...

Trouble with "time" in formulas
I have a time sheet that looks something like this: A1=time...A2=time...A3=A2-A1+if(A1/24,1)...A4=if(or(A3<time(0,15,0),A3>time(4,0,0)),A3,time(4,0,0)) A1 and A2 are set up as dropdown lists and the times in the list are i increments of 15 minutes. WHat I'm trying to accomplish is (in cell A4 if A3 is between 15 minutes and 4 hours, then return 4 hours. if A3 i 0 or greater than 4 hours, return A3. If I enter enter times in A1 around 00:00 and A2 a little after 00:0 it works fine... example: A1=22:00...A2=01:00...A3=03:00...A4=04:00 A1=20:30...A2=00:15...A3=03:45...A4=04:00 A1=00...

Having trouble
I have a set of numbers, a-e. A usually equals e but can be less. B remains constant. C is the sum of A and B. C cannot exceed D. D remains constant I have tried the following formula in the box for A, but C ends up being less than D when I want it to equal D =IF(C>D,E-(C-D)) What am I doing wrong? Uhh, I'm a little slow, but; If you are putting this formula in A and it's the same "A" that is part of the "C=Sum A & B" then I think you have a circular reference. In other words, you're asking xl to resolve "A" by asking "If C> D&quo...

Print Preview troubles
When I do print preview, the information in the scratch area gets overlaid on the document, and there are text boxes where there are none in the work area. In the work area mode, the docs look correct and the stuff I have in the scratch area is OK. It is a scrambled mess. I have used "bring to front" and its' mates-no help. Using Publisher 2002 to create a 8 page booklet on 11x17 stock. I may add: this document had been working but something happened to it, most likely my fault, but I do not know what. Thanks, Jim This was a bug in 2002. Drag the objects to the top or bottom in ...

Trouble with a domain with a
I'm trying to send email to the domain PCM-LWV.COM and I keep getting this NDR: The message could not be delivered because the recipient's destination email system is unknown or invalid. Please check the address and try again, or contact your system administrator to verify connectivity to the email system of the recipient. < #5.1.2> Everything seems fine with our exchange 2003 server otherwise. We are receiving email from this domain, and when we reply we get this NDR. We can send email to any other domain.. is it the - in the domain name?? I tes...

CDHTLMDialog troubles
Hi I'm justing to use the CDHTMLDialog with the following code IHTMLElement* pLinkElement = NULL; if (GetElement(_T("ctl00_ContentPlaceHolder1_tb1"), &pLinkElement) == S_OK && pLinkElement != NULL) { BSTR current; pLinkElement->get_innerText(&current); pLinkElement->get_id(&current); CString tt=_T("Hello from Callidus DHTML"); BSTR bstr=tt.AllocSysString(); pLinkElement->put_innerText(bstr); pLinkElement->Release(); // Thanks Heath } Sorry I posted too soon :) ----------------------------------------- I'm just ...

Having trouble connecting to Hotmail?
Add your comments here! Maybe someone at MS will see them and actually DO something. ____________________ Outlook 2007 on Vista Ultimate 32 bit........ I have a paid hotmail account that I have been happily using for 2 years now. I always check it via outlook (2003 and 2007). In 2007, for about the past 45 days, I would get intermittent dialog boxes asking me to confirm my password. I would, and I would select remember this password and things would continue - until about 3 days ago. Then the dialog boxes would not go away in Outlook 2007. It constantly asked me for my password and wo...

Trouble with manifest...
Hello, I want create a MFC application that uses XP styles. When I use the application wizard in VS 2003 and tick the manifest option, it creates an application with a manifest file. The manifest file looks like the ones you can find in exampels and is named "ApplicationName.manifest", located in the "res" directory. "InitCommonControls();" is called in "InitInstance()". So everything looks alright to me, but I build the application and run it on XP it does not have the files. What I am duing wrong here? Regards, Thomas >I want create a MFC a...

Sudden trouble with Entourage and Word for Mac
Hope somebody can help -- here part of my Chat session with Apple Support to explain the situation. Last night, I downloaded the software update that came through on the automatic alert -- I think it was the latest OS X upgrades. At that time I did not restart the computer as I normally do, because I was working on other things. I simply chose the Shut Down option when I was done. This morning I started up again and since I did, I cannot get any of my MS Office for Mac apps to work properly. Since the only thing that changed was that the update was downloaded and must have been installed when...

Trouble sending word document to PC
Version: 2008 Operating System: Mac OS X 10.4 (Tiger) Processor: Intel I am trying to send word documents to a PC and it opens as a zip drive for the PC and is unreadable. I am using Microsoft word for mac and saving the file as a: Word Document (.docx). What can I do to make the file compatible? The problem is the system and/or the user at the other end. It could be either of several things but without knowing what their software version is or how it's being delivered it's hard to say exactly what they're doing wrong. The OXML (.docx) file is basically a zipped form...

Pasting a chart from Excel 2007 to Word 2007 trouble
This seems like it should be simple!! Why is half of my pie chart disappearing when I try to paste it from excel to word? I have no idea of what is going on. Any ideas? Thanks! Vegas - For me, the best way to paste a chart from Excel 2007 into Word is to select the chart, choose Home | Paste | As Picture | Copy as Picture | etc., select an insertion point in Word, and Edit | Paste. Try the various Copy as Picture options to see which works best for you. - Mike "Vegas" <> wrote in message news:C13CFD60-DAA...

trouble accessing written document
trouble accessing written document saved in file that can not access Is this a cryptic crossword clue? Pleaae explain exactly what you are trying to do in which Word version and what happens when you try. -- <>>< ><<> ><<> <>>< ><<> <>>< <>><<> Graham Mayor - Word MVP My web site Word MVP web site <>>< ><<> ><<> <>>< ><<> <>>< <>><<> "terrell" <ter...

trouble downloading quotes
Is anyone else having trouble downloading quotes today (1/5/04)? In, quest wrote: >Is anyone else having trouble downloading quotes today (1/5/04)? > Yes. Try at a less busy time. Thank-you for your reponse. I did try between 1am - 3am and still saw the same problems. I wonder if it is something specific to me? Thanks again!! "Cal Learner-- MVP" <via_newsgroup@please.tnx> wrote in message > In, quest wrote: > > >Is anyone else having trouble downloading...

IMF Trouble
I'm running a SBS 2003 sp1 W/ Exchange 2003 sp2 / IMF / update IMF has not created the ucearchive folder, and is not filtering UCE. I keep finding the following entry in my event log. Event Type: Error Event Source: MSExchangeTransport Event Category: SMTP Protocol Event ID: 7514 Date: 1/24/2006 Time: 6:14:27 PM User: N/A Computer: BLUESKY Description: An error occurred while loading Microsoft Exchange Intelligent Message Filter. The error code is 0x80070570. For more information, click 99% you installed IMFv1 on top of SP2 http://w...

Syncing troubles
I am not able to sync purchased i tunes songs to device via Media player 11. I am getting an error message every time. Ripped CD's are syncing perfectly OK. On Tue, 13 Apr 2010 22:03:01 -0700, Learner <> wrote: >I am not able to sync purchased i tunes songs to device via Media player 11. >I am getting an error message every time. >Ripped CD's are syncing perfectly OK. I'd be surprised if media player can play them at all ! Apple iTunes stores are protected by FairPlay DRM, which has only one way of playback and Sync...

Trouble linking Windows Mail & AOL
I am trying to send a msg on Craig's List... when I reply to a vendor, I receive a prompt to utilize Windows Mail automatically. When I tried to set up an account on Windows Mail using an AOL address thru IMAP, I got the error below. I have "My server reqrs authentication" checked in properties and I am using "587" as my outgoing smtp port and "143" as incoming imap port. I can see my AOL folders on the Windows Mail box and I can send and receive w/ aol, but when I try to send via WM, the msg sits in the Outbox. Error msg: "XAOL-UAS-M...