I want to open a dialog box with a button

I have created a MFC dialog application with a dialog box and i want to
know how I do to open a second dialog box when I push in the button1 in
the first dialog box!

Thank you for you help

0
john.ambou (29)
4/12/2006 1:36:31 PM
vc.mfc 33608 articles. 0 followers. Follow

14 Replies
564 Views

Similar Articles

[PageSpeed] 0

<john.ambou@free.fr> wrote in message 
news:1144848991.828933.186840@v46g2000cwv.googlegroups.com...
>
> I have created a MFC dialog application with a dialog box and i want to
> know how I do to open a second dialog box when I push in the button1 in
> the first dialog box!
>

Do you mean something like calling DoModal in the BN_CLICKED handler, or 
something different?
-- 
Jeff Partch [VC++ MVP]


0
jeffp (1711)
4/12/2006 1:40:23 PM
You have to handle button click in first dialog. In the handler, you
can create another dialog:

CFristDialog::OnButtonClick(..)
{
  CSecondDialog dlg;
  dlg.DoModal();   // creates 2nd dialog as modal.

}

---
Ajay

0
ajaykalra (6842)
4/12/2006 1:43:59 PM
I don't know what is a "DoModal" can I explain me please ?
In my application, I have a dialog box with one button and i create a
new dialog box.
I want to open the second dialog box when I push the button in the
first dialog box.

0
john.ambou (29)
4/12/2006 2:15:28 PM
In addition to Ajay & Jeff's responses.  If you want to pop up a modeless 
dialog you could do the same thing from button click handler:

http://www.codeproject.com/dialog/gettingmodeless.asp

Tom

<john.ambou@free.fr> wrote in message 
news:1144848991.828933.186840@v46g2000cwv.googlegroups.com...
>
> I have created a MFC dialog application with a dialog box and i want to
> know how I do to open a second dialog box when I push in the button1 in
> the first dialog box!
>
> Thank you for you help
> 


0
tserface (3861)
4/12/2006 2:19:04 PM
DoModal shows  the dialog box as modal. Stepping back, you said you
already have a dialog box that is displayed. Showing another dialog box
is no different. Number of dialog boxes do not matter.

---
Ajay

0
ajaykalra (6842)
4/12/2006 2:25:20 PM
Yeah, just put an AfxMessageBox() in a loop sometime  :o)

Tom

"Ajay Kalra" <ajaykalra@yahoo.com> wrote in message 
news:1144851920.497509.323020@i40g2000cwc.googlegroups.com...
> DoModal shows  the dialog box as modal. Stepping back, you said you
> already have a dialog box that is displayed. Showing another dialog box
> is no different. Number of dialog boxes do not matter.
>
> ---
> Ajay
> 


0
tserface (3861)
4/12/2006 2:27:46 PM
I use AfxMessageBox() but I want to customise my new dialog box with a
bitmap and other things.
Can I create a new ressource (a seconde dialog box). Customise this
dialog box and after add a button in the first dialog box who allows to
open my customize seconde dialog box ?

0
john.ambou (29)
4/12/2006 2:42:54 PM
>  Can I create a new ressource (a seconde dialog box). Customise this
> dialog box and after add a button in the first dialog box who allows to
> open my customize seconde dialog box ?

Yes. I assume you were doing something like this and had a problem
doing it. You havent answered the question about how you launched the
first dialog?

---
Ajay

0
ajaykalra (6842)
4/12/2006 2:52:33 PM
I used a MFC AppWiazard (exe)

0
john.ambou (29)
4/12/2006 2:59:46 PM
john.ambou@free.fr wrote:

> I used a MFC AppWiazard (exe)
> 

john:

Then look at the code in your InitInstance() method.

David Wilkinson
0
no-reply8010 (1791)
4/12/2006 3:08:15 PM
> I used a MFC AppWiazard (exe)

Since its a dialog based application,  you will notice that the main
dialog is launched usign DoModal. Go to InitInstance of your app object
and search for DoModal. This is how you can launch a dialog.

Your questions are very basic and you will learn much more in a shorter
time span if you go thru some tutorial or some MFC book (I recommend
Jeff Prosise's MFC book). Look at codeguru and codeproject for tons of
samples in MFC.

---
Ajay

0
ajaykalra (6842)
4/12/2006 3:08:33 PM
Thank you very much for you help

0
john.ambou (29)
4/12/2006 3:25:08 PM
Sure.  I pop up a second or third dialog box from a first lots of times.

Tom

<john.ambou@free.fr> wrote in message 
news:1144852974.342076.268770@e56g2000cwe.googlegroups.com...
>I use AfxMessageBox() but I want to customise my new dialog box with a
> bitmap and other things.
> Can I create a new ressource (a seconde dialog box). Customise this
> dialog box and after add a button in the first dialog box who allows to
> open my customize seconde dialog box ?
> 


0
tserface (3861)
4/12/2006 3:42:52 PM
This article might help you some:
http://www.codersource.net/mfc_tutorial_Part5.html

Tom

<john.ambou@free.fr> wrote in message 
news:1144855508.288732.54670@v46g2000cwv.googlegroups.com...
> Thank you very much for you help
> 


0
tserface (3861)
4/12/2006 3:44:01 PM
Reply:

Similar Artilces:

Adding a Name Box in a Chart or Footer
I have created a name box in Excel named CurrMonth and I want to add this to a chart or footer. Any ideas? You mean a text box? Select and copy it, select the chart, and paste. - Jon ------- Jon Peltier, Microsoft Excel MVP Peltier Technical Services Tutorials and Custom Solutions http://PeltierTech.com/ _______ Carmax wrote: > I have created a name box in Excel named CurrMonth and I want to add this to > a chart or footer. Any ideas? Thanks Jon but its not a text box. I created a NAME BOX which is like a field in Excel. Many of my formulas in the worksheet are based on thi...

Can't open or delete a spam message
I have a user that received an email that can't be opened or deleted. He gets a message that says outlook could not delete this message either there was an error or you don't have rights. This is the only email that is doing this. I have tried repairing outlook. Still no luck. Can someone tell me how to get rid of this message? We have exchange 2000 with outlook 2000 clients. TIA TRD There are some SPAM messages that intentially corrupt their headers for just this purpose. I suggest going in through OWA and deleting if that will work. -- Matthew "TRD" wrote: > I...

Combo box
This is a multi-part message in MIME format. ------=_NextPart_000_0012_01C836A5.72C81C80 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Greetings, My userform has a combo box that upon entry event is populated via a sub = procedure. The sub procedure defines a column of data on the active spreadsheet as = a range and manipulates the range to add unique values only in = alphabetical order into a collection.=20 Which the collection is then used to Add.Items to the combo box.=20 The userform allows selection of an existing value from th...

Can't disable a button on CDialogBar
Hello I have a button on CDialogBar. my problem is I can't disable this button. here what I have tried. m_wndDialogBar.GetDlgItem(IDC_BUTTON)->EnableWindow(FALSE); I'm using the Doc/View architecture. Thanks in advance. Check the return from GetDlgItem() and make sure it is a valid CWnd*. Also, make sure there is no code in the dialog handler that is reenabling it (you may be competeing with another similar call). Tom <xcppcoder@gmail.com> wrote in message news:1141224821.437297.280720@t39g2000cwt.googlegroups.com... > Hello > I have a button on CDialogBar. my p...

how to run Powerpoint slideshow inside a dialog
Hi All, I am trying to display powerpoint slides in a dialog create by my application. if(m_pptapp.m_lpDispatch == NULL) { if(!m_pptapp.CreateDispatch("Powerpoint.Application")) { AfxMessageBox("Could not create Powerpoint object."); return; } } m_pptapp.SetVisible((long)1); Presentations presentations; SlideShowSettings slideshow; presentations = m_pptapp.GetPresentations(); m_pptpresentation = presentations.Open("R:\\Internals.ppt",(long)0, (long)-1,(long)1 ); slideshow = m_pptpresentation.GetSlideShowSettings(); slide...

Outlook 2007
We are implementing Outlook 2007 - Exchange 2010 across the company and we are noting that while we can open and save attachments directly from the email in either preview pane or full view (by right clicking and saying "Save As"), the Save Attachment button does not work in the Email Toolbar. Having put the Save Attachment button in my quick access toolbar, I note that it does not work either when I open the full Email. I am thinking this might be related to the Exchange/Outlook relationship. Our exchange server in on our LAN and I have my connection set to "Dow...

cannot open backup device
On a SBS2008 with SQL2008 SP1 whe take full backups of all the databases during the night. On the last database we receice an error. In the logfile of sql we find : - error 3201 - Cannot open backup device 'SDE_SQL_TOOLKIT_00__39efe588_5b18_4d07_a4cc_6c3512e839b5_'. Operating system error 0x80070002(failed to retrieve text for this error. Reason: 15105). - error 3041 (backup failed to complete) At the same time in the application log we find : - source : SQLVDI <eventdata><data> signalabort</data><data>Client initiates abort</data>&l...

Opening 2000 files in 2002/2003 hangs
Our marketing department was just upgraded to new computers and Office 2002. Publisher 2002 can't open some of their larger (64 MB) Publisher 2000 documents. It hangs in the conversion process, or takes an hour to open. Some of the smaller ones open, so it's not the AV (McAfee), which I disabled anyway. I deleted all the pages out of one document in 2000, and it still doesn't open in 2003. Help! This might help Large Publisher 2000 publication opens slowly in Publisher 2002 or 2003 http://support.microsoft.com/kb/289010/en-us Try disabling detailed display in view, pictur...

Using PageSetup Default does not save changes when next opened
In Word (MS Office Word 2003 SP3) I make font (from TimesNewRoman to Arial) & font size (12 to 10), I go to PageSetup hit the Default button. My next opening of Word I again have TimesNewRoman 12 pt. I have made changes to NORMAL template many times over years, never had this issue. Presumably when you click Default... you also answer yes to the ensuing dialog? There are some add-ins that prevent Normal.dot from being saved; there are ways to work around them, but a direct solution is just to force an immediate save of Normal. Press the Shift key while clicking on the File...

Unable to open emails sent at attachments, in Outlook 2003 SP3?
Recently I've had a number of users experience the inability to open emails sent to them as attachments, rather than as just inline. They can properly open other attachments (.doc, .pdf, .xls, etc.) without issue. The problem seems to only be with emails sent as attachments. This issue happens whether the attachment email is sent from internal user to user (i.e. never passing through anything but our Exchange 2003 SP2 Server), or from an external source which passes through our spam firewall. Any clues what would be causing this? Is it SP3 for Outlook related? Robert Gordon <...

Can't open web links from recieved email
When I receive email containing web links, my cursor changes to the "hand w/finger". Up until recently, if I then "clicked" on that link, my "Micro Inter Explorer" would automatically open and take me to that website. Now, it has started to "lock up" the system. I then must, and I repeat must, "control, alt, delete" to bring up the "end program" box, but that completely shuts down my Outlook Express 6. Did I inadvertently change a setting? Is there a fix? Some incoming url's can be "copied" and "pasted to t...

Opening Attachments 02-02-10
Using Windows 7 and Outlook 2003 on a brand-new computer. Each time I want to open an attachment, it has a box asking if I want to be asked (obviously so a harmful document is not opened). The box "do not ask me this question again" already has a checkmark in it, but it is lightened in color and nothing that I can choose. How do I ensure that I can open documents without being asked this question each and every time I try to open an attachment? Thanks for any help you can give me. Check your other post for answers -- Peter Please Reply to Newsgroup for the...

Can't Open Canlendar or Contacts
Office Pro XP (2002) was just installed. We are trying to open Outlook to access its Calendar & Contacts applications. We DO NOT want Outlook to be our default email location (Outlook Express has been selected). When we click on the Outlook icon (or open from the Programs folder), we get the message: "Unable to open default email system. Try again." When we "try again," we get the message: "Would you like to open default File System folder?" When answering "yes," the "My Computer" files open in Outlook. At the same time, we get th...

Why with Excel Xp takes too much time to open and in 2003 fast?
I have 2 computers, in one I have Excel XP (2002) and in the other I have Excel 2003, I've been receiving files wich I need to check with my Excel XP, the problem is that it takes too much time to open, and when I try to open it with Excel 2003 it open normaly (fast). What can I do? Urgent, please I will thank you to send answer : eguevara2000@hotmail.com Thanks ________________________ Tengo 2 computadoras, una con Excel Xp (2002) y la otra con 2003, he recibido archivos pero con Excel XP tarda mucho tiempo en abrir los archivos, mientras que en 2003 lo hace normal (rapido), a ...

Assign Macro to button in Excel doesnt work Any ideas?
I have followed the instructions in help but when I get to step 3 "right click to bring up shortcut menu & enter Assign Macro" the assign macro" option does not appear!! Any Ideas Hi Mike can you see assign macro - but it is greyed out? or is it not an option at all? if it is greyed out you'll notice around the button little diagonal lines, click on these and they should go furryish .. now try right mouse clicking. if the option is not there at all, please post back letting us know how you created the button. Cheers JulieD "Mike@Becketts" <Mike@B...

Can't open account.
Why won't my Mac 10.4.11 using safari as browser open my account? Safari version 3.0.4 Inasmuch as this Newsgroup is dedicated to the software program, MS Access, you're not likely to get any answers here to Safari or Mac problems. Try posting into a newsgroup which supports, Mac, and/or Safari. Also, you wuld probably get a better answer if you specify WHICH account you are trying unsuccessfully to open. Best of luck. "sebe" <sebe@discussions.microsoft.com> wrote in message news:577461D2-FF7F-425F-8F23-BBBFC3F819F6@microsoft.com... > > Why won't my...

Combo Box Won't Return Results in Query
I'm using Access 2002 for the first time in a long time and seem to be really rusty. I'm trying to set up a very simple accounts receivable database that will print statements. I have a table with the customers' code and their details, and I've used a combo box linked to the customer code field for the data entry form which dumps its data in a table with the code, invoice date & #, and total. I'm trying to set up a query that will dump all the branches of the same company in one dynaset. I've based the query on the table that is created by the form, wi...

How to pass data from mainframe to modal dialog?
I have a public member variable (user-defined structure) declared in MainFrame.cpp and I would like a modal dialog box to have access to this variable. What is the proper way to pass data to a modal dialog box? Thanks in advance. Create a pointer to this variable in the dialog, and set it before calling the dialog. The example below presumes that the dialog is being called from the mainframe. Otherwise, you will have to get access to the mainframe to get the pointer. Generally, accessing variables in another class is suspect. in mainframe.h Whatever data; in CMyDialog.h: public: Whatev...

Outlook 2002: Opening appointment in Shared Calendar causes it to be copied into your own calendar
I have a weird problem with our department shared calendar. If you open up an appointment within it to see more details, the appointment appears in your own calendar - even though it might be nothing to do with you. I have no idea what might be causing it as it appears to effect everyone, and there are no rules setup on the public folder. We use outlook xp and exchange 2000. Anyone seen this before? In news:1138967876.513592.114670@g44g2000cwa.googlegroups.com, QH <quentinhudson@hotmail.com> typed: > I have a weird problem with our department shared calendar. If you > open up ...

Unable To Open Attachments #2
We use Win2kServer, Exchange 2000 SP3 and OutlookXP When i try open message with attachment i have problem.. the error message is : Could not open one or more attachments! is it a bug in Exchange or Outlook? Are you dealing with the Secutiy Lock within OL2002 for "unsafe" attachments? This is what it sound like. There are KB articles all over the place on it. Jason >-----Original Message----- >We use Win2kServer, Exchange 2000 SP3 and OutlookXP > >When i try open message with attachment i have problem.. > >the error message is : Could not open one or mor...

Odd Drop Down Box Behavior
I have a drop down box on a spreadsheet in a workbook with several spreadsheets. For some reason the contents of the drop down box is beeing bled through to other spreadsheets in the exact same cell reference that the drop down box is linked to, replacing what may be in that cell. It happens randomly yet often, and I have not been able to discern any patterrn or catalyst. The contents and cell formatting are being transfered. It also happens on other spreadsheets using the drop down box. This is an Active-X box, not a forms box, using Excel 2007. Anybody seen this? Squeaky...

Getting a form to open at the top instead of the bottom
Hi This is a very simple question. As mentioned in the subject line, I have created a form which is about 8 inches in height. When a user opens the form, instead of being at the top, they're at the bottom. I can't quite figure out how to make it so that when the form opens, the user is at the top of the form than the bottom. Thank you in advance. The form will open with the focus on the first control in the tab order. forest8 wrote: >Hi > >This is a very simple question. > >As mentioned in the subject line, I have created a form which is ab...

populate a list box with filenames
How would I populate a list box with filenames from a folder so that can choose a file to process -- Message posted from http://www.ExcelForum.com Use Application.GetOpenFilename You can specify the folder by using ChDir before the command: ChDir "C:\Excel\Folder1\Test Folder" Application.GetOpenFilename HTH, Bernie MS Excel MVP "dovrox >" <<dovrox.163avb@excelforum-nospam.com> wrote in message news:dovrox.163avb@excelforum-nospam.com... > How would I populate a list box with filenames from a folder so that I > can choose a file to process. > &...

Multiple Combo box in a form
i'm have a form. i want to do three combo box. one is customer, one is partID and one is process. this three combo box are from three different table. there are customer table, part master table and process table. i want to do like this. if i choose one of the customer from the combo box, then when i go to the partID combo box, then i want it just show out whatever the part which belong to that customer only. others customer's part wont be in the list. then when i click on the process combo box, then i just want the combo box show out the process which is belong to that partID w...

Multi choice list box and two ALL selection
Hello. I have a pop-up form that has 2 list boxes. I want to do 3 things. On the list boxes, I want to make them multi-choice list boxes. Second, I want to make a selection of "all" for both list boxes. And last, I would like to have the text boxes default to the all selection, if possible, until another selection is made. The list boxes are: CarList EventList They are populated by tables - Automobiles - Car Table and Automobiles - Action Taken Table, respectively. Finally, they run through query called AutomobileSearch. Thanks for the help. To make your list multi-select, ...