Making the Disk Defragmenter a Modal dialog
-
Hey I am opening the Disk Defragmenter from inside my C++ WIN32 app using the ShellExecuteEx function. Now i want to make sure that the Disk Defragmenter is a modal dialog, so that User is not able to click any part of my app. I set one window to EnableWindow(FALSE), but there are other frame windows which can be clicked by User and then the Disk Defragmenter will go hiding or to back ground. Is there one generic way of making the Disk Defragmenter a modal window so that nothing else on the back ground can be clicked? From the ShellExecuteEx function, i can get the process handle to Disk Defragmenter. Thanks in advance.
-
Hey I am opening the Disk Defragmenter from inside my C++ WIN32 app using the ShellExecuteEx function. Now i want to make sure that the Disk Defragmenter is a modal dialog, so that User is not able to click any part of my app. I set one window to EnableWindow(FALSE), but there are other frame windows which can be clicked by User and then the Disk Defragmenter will go hiding or to back ground. Is there one generic way of making the Disk Defragmenter a modal window so that nothing else on the back ground can be clicked? From the ShellExecuteEx function, i can get the process handle to Disk Defragmenter. Thanks in advance.
You can try blocking using the following
WaitForSingleObject(m_hProcess, INFINITE); // m_hProcess is the DD process handle
This won't make DD modal, it will just block your app until DD is finished. :)
Chris Meech I am Canadian. [heard in a local bar] In theory there is no difference between theory and practice. In practice there is. [Yogi Berra] posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]
-
Hey I am opening the Disk Defragmenter from inside my C++ WIN32 app using the ShellExecuteEx function. Now i want to make sure that the Disk Defragmenter is a modal dialog, so that User is not able to click any part of my app. I set one window to EnableWindow(FALSE), but there are other frame windows which can be clicked by User and then the Disk Defragmenter will go hiding or to back ground. Is there one generic way of making the Disk Defragmenter a modal window so that nothing else on the back ground can be clicked? From the ShellExecuteEx function, i can get the process handle to Disk Defragmenter. Thanks in advance.
I think I know how to do so in .NET, and I assume unmanaged code could do similar things: - give your app a modal form F, and make it sufficiently large to hold DD's main form; - let that form F call DD and set DD's main form's parent to F. I assume this function[^] does that. Now DD itself should behave as a modal dialog to your app. I have a managed app (C#) that does similar things with e.g. MS Word. :)
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.