How to DoModal a CDialog initially invisible

Hi all,

Under specific circunstances, I need to start my dialog-based app invisible.


Unfortunately, as expected, when I call DoModal, the window is always 
visible, whatever I do (uncheck the visible box on dialog properties in 
the resources, ModifyStyle in OnInitDialog, ...)

Is there a clean way to do that ?

If not, what could be the cleanest dirty way ?  ;)

Thanks.

--
Dansk
0
dansk1 (20)
5/30/2007 7:31:40 AM
vc.mfc 33608 articles. 0 followers. Follow

9 Replies
1652 Views

Similar Articles

[PageSpeed] 36

Just don't call DoModal().

Place the code that you need to execute into a separate function in the same 
dialog class and call that function.

class MyDialog : public CDialog
{
public:
    MyDialog() : CDialog( IDD_TEMPLATE ) {}
    void Whatever() {}

    afx_msg void OnInitDialog()
    {
        Whatever(); // If you need this functionality here for any reason.
    }
};

MyDialog dlg;
dlg.Whatever(); // Do stuff in hidden mode.

MyDialog dlg1;
dlg1.DoModal(); // Do stuff in normal mode.

Using dialog classes for some hidden mode background execution is a BAD 
idea. But it'll at least allow you to cut some corners, if your project is 
huge and separating the back-end code into a separate module can't be done 
quickly.

"Dansk" <dansk@laouilest.com> wrote in message 
news:uHyeUyooHHA.4552@TK2MSFTNGP04.phx.gbl...
>
> Hi all,
>
> Under specific circunstances, I need to start my dialog-based app 
> invisible.
>
>
> Unfortunately, as expected, when I call DoModal, the window is always 
> visible, whatever I do (uncheck the visible box on dialog properties in 
> the resources, ModifyStyle in OnInitDialog, ...)
>
> Is there a clean way to do that ?
>
> If not, what could be the cleanest dirty way ?  ;)
>
> Thanks.
>
> --
> Dansk 


0
5/30/2007 7:45:33 AM
Thanks for your answer, Ashot.

I agree with your concept (I usually try to do like that), but my 
problem is a bit more complicated. (Ok, my explanations were too light)

The Whatever method picks items in an array. If the array has only one 
element, then the dialog should be invisible.

If the array has more than one element, the dialog should be visible

BUT, the array is filled on reception of a BroadcastSystemMessage, so my 
app should be able to handle those messages. If the invisible window 
receives a new item in the array, it should become visible.

That's why I needed the message loop and why I call DoModal

Am I clear enough?

Thanks.
--
Dansk

Ashot Geodakov wrote :
> Just don't call DoModal().
> 
> Place the code that you need to execute into a separate function in the same 
> dialog class and call that function.
> 
> class MyDialog : public CDialog
> {
> public:
>     MyDialog() : CDialog( IDD_TEMPLATE ) {}
>     void Whatever() {}
> 
>     afx_msg void OnInitDialog()
>     {
>         Whatever(); // If you need this functionality here for any reason.
>     }
> };
> 
> MyDialog dlg;
> dlg.Whatever(); // Do stuff in hidden mode.
> 
> MyDialog dlg1;
> dlg1.DoModal(); // Do stuff in normal mode.
> 
> Using dialog classes for some hidden mode background execution is a BAD 
> idea. But it'll at least allow you to cut some corners, if your project is 
> huge and separating the back-end code into a separate module can't be done 
> quickly.
> 
> "Dansk" <dansk@laouilest.com> wrote in message 
> news:uHyeUyooHHA.4552@TK2MSFTNGP04.phx.gbl...
>> Hi all,
>>
>> Under specific circunstances, I need to start my dialog-based app 
>> invisible.
>>
>>
>> Unfortunately, as expected, when I call DoModal, the window is always 
>> visible, whatever I do (uncheck the visible box on dialog properties in 
>> the resources, ModifyStyle in OnInitDialog, ...)
>>
>> Is there a clean way to do that ?
>>
>> If not, what could be the cleanest dirty way ?  ;)
>>
>> Thanks.
>>
>> --
>> Dansk 
> 
> 
0
dansk1 (20)
5/30/2007 8:12:27 AM
"Dansk" <dansk@laouilest.com> wrote in message 
news:uHyeUyooHHA.4552@TK2MSFTNGP04.phx.gbl...
>
> Hi all,
>
> Under specific circunstances, I need to start my dialog-based app 
> invisible.
>
>

Make a hidden window the main window of your app, not the dialog:

CYourApp::InitInstance()
{
    ...
   CMainWnd *pMainWnd = new CMainWnd;
   if ( !pMainWnd->Init() )
      return FALSE;

    m_pMainWnd = pMainWnd;

    return TRUE;
}

where


//// [mainwnd.h]

class CMainWnd : public CFrameWnd
{
public:
 CMainWnd();
 BOOL Init();

protected:
 virtual ~CMainWnd();

 // Overrides
 // ClassWizard generated virtual function overrides
 //{{AFX_VIRTUAL(CMainWnd)
protected:
 //}}AFX_VIRTUAL


 // Generated message map functions
protected:
 //{{AFX_MSG(CMainWnd)
 afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
 //}}AFX_MSG
 DECLARE_MESSAGE_MAP()
}



//// [mainwnd.cpp]

CMainWnd::CMainWnd()
{
}

CMainWnd::~CMainWnd()
{
}

BOOL CMainWnd::Init()
{
    CRect rcWnd (0, 0, 1, 1); // can be anything because window is hidden
    if (!CreateEx (0, AfxRegisterWndClass(0), NULL, WS_POPUP, rcWnd, NULL, 
0))
        return FALSE;

 return TRUE;
}


BEGIN_MESSAGE_MAP(CMainWnd, CFrameWnd)
 //{{AFX_MSG_MAP(CMainWnd)
 ON_WM_CREATE()
 //}}AFX_MSG_MAP
END_MESSAGE_MAP()


// CMainWnd message handlers

int CMainWnd::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
 if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
  return -1;

 return 0;
}


But, how does the user make your dialog visible?  In my programs, 
CMainWnd::OnCreate() creates a tray icon.  When the user double-clicks the 
icon, CMainWnd gets a message, then shows the modal dialog.  You could adapt 
this to have CMainWnd show your dialog under applicable circumstances.

-- David



0
dc2983 (3206)
5/30/2007 11:25:08 AM
David Ching wrote:
> "Dansk" <dansk@laouilest.com> wrote in message 
> news:uHyeUyooHHA.4552@TK2MSFTNGP04.phx.gbl...
>> Hi all,
>>
>> Under specific circunstances, I need to start my dialog-based app 
>> invisible.
>>
>>
> 
> Make a hidden window the main window of your app, not the dialog:
> 
> CYourApp::InitInstance()
> {
>     ...
>    CMainWnd *pMainWnd = new CMainWnd;
>    if ( !pMainWnd->Init() )
>       return FALSE;
> 
>     m_pMainWnd = pMainWnd;
> 
>     return TRUE;
> }
> 
> where
> 
> 
> //// [mainwnd.h]
> 
> class CMainWnd : public CFrameWnd
> {
> public:
>  CMainWnd();
>  BOOL Init();
> 
> protected:
>  virtual ~CMainWnd();
> 
>  // Overrides
>  // ClassWizard generated virtual function overrides
>  //{{AFX_VIRTUAL(CMainWnd)
> protected:
>  //}}AFX_VIRTUAL
> 
> 
>  // Generated message map functions
> protected:
>  //{{AFX_MSG(CMainWnd)
>  afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
>  //}}AFX_MSG
>  DECLARE_MESSAGE_MAP()
> }
> 
> 
> 
> //// [mainwnd.cpp]
> 
> CMainWnd::CMainWnd()
> {
> }
> 
> CMainWnd::~CMainWnd()
> {
> }
> 
> BOOL CMainWnd::Init()
> {
>     CRect rcWnd (0, 0, 1, 1); // can be anything because window is hidden
>     if (!CreateEx (0, AfxRegisterWndClass(0), NULL, WS_POPUP, rcWnd, NULL, 
> 0))
>         return FALSE;
> 
>  return TRUE;
> }
> 
> 
> BEGIN_MESSAGE_MAP(CMainWnd, CFrameWnd)
>  //{{AFX_MSG_MAP(CMainWnd)
>  ON_WM_CREATE()
>  //}}AFX_MSG_MAP
> END_MESSAGE_MAP()
> 
> 
> // CMainWnd message handlers
> 
> int CMainWnd::OnCreate(LPCREATESTRUCT lpCreateStruct)
> {
>  if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
>   return -1;
> 
>  return 0;
> }
> 
> 
> But, how does the user make your dialog visible?  In my programs, 
> CMainWnd::OnCreate() creates a tray icon.  When the user double-clicks the 
> icon, CMainWnd gets a message, then shows the modal dialog.  You could adapt 
> this to have CMainWnd show your dialog under applicable circumstances.
> 
> -- David
> 
Thanks for your answer.
First, I answer your question.

The dialog has a number of tasks to do.
The tasks are in an array.

If there is only one task to do, I need the dialog to be invisible and 
will display a messagebox telling that the tasks ended when ... the task
ends.


If there is more than one task in the array, then I need the dialog to 
be visible and it shows the progress of each task.

Tasks are managed in a worker thread (could be member of the dialog or 
not, I don't mind)

It can happen that the program starts with only one task (invisible), 
but, while executing that task, another one is added to the tasks array. 
Then, I want the dialog to appear.

Am I clear enough?

Thank you for the code you kindly suggested, it will be a great help.
Instead of creating an intermediate CFrameWnd, do you think I can 
directly call CDialog::Create?

--
Dansk
0
dansk1 (20)
5/30/2007 1:25:59 PM
You can simply make the dialog a modeless dialog and return TRUE from 
OnInitInstance. Modeless dialogs can be created hidden.

BOOL CCatchCursorApp::InitInstance()
{

   CWinApp::InitInstance();

   m_pMainWnd = &m_Dlg;
   m_Dlg.Create(CMyDlg::IDD);

   return TRUE;
}

When you want to close the app post a WM_QUIT to the message queue.

PostMessage(WM_QUIT);

AliR.


"Dansk" <dansk@laouilest.com> wrote in message 
news:uHyeUyooHHA.4552@TK2MSFTNGP04.phx.gbl...
>
> Hi all,
>
> Under specific circunstances, I need to start my dialog-based app 
> invisible.
>
>
> Unfortunately, as expected, when I call DoModal, the window is always 
> visible, whatever I do (uncheck the visible box on dialog properties in 
> the resources, ModifyStyle in OnInitDialog, ...)
>
> Is there a clean way to do that ?
>
> If not, what could be the cleanest dirty way ?  ;)
>
> Thanks.
>
> --
> Dansk 


0
AliR3470 (3234)
5/30/2007 3:46:15 PM
See this:  http://bobmoore.mvps.org/Win32/w32tip26.htm

---
Ajay


On May 30, 3:31 am, Dansk <d...@laouilest.com> wrote:
> Hi all,
>
> Under specific circunstances, I need to start my dialog-based app invisible.
>
> Unfortunately, as expected, when I call DoModal, the window is always
> visible, whatever I do (uncheck the visible box on dialog properties in
> the resources, ModifyStyle in OnInitDialog, ...)
>
> Is there a clean way to do that ?
>
> If not, what could be the cleanest dirty way ?  ;)
>
> Thanks.
>
> --
> Dansk


0
ajaykalra (6840)
5/30/2007 4:06:03 PM
"Dansk" <dansk@laouilest.com> wrote in message
news:e83XU4roHHA.3968@TK2MSFTNGP06.phx.gbl...
> Instead of creating an intermediate CFrameWnd, do you think I can directly
> call CDialog::Create?
>

Yes, I see AliR has suggested that.  Since it's so easy, I would try that
first, and if it doesn't work for whatever reason, try CMainWnd.

Thanks,
David



0
dc2983 (3206)
5/30/2007 4:49:05 PM
See my essay on dialog-based apps; Nish gave me permission to include his technique for
achieving this.
				joe

On Wed, 30 May 2007 09:31:40 +0200, Dansk <dansk@laouilest.com> wrote:

>
>Hi all,
>
>Under specific circunstances, I need to start my dialog-based app invisible.
>
>
>Unfortunately, as expected, when I call DoModal, the window is always 
>visible, whatever I do (uncheck the visible box on dialog properties in 
>the resources, ModifyStyle in OnInitDialog, ...)
>
>Is there a clean way to do that ?
>
>If not, what could be the cleanest dirty way ?  ;)
>
>Thanks.
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15977)
5/30/2007 6:10:58 PM
Now, it works.
Thanks *a lot* everybody for your time and help.

Dansk a �crit :
> 
> Hi all,
> 
> Under specific circunstances, I need to start my dialog-based app 
> invisible.
> 
> 
> Unfortunately, as expected, when I call DoModal, the window is always 
> visible, whatever I do (uncheck the visible box on dialog properties in 
> the resources, ModifyStyle in OnInitDialog, ...)
> 
> Is there a clean way to do that ?
> 
> If not, what could be the cleanest dirty way ?  ;)
> 
> Thanks.
> 
> -- 
> Dansk
0
dansk1 (20)
5/31/2007 6:52:54 AM
Reply:

Similar Artilces:

Initial scroll sizes & CScrollView::GetTotalSize() problem
With your help, my scroll bars are almost working. There are still 2 problems. 1. When I initially switch views to the one that requires scroll bars, OnUpdate() is not called, so SetScrollSizes() is also not called. OnUpdate() IS called once at program startup, but it's not clear to me whether OnDraw() has been called yet. Altering the view does call OnUpdate() as expected. a. Should I just call OnUpdate() manually whenever I change views? b. Should I try and make a call to SetScrollSizes() in OnInitialUpdate()? 2. GetTotalSize() always returns (0,0). From the docs, I thought it was sup...

Initial REaction to 2005
Yuck. Ok, it isn't that bad though I cannot find a thing yet. It made me change my password to my bank before it would update (download in 2005 speak) and wouldn't update Morgan Keegan last night. This morning it wouldn't update Morgan Keegan or Fidelity. And it scares you to death with rows and rows of error messages though it seems just not to connect. It updates faster and maybe doesn't try as many times. I don't know. I went to my other computer where I kept Money 2004 and Morgan Keegan updated just fine. Disabling Online Services for MorganKeegan and ...

Why might CDialog::DoModal() overwrite heap data???
I have a CPtrList and struct that I create with new. I use these vars in a CDialog::OnOk() overridable. They are fine until I bring up another dialog box. When I return from the second CDialog my heap data is hosed. Any thoughts? Lots of reasons. Show some code. joe On 30 Sep 2003 18:51:51 -0700, cssnow@hotmail.com (Rob) wrote: >I have a CPtrList and struct that I create with new. I use these vars >in a CDialog::OnOk() overridable. They are fine until I bring up >another dialog box. When I return from the second CDialog my heap >data is hosed. > >Any thoughts? ...

initial default column width
Is there a way to configure Excel 2000 so that when I create a new Workbook or add a new Worksheet so that all the columns have a particular width instead of the default 64 pixels? TIA Create the workbook exactly the way you want it, then save it as a template with the name "Book.xlt" (no quotes) in you XLStart directory. It'll be then used as the template for new workbooks. Likewise, save a one-sheet workbook as a template, named "Sheet.xlt" for the template for Insert/Worksheet. In article <419E181F.6251D20D@nospam.net>, Bruceh <bruce@nospam.net&...

Word 2007
I have a document modified by many people with close to 80 comments. Is there a way to change all the initials of all the comments to something like "Author" so I can give a clean copy to the client? Jeff, You can apply a common color and initials to comments with a macro like this: Sub ScratchMaco() Dim oCom As Comment For Each oCom In ThisDocument.Comments oCom.Author = "Common" oCom.Initial = "Author" Next oCom End Sub For help installing and using the macro see: http://www.gmayor.com/installing_macro.htm "Jeff Lowenstein...

OnInitDialog not getting called because of DoModal
Hi, I'm creating/showing-up a new dialog box in a vc++ 2k5 mfc application. If I show my dialog using a DoModal(): FeedBackDlg feedback (IDD_FEEDBACKDLG); INT_PTR ret = feedback.DoModal(); the OnInitDialog method of my dialog doest not get called. But on the other hand if I creat my dialog using: FeedBackDlg *one = new FeedBackDlg(); one->Create(IDD_FEEDBACKDLG, NULL); one->ShowWindow(SW_NORMAL); one->UpdateWindow(); the OnInitDialog method gets called. What can I do so that the OnInitDialog method gets when I'm showing the dialog through domodal()? Regard...

Crash upon CDialog::UpdateData in multithreaded app
I have a dialog app (derived from CDialog) from which a thread is created (derived from CWinThread). Every 0.5s the thread sends a WMUSER_NOTIFYXXXXX message to the dialog, so that the dialog can update its data - in this case it's to display the progress of the thread in its task. The problem is that as soon as UpdateData() is called in the dialog class, the app crashes. I thought I had got around problems of the child thread directly accessing the parent thread data by sending a Windows Message instead of directly calling a parent class function. What am I doing wrong? NB: No cra...

DoModal() question.
I have a dialog class dlg. When I use dlg.DoModal(), there're always two buttons "Cancel" and "Ok" on popup window which I didn't put there. They seem to be put there by system default. How to remove them? Thanks. Frank E Rogers wrote: > I have a dialog class dlg. When I use dlg.DoModal(), there're always two > buttons "Cancel" and "Ok" on popup window which I didn't put there. They > seem to be put there by system default. How to remove them? > Thanks. > > First, you better add message handlers for them. Your ha...

CDialog (4.)
How can I mimic modal dialog with modeless dialog? I'm trying this: MyClass::MyFunc() { CMyDlg * dlg = new CMyDlg(); BOOL ret = dlg->Create(IDD_DIALOG1, NULL); if (!ret) MessageBox(0, "Can't show dialog", "Test", 0); dlg->ShowWindow(SW_SHOW);//*/ //Wait while some button on dialog is pressed and dialog is closed while (dlg->IsWindowVisible()) Sleep(100); //Some other code here } Is this OK? I'm not trying to mimic whole modal dlg behaviour, but just this part when execution stops while some dlg button is pressed. Thank you. ...

failed to initialize the mapi subsystem
Can anybody help me please. I have attempted the install the exchange connector onto a customers exchange enterprise server, and it goes through smoothly until the last screen. When trying to create the user rules we receive the above message. I have read that outlook needs to be installed on the server (which my customer will not do) or add entries for Exchange services to Mapisvc.inf (http://support.microsoft.com/kb/294470/) Anybody have any thoughts or ideas to help me out. Best Wishes. ...

DoModal
Hey, I'd like to add a settings dialog box to my application. The below code triggers the new dialog to appear on the screen. CSomethingDlg dlg; INT_PTR iStatus = dlg.DoModal(); In this new dialog box I have included a "Ok" button that is suppose to save the setting and return to the application. Here is the code for the button: void CSomethingDlg ::OnBnClickedOk() { OnOK(); } My question simply, how do I send\pass the new settings back to my main application ? Member variable of dlg are still accessible to your procedure (if they're public). Just access them via: ...

CDialog and CFormView for same template
I defined a dialog with the Visual Studio dialog designer, and would like it to be usable in a both CDialog and a CFormView without duplicating both the template and having two classes with the same member variables and functions. How can I do this? Thanks- Steve Since CDialog and CFormView are both derived from CWnd, you can't use multiple inheritance to create a hybrid class as one might hope. But you can do one of these tricks: 1) Create a class derived from CDialog and use it as your dialog class. Create a class derived from CView (not CFormView) and Create an instance of t...

Invisable text in formula bar
I have XP, Office Professional 2003, recently my editing text has stop showing in the formula bar, yet it does appear in the cells. If I add text to the formula bar the new text is invisable while the old text stays visable and all test shows in the cell. If I edit in the cell the text will appear in the cell but not in the formula bar space. I have tried the Tool, Options selections, no good. Help Please.....Leroy It seems that your cells are hidden (Format/Cells/Protection/Hidden is checked) and your worksheet is protected (Tools/Protection/Worksheets). Regards, Stefi „Leroy-P” e...

CFileDialog .DoModal fails on Win98.
Good day. I have developed an app using MFC (statically linked) that uses the CFileDialog class to open up a browse dialog. This works fine on the Win2K machine that I developed it on, but when I test it on a Win98 box, it locks up right at the point of the call to .DoModal. I click a button to launch this dialog, the parent window of the browse dialog loses focus (titlebar goes from dark blue to gray implying something else has got the focus), but the browse dialog never appears on screen and I have to End Task on my app. Is it a distribution issue? Am I missing some core files that need t...

Modeless CDialog ghost image...
Scenerio: I am creating a splash screen via a modeless dialog box. The implementation is as follows -> //creation #ifdef CWINDOWKEEPER_SPLASH pSplashDlg=new CSplashDlg; pSplashDlg->Create(CSplashDlg::ID,this); CenterWindowOnScreen(pSplashDlg->GetSafeHwnd()); pSplashDlg->ShowWindow(SW_SHOW); SetTimer(CWINDOWKEEPER_SPLASH_TIMER_ID,SPLASH_DELAY,NULL); #endif //timer delay to destroy splash dialog #ifdef CWINDOWKEEPER_SPLASH case CWINDOWKEEPER_SPLASH_TIMER_ID: KillTimer(CWINDOWKEEPER_SPLASH_TIMER_ID); pSplashDlg-&...

AfxRegisterClass with CDialog & FindWindow
Hi When we use FindWindow(NULL,_T("Window name")), some times this function will hang. to search a window with class name, we need to pass the class name of the window. The application is Dialog Based application. The class name of the window is Dialog. How to register a Dialog class name using AfxRegisterClass. so that i can find the window by class name using FindWindow(). thanx You could create your own special dialog window by registering a window class: http://msdn2.microsoft.com/en-us/library/kd8bhz16.aspx Tom "vijay" <vijaya.mohan@gmail.com> wrote in m...

Initialize an imagelist for use with a listview
Hi folks Hoping someone can help me out with a bit of a problem I=92m having at the moment that really just might tip me over the edge if I don=92t figure it out! Just kidding I won=92t be running for the water tower with a gun just yet. Anywho, I=92m running Excel 2003 SP3 with a userform containing an imagelist and a listview, with the imagelist holding my icons for use in the listview but I can=92t initialize the imagelist. Both controls are version 6 and I have reference to MSCOMCTL.OCX. I add my pictures to my imagelist but when I go into setup the custom property of the l...

Need invisible/shaded/highlighted cell
I'm thinking what I would like to do can *probably* be done in VBA, but I'd like to use the formula in the cell. If it can be done. I have three columns: DOW DATE BILL DTE --- -------- -------- Wed 02/01/06 02/03/06 Thu 02/02/06 02/06/06 Fri 02/03/06 02/07/06 Sat 02/04/06 02/06/06 Sun 02/05/06 02/07/06 Mon 02/06/06 02/08/06 Tue 02/07/06 02/09/06 Wed 02/08/06 02/10/06 . . . . The date col contains a formula to add 1 to the cell above. The day of week col uses the date from the date column. And the bill date col adds 4 days to the date col if it falls on a "Thu...

CDialog::DoModal()
Which function I should call to show my dialog *not* as modal? I'm writing plugin for one app, and my plugin got access violation when I try to show it as modal. I would like to try to show my dialog as modeless, but it is not perfect solution. Error occures here (dlgcode.cpp, CDialog::DoModal()) in VERIFY() : if (m_nFlags & WF_CONTINUEMODAL) { // enter modal loop DWORD dwFlags = MLF_SHOWONIDLE; if (GetStyle() & DS_NOIDLEMSG) dwFlags |= MLF_NOIDLEMSG; VERIFY(RunModalLoop(dwFlags) == m_nModalResult); } Petar, Use Create instead of DoM...

Invisible MS Money
This problem just "happened." When signing on to Money, I get a button on the taskbar, but cannot see the program. When I click on the Money Icon, it says the program is running...but I CAN'T SEE IT. It's worked fine for years...what happened? It probably is somewhere "off screen." Try this. When it's "running", hit Alt+Spacebar. Hit M. Use keyboard cursor arrow keys to move hither and yon. Hopefully you will find a piece of the window somewhere on the edge of the screen. Hit return. Drag it from there. "MJ In CO" <MJ In CO@discus...

DoModal -> DoModal -> DoDataExchange -> MessageBox and then a WM_CLOSE comes in.
So... What is the right way to do this. My application has the potential of having a few dialog boxes and/or a message box up when some external event causes the main window to receive a WM_CLOSE event. Now, from the users perspective they are in a modal state and I have read that you generally shouldn't programmatically do something that the user can't do themselves... but I do think this really is what I want to do here. DialogA.DoModal() is called... Then the user can press a button on DialogA that causes DialogB.DoModal() to be called next... Now the user enters a bad va...

Threads and DoModal
In the main dialog, I have 2 threads. When I click a button and do a DoModal(), another dialog appears just fine. My big problem is: when I close this modal dialog, my threads running on the main dialog are automatically closed, and I don't want that. Any suggestions are welcomed. Thx adrian.brezaie@gmail.com wrote: > In the main dialog, I have 2 threads. When I click a button and do a > DoModal(), another dialog appears just fine. My big problem is: when I > close this modal dialog, my threads running on the main dialog are > automatically closed, and I don't want that....

Object Initializers
Would someone please explain the execution paths in the following code? In particular, what is the difference between instantiating the ContactManagerModel class in the Object Initializer, as opposed to instantiating it in the constructor body? Also, is this an example of dependency injection? public class ContactController : Controller { IContactManagerModel _model; public ContactController() : this(new ContactManagerModel()) { } public ContactController(IContactManagerModel model) { _model = model; ...

initialization of microsoft crm ui failed ?? client 3.0 office 2003
I am having one user that is having a major problem of some sort. I installed CRM 3.0 on his laptop(tried both remote and networked installs). When we start Outlook 2003, we are getting a pop up "an error occured loading crm functionality, try restarting outlook" of course, i tried to uninstall, removed his mail profile, all the usual troubleshooting basics. I am also seeing an eventid 16930 source mscrmaddin Any help would be great, as we are getting ready to roll this out within the next 14 days. Rodney Rodney, The CRMaddin wouldn't happen to be in the disabled addins...

video chat - Lifecam VX-3000
When I run WLM, and I ask for a video call, I can see and hear the other person, but they can't see or hear me. If the other person initiates a video call then everything works fine. I am using Windows Vista 64 bit everything is updated - all drivers for video and sound card etc. etc. I am using the latest Windows Live Messenger (WLM) version 2009 I am using the Lifecam VX-3000 All drivers for all programs and camera are up to date I have run the audio video setup successfully - video AND webcam appear and work perfectly I have turned off my firewall and virus/spam pr...