Click to See Complete Forum and Search --> : Please help: MDI / progress bar problem


Sharathms
June 29th, 2001, 03:07 AM
Hi all,
i am working on a project which is an mdi with some (atleast 10) child forms.
i need to show a progress bar dialog (with two progress bars, one total and one current and some labels and a cancel button)
this progress bar is used by atleast 6 methods in the project, which have code to cancel the operation if the user presses cancel button
in the progress dialog [all of them uses DoEvents])

The problem is, the progress bar is never a modal form. so even if the progress bar is first in the z-order,
i can still click all the menu items and toolbar buttons which creates a mess!.
how can i avoid this problem.
[one restriction is i cannot progress dialog with frmProgress.Show VbModal, frmMain]
this is the last bit in my project. please help me how to solve this.
regars,
Sharath

Clearcode
June 29th, 2001, 03:19 AM
There are three parts to doing this:
First set your dialog window to be the topmost window when you activate it

private Sub Form_Activate()
me.ZOrder vbBringToFront
End Sub




Second make your dialog box capture the mouse so that you cannot click on the other windows:

'\\ Declarations....
private Declare Function SetCaptureApi Lib "user32" Alias "SetCapture" (byval hwnd as Long) as Long
Dim hOldCapture as Long

private Sub Form_Load()
hOldCapture = SetCaptureApi(me.hwnd)
End Sub




And finally prevent the CTRL+TAB type shortcut keys from switching windows. I think this needs Subclassing but we'll see if there's a simpler way first.

HTH,
Duncan

-------------------------------------------------
Ex. Datis: Duncan Jones
Merrion Computing Ltd
http://www.merrioncomputing.com