Modal on Modeless #2

I have created several modeless forms for my app, all with the desktop
set as parent by using dlg.create(IDD_DLG,GetDesktopWindow()).  I did
this because I want the user to be able to have each window open, only
allow one instance of each window, and allow the user to switch between

windows and the main form easily by using taskbar icons.  I would like
to have a button on one of these modeless windows that will pop up a
modal window, that is only modal to that modeless window, so that they
can not go back without closing the modal window, though they can still

go to any of the other modeless windows.  However, my problem is that
when I create a new dialog and call DoModal() for it within the
modeless window, it modals to the main form.  I have tried every way I
can think of to use SetParent() to set the modals parent to the
modeless dialog, and though it compiles fine, it always crashes upon
execution of such code.  Any help on how to accomplish my goals?  Thank

You.

0
eric2370 (4)
10/11/2006 8:15:12 PM
vc.mfc 33608 articles. 0 followers. Follow

5 Replies
409 Views

Similar Articles

[PageSpeed] 12

Modal dialogs are modal to the application, not just the parent window.  So
you will have to do things a little differently. (I am not sure if threads
will help in this situation)

Anyway, here is what you can do.   You can create the modal dialog as a
modeless dialog also, but right before you show the dialog you can disable
the parent window, and when the user presses the button, close the modeless
dialog and send a message back to the parent to enable itself again.

AliR.

"Sassamo" <eric@pennmedical.com> wrote in message
news:1160597712.715237.238330@k70g2000cwa.googlegroups.com...
> I have created several modeless forms for my app, all with the desktop
> set as parent by using dlg.create(IDD_DLG,GetDesktopWindow()).  I did
> this because I want the user to be able to have each window open, only
> allow one instance of each window, and allow the user to switch between
>
> windows and the main form easily by using taskbar icons.  I would like
> to have a button on one of these modeless windows that will pop up a
> modal window, that is only modal to that modeless window, so that they
> can not go back without closing the modal window, though they can still
>
> go to any of the other modeless windows.  However, my problem is that
> when I create a new dialog and call DoModal() for it within the
> modeless window, it modals to the main form.  I have tried every way I
> can think of to use SetParent() to set the modals parent to the
> modeless dialog, and though it compiles fine, it always crashes upon
> execution of such code.  Any help on how to accomplish my goals?  Thank
>
> You.
>


0
AliR3470 (3235)
10/11/2006 8:27:16 PM
I gave it a try, it disables the modeless window, but doesn't display
the new modeless window, and if I try to set it's parent to the desktop
with create, it disables my first modeless window, brings the main form
on top, and still doesn't show itself.  Now, if I were to remove the
getdesktopwindow from the create for the first modeless window, i can
successfully domodal onto the modeless window, it has something to do
with setting it to the desktop.  Is there any other way of achieving my
goal of gettings these modeless windows to have a taskbar icon?

0
eric2370 (4)
10/12/2006 1:05:58 PM
Are you using DoModal or Create to bring up the last dialog?

void CParentDialog::BringUpDialog()
{
        if (m_ChildDlg.m_hWnd != NULL)
        {
                m_ChildDlg.Create(CChildDlg::IDD,this);
        }
        m_ChildDlg.ShowWindow(SW_SHOW);
        EnableWindow(FALSE);
}


AliR.

"Sassamo" <eric@pennmedical.com> wrote in message
news:1160658358.475837.14620@i3g2000cwc.googlegroups.com...
> I gave it a try, it disables the modeless window, but doesn't display
> the new modeless window, and if I try to set it's parent to the desktop
> with create, it disables my first modeless window, brings the main form
> on top, and still doesn't show itself.  Now, if I were to remove the
> getdesktopwindow from the create for the first modeless window, i can
> successfully domodal onto the modeless window, it has something to do
> with setting it to the desktop.  Is there any other way of achieving my
> goal of gettings these modeless windows to have a taskbar icon?
>


0
AliR3470 (3235)
10/12/2006 3:17:02 PM
Hmm, I don't know what I mistyped last time, but it works.  Thanks for
your help!

0
eric2370 (4)
10/13/2006 1:31:15 PM
By the way, to accomplish what I had originally intended, use the
following:

CMyDlg dlg(this);
dlg.DoModal()

without the (this), it automatically defaults to the main form

0
eric2370 (4)
10/18/2006 8:02:19 PM
Reply:

Similar Artilces:

Access MODAL form does not seem to act "MODALLY"
Sorry this is a bit long but I hope it is clear... I have a parameter field PARAM on a parameter form into which I want to enter a string validated as comprising three parts made up from different fields in the database. In "native" form on the parameter form it works well as follows: 1 - Double click on PARAM field and that makes a combo box visible and hides the PARAM field. 2 - Select from combo and on tab (lost focus) make next combo visible.... etc. 3 - on completion of last combo and tab (lost focus) build the PARAM value from the Me.cbo...values and makes all...

User Form Problem #2
I have done some reading on using User Forms within VBA. I am taking data from the form and putting it to an Excel worksheeet. Here is the code I have so far... This all works... Private Sub cmdSaveData_Click() Dim LastRow As Object Sheets("DailyData").Select Set LastRow = Sheet1.Range("a65536").End(xlUp) LastRow.Offset(1, 0).Value = txtDate.Text LastRow.Offset(1, 1).Value = txtRawPounds.Text LastRow.Offset(1, 2).Value = txtRawSolids.Text LastRow.Offset(1, 3).Value = txtFrenchFryPounds.Text LastRow.Offset(1, 4).Value = txtBatterPounds.Text LastRow.Offset(1, 5).Value ...

Percentage #2
How do i get a figure for Percentage in xl? I have a set of cells that i need to know the percentage of. For example: Cell B6 to B 50 has names in it, what is the percentage of individuals in the cell? thanks in advance. Assume you want to know what % of entries contain Bob: Assumes there are no empty/blank cells within the range: =COUNTIF(B$6:B$50,"Bob")/ROWS(B$6:B$50) Format as PERCENTAGE Biff "help with excel" <helpwithexcel@discussions.microsoft.com> wrote in message news:5C965427-F982-4576-858B-37E811DF1B9A@microsoft.com... > How do i get a figure f...

Custom Formatting #2
In a cell, I want to include a double quote as my custom formatting. For example, I want to enter the following in the formatted cell: 12.43 I want the displayed results to look like: 12.43" I've looked a few places and cannot find any info. Any help is appreciated. Thanks Matt Matt, When you type in the custom number format, use \" to indicate the double quote mark. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Matt McAleer" <mmcaleer@delfield.com> wrote in message news:131f01c3df98$061db8a0$a00...

[file name].xls:2...what is ":2" ???
It seems that my file has duplicated itself. When I open the file in Excel 97, there is actually two (2) "files" that open. When I click on "Window" drop down menu, I see: [file name].xls:1 [file name].xls:2 Both files are the same but seem independant. What is that ":1" & ":2" ?? Can someone tell me: (1) What I did to get this? (2) How MS Excel refers to or calls that function (3) How do I change my spreadsheet to the original version? Any help will be greatly appreciated. Marc Hello You have opened two windows from the same w...

RE: 2 DIGITS OUT OF 4
=Mid(cell-reference,2,2) the first '2' tells Excell where to start, the second '2' tells excel how many characters to extract. the MID function extracts data from the middle of a string of characters, similar to LEFT and RIGHT --------------= Posted using GrabIt =---------------- ------= Binary Usenet downloading made easy =--------- -= Get GrabIt for free from http://www.shemes.com/ =- ...

Vista #2
I just got a new laptop and it is running Vista Home Premium edition. I'm using Money 2003 on it and my desktop. Money runs very slowly on the laptop but is just fine on the desktop which uses XP Home. The laptop has more memory and faster CPU than the desktop. If I upgrade to the 2007 version will it run better? In microsoft.public.money, Korey wrote: >I just got a new laptop and it is running Vista Home Premium edition. I'm >using Money 2003 on it and my desktop. Money runs very slowly on the laptop >but is just fine on the desktop which uses XP Home. The lapto...

How do I link info from 2 seperate documents at same time.
I want to print a report that contains info from 2 seperate doc's, and need to know how to "link" (?) them together so that all I have to do is print and not copy and paste. I used to merge info from 2 doc's but it has been too long since, don't remember how. I am using Excel, I used MS Works before and am not sure if what I am wanting to achieve is possible with Word. tafferjim wrote: > I want to print a report that contains info from 2 seperate doc's, and need > to know how to "link" (?) them together so that all I have to do is print and >...

Non-modal dialog in CSplitterWindow???
Hello newsgroup, is it possible to show a non-modal dialog in a pane of a CSplitterWindow? The documentation says that CSplitterWindow may contain windows that are not views, but I have some doubts. Since CSplitterWindow's CreateView method assumes that the window _IS_ a view (it calls Wnd::Create, which is utterly inappropriate if I want to create a modeless dialog), I don't see how I can use CSplitterWindow. Is there any alternative to CSplitterWindow? Some words about my project: My app should display image data. This done via the common doc-view approach. There must be a dialog...

payroll extensions #2
How do I install payroll extenstions. Is this a seperate module? I have done several queries on the KB but not able to find if this is part of advanced payroll or stand alone add on? Thanks On GP 10.0, I see Payroll Extensions and Advanced Payroll under the Additional Products >> HRPSuite folder on CD2. Have you checked there, yet? "nfp" wrote: > How do I install payroll extenstions. Is this a seperate module? I have done > several queries on the KB but not able to find if this is part of advanced > payroll or stand alone add on? > > Thanks No I have ...

Splash screen/modal interaction?
Hiya I'm using the splash window code from http://www.microsoft.com/msj/1099/c/c1099.aspx in an MDI application I'm working on. I create the splash window on the heap in CWinApp::InitInstance() while I do some time- consuming initialisation (loading a few big files needed by the application). I added a couple of members to the CSplash class to allow me to update the splash window title on the way through the initialisation process (eg. 'loading big file 1', loading even bigger file 2') - everything worked fine. The problem came when I added a modal licence dialog ...

LDAP Server #2
Hi; I installed Outlook 2003 about a month ago before I went on vacation. Now when I returned from vacation, I have problems. When I try to sync my palm handheld to outlook, outlook hangs and then a message comes up that says "Can't contact LDAP Directory Server (81)" What does this mean? Can I remove the LDAP server? How? I would like to bring in my hotmail mail if possible but If I had to do without it it would be ok. I am not on any other type of network. I would like to be able to use my calendar and notes and contacts with my palm even if I couldnt check my hotmail email. A...

E-mail is delivered, then disappears, then reappears 2 minutes later
Version: 2008 Operating System: Mac OS X 10.6 (Snow Leopard) Processor: Intel Email Client: Exchange Very odd issue. I am using Entourage Web Services Edition 13.0.3 (091002) and connecting to an Exchanges server 2007 at work. I have several folder created and rules written to deliver the mail into specific folders. <br><br>When mail arrives I get the notification, then I see the new e-mail, open the new e-mail, mid way through reading the new e-mail it will disappear. I try to refresh, nothing happens. I send and receive, nothing happens. About 2 minutes later the e-mail rea...

change number of columns from 3 to 2 in text frame
I know the question sounds silly but don't see how I can readily do this for just one frame. Can do it for a page but not a frame? Right click in the frame, then Change Frame, then Text Frame = Properties...then Columns. I'm using an older version of Pub, but it should be similar in newer = versions "zaidlicz" <zaidlicz@discussions.microsoft.com> wrote in message = news:E00D385F-4264-4D1E-8138-33951AD5F496@microsoft.com... | I know the question sounds silly but don't see how I can readily do = this for=20 | just one frame. Can do it for a page but not a frame? ...

To Chip Pearson
Hi Chip, I had the Analysis Toolpak add-in enabled Andy "Andy" <atkchung@net-yan.com> �b�l�� news: �����g... > Hi Chip, > > I downloaded the Excel calendar from your website, tried it and had problem, > the line causing the problem is > > Range("StatusCell").Value = Format(TempDate, "mmm d, yyyy") _ > & " " & Format(DayOfYear(TempDate), "##0") & _ > NumberSuffix(DayOfYear(TempDate)) & " day of year." & _ > " Days From Now: " & F...

Calculation Problem #2
How can I structure the worksheet to solve this problem. The cell value is part of the total but the cell calculation depends on the total. For example: Cell B1= 3% of cell B4 Cell B2= 5% of cell B4 Cell B3=10 Cell B4=sum(B1:b4) How can cells B1 & B2 be calculated when they're part of the total? Thank you! "Larry" <lkimball@pacbell.net> wrote in message news:4d9754e6.0310311317.695bb817@posting.google.com... > How can I structure the worksheet to solve this problem. The cell > value is part of the total but the cell calculation depends on the > total. &g...

Problem: Non-modality of modal dialogs
Hi All, I have a dialog-based application in MFC (main window is CDialog1). I have a separate thread (class derived from CWinThread) in the application. The main window (m_pmainWnd) of the thread is a hidden modeless dialog (this is CDialog2). I have created the thread in InitInstance() of my application class using AfxBeginThread (). I PostMessage() to the "hidden modeless dialog" on a button-click of the application dialog. The PostMessage() handler displays a modal dialog (this is CDialog3). Button-click on 'Dialog3' displays another modal dialog (this is...

Cannot locate recurrence information. #2
I have a workstation that, after launching Outlook 2003 and updating the mail folders, displays the following message: "There was a problem reading one or more of your reminders. Some reminders may not appear. Cannot locate recurrence information for this appointment." I have tried running Outlook from the command line using the /cleanreminders switch. This does change the response for that one instance of running the program in that the error appears and so does a list of reminders. I have tried deleting those reminders or moving them into the future but, even with no r...

Fill series that combines data from 2 sheets in blocks of 10
Hi, I have a spreadsheet with two sheets... Sheet1, and Sheet2, that I us as sort of a staging area to format info before bulk uploading to m product database. The products I'm working with at the moment have 1 subcategories below each of them. Sheet1 is the full product databas listing. I place new subcategories in blocks of 10 that I plan to ad to the database on Sheet2. Sheet2 also holds the default partia category names in cells A2-A11. Part 1: I am currently using the following formula on Sheet2, in column C t combine the category name value on Sheet1, with the default partia cat...

Modal? acDialog?
Hi folks. I've inherited an Access project, and I'm a VB6 guy, so I'm in territory that looks familiar, but isn't acting familiar. I need to create a form with 2 fields on it (date and amount), and pass into that form a recordset that I can use to AddNew or Update as appropriate. How do I instantiate a form? After that, how do I show that form "modal" so that they have to deal with that input form before doing anything else? Any advice is very appreciated. Matt Hi Matt, Try: DoCmd.OpenForm "YourFormName", , , , , acDialog YYZ wrote: >Hi folks. ...

Exchange Reporting #2
Hello there. We are using Exchange Server 2003 in our company. My management would like me to pull a report stating how many inbound messages are received each day by each recipient in exchange. Is this possible? I have not seen any reporting functions in the Exchange Manager which would allow me to do this. Sean MIS Systems Manager It is not possible natively. You would need to look into a 3rd party monitoring/reporting solution in order to achieve this. Something like Promodag Reports, or Quest MessageStats ought to be able to provide this information. -- Ben Winzenz Exchange M...

Restrictions #2
All of a sudden I am no longer able to click on hyperlinks embedded within email and get an error message "THIS OPERATION HAS BEEN CANCELLED DUE TO RESTRICTION IN EFFECT ON THIS COMPUTER. PLEASE CONTACT YOUR SYSTEM ADMINISTRATOR." I haven't knowingly changed anything but some other program may have. How do I get back to normal? ...

customize does not work #2
I have 1 WinXP computer that has Outlook 2000 installed as the mail client. When I select "Customize Outlook Today" nothing happens. I do not get the chance to change any of the default configuration of the Outlook Today page. Does anyone know the reason for this? thx in advance. >-----Original Message----- >I have 1 WinXP computer that has Outlook 2000 installed >as the mail client. When I select "Customize Outlook >Today" nothing happens. I do not get the chance to change >any of the default configuration of the Outlook Today >page. Does anyo...

Resize 2 Forms at Once Like HTML Frames
I'm envisioning an application with 2 forms filling up the screen, one on top of the other. The user could drag in the middle to resize both simultaneously just as you would a website with 2 frames. How can I do this? -- Thanks for helping. Paul C Put code in the Resize events of both forms, referring to each other. If the Width of FormA decreases by a certain amount, increase the Width of FormB and so on. -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no e-mails, please!) <pcross29@gmail.com> wrote in message news:1193091694.809588.65440@y27g2000pre.googlegro...

Modal Object
A form can be Modal. Menus also appear to be Modal. Is there anyway to create an object and make it modal (independent) of the form or any control on the form? "David" <NoWhere@earthlink.net> wrote in message news:e$WMI%23t5KHA.6052@TK2MSFTNGP02.phx.gbl... >A form can be Modal. Menus also appear to be Modal. > > Is there anyway to create an object and make it modal (independent) > of the form or any control on the form? I think you need to elaborate on what you are trying to do. 'Modal' is not a synonym for 'independent'. ...