From: phil hunt on
I have an application that pop up a form (vbModal) asking for password in
order to proceed. It pops up after a period of idling. It works prettty
well.
The hassle comes when there is a MsgBox popping up and the user does not
respond, then the modal form pop up. Now I got 2 modal things, and you
cannot click anything to move on. I have been sidestepping the problem by
disabling the modal form whenever I show msgbox. I am wondering if there is
a better way to do this.


From: Nobody on
"phil hunt" <a(a)abc.com> wrote in message
news:i43f9i$k9b$1(a)speranza.aioe.org...
>I have an application that pop up a form (vbModal) asking for password in
>order to proceed. It pops up after a period of idling. It works prettty
>well.
> The hassle comes when there is a MsgBox popping up and the user does not
> respond, then the modal form pop up. Now I got 2 modal things, and you
> cannot click anything to move on. I have been sidestepping the problem by
> disabling the modal form whenever I show msgbox. I am wondering if there
> is a better way to do this.

Do you have any minimized windows, even hidden background ones? Try calling
this routine before showing the password form and MsgBox:

Public Declare Sub OutputDebugString Lib "kernel32" Alias _
"OutputDebugStringA" (ByVal lpOutputString As String)

Public Sub PrintAllMinimizedForms()
Dim frm As Form

For Each frm In Forms
If frm.WindowState = vbMinimized Then
DebugPrint "PrintAllMinimizedForms: " & frm.Name
End If
Next

End Sub

Public Sub DebugPrint(ByRef s As String)
Debug.Print s
OutputDebugString s & vbCrLf
End Sub

Use the following software to view the output when running in the EXE:

DebugView:
http://technet.microsoft.com/en-us/sysinternals/bb896647.aspx

One similar problem I had is when showing a prompt, it would be out of
focus. It turned out that I had a background form that is hidden and
minimized. The form was minimized to save memory. Just by making it
minimized, my app Mem Usage in Task Manager stays at 4 MB, instead of 10 MB,
even when the form is hidden in both cases. The Form was used as a Winsock
host. If I don't minimize it, then the problem disappears. Eventually I had
to use ForceForegroundWindow() function, but I don't like this solution as
MS would probably block it some day:

http://vb.mvps.org/samples/ForceFore/

If you had no luck, can you post code that duplicates the problem?


From: phil hunt on
The codes are intertwined, that's why I am asking if anyone had other
option.
Just wondering if there is way to show a "free-flowing " msgbox.


"Nobody" <nobody(a)nobody.com> wrote in message
news:i43ift$ttu$1(a)speranza.aioe.org...
> "phil hunt" <a(a)abc.com> wrote in message
> news:i43f9i$k9b$1(a)speranza.aioe.org...
>>I have an application that pop up a form (vbModal) asking for password in
>>order to proceed. It pops up after a period of idling. It works prettty
>>well.
>> The hassle comes when there is a MsgBox popping up and the user does not
>> respond, then the modal form pop up. Now I got 2 modal things, and you
>> cannot click anything to move on. I have been sidestepping the problem by
>> disabling the modal form whenever I show msgbox. I am wondering if there
>> is a better way to do this.
>
> Do you have any minimized windows, even hidden background ones? Try
> calling this routine before showing the password form and MsgBox:
>
> Public Declare Sub OutputDebugString Lib "kernel32" Alias _
> "OutputDebugStringA" (ByVal lpOutputString As String)
>
> Public Sub PrintAllMinimizedForms()
> Dim frm As Form
>
> For Each frm In Forms
> If frm.WindowState = vbMinimized Then
> DebugPrint "PrintAllMinimizedForms: " & frm.Name
> End If
> Next
>
> End Sub
>
> Public Sub DebugPrint(ByRef s As String)
> Debug.Print s
> OutputDebugString s & vbCrLf
> End Sub
>
> Use the following software to view the output when running in the EXE:
>
> DebugView:
> http://technet.microsoft.com/en-us/sysinternals/bb896647.aspx
>
> One similar problem I had is when showing a prompt, it would be out of
> focus. It turned out that I had a background form that is hidden and
> minimized. The form was minimized to save memory. Just by making it
> minimized, my app Mem Usage in Task Manager stays at 4 MB, instead of 10
> MB, even when the form is hidden in both cases. The Form was used as a
> Winsock host. If I don't minimize it, then the problem disappears.
> Eventually I had to use ForceForegroundWindow() function, but I don't like
> this solution as MS would probably block it some day:
>
> http://vb.mvps.org/samples/ForceFore/
>
> If you had no luck, can you post code that duplicates the problem?
>
>


From: ralph on
On Fri, 13 Aug 2010 08:54:14 -0400, "phil hunt" <a(a)abc.com> wrote:

>I have an application that pop up a form (vbModal) asking for password in
>order to proceed. It pops up after a period of idling. It works prettty
>well.
>The hassle comes when there is a MsgBox popping up and the user does not
>respond, then the modal form pop up. Now I got 2 modal things, and you
>cannot click anything to move on. I have been sidestepping the problem by
>disabling the modal form whenever I show msgbox. I am wondering if there is
>a better way to do this.
>

You might replace your MessageBox with a custom Form that
automatically closes.
http://www.freevbcode.com/ShowCode.asp?ID=8597

Not sure where or why these other messages are coming up, but you
might also simply redirect them to the popup password Form and display
them there.

-ralph
From: Kevin Provance on

"phil hunt" <a(a)abc.com> wrote in message
news:i43ioa$uo9$1(a)speranza.aioe.org...
: The codes are intertwined, that's why I am asking if anyone had other
: option.
: Just wondering if there is way to show a "free-flowing " msgbox.

Roll your own and call it like this:

frmMsgbox.Show

Do While frmMsgbox.Visible
DoEvents
Loop

Unload frmMsgbox


 |  Next  |  Last
Pages: 1 2
Prev: DCOM Error
Next: ActiveX EXE SingleUse Vs MultiUse