Re: To MsgBox, or not to MsgBox

From: J French (erewhon_at_nowhere.com)
Date: 03/27/04


Date: Sat, 27 Mar 2004 12:10:04 +0000 (UTC)

On Sat, 27 Mar 2004 10:32:45 -0000, "Tony Proctor"
<tony_proctor@aimtechnology_NOSPAM.com> wrote:

>Does anyone know of a test that will indicate whether a MsgBox call is
>legal, i.e. whether the current process/thread has access to a UI
>
>Some situations (e.g. services, IIS, silent installs over a reboot) will
>result in a hang if MsgBox is called. I accept the argument that such code
>should not use MsgBox, but this is a common component and it's not actually
>my "call".

In the cases you are thinking of, by 'hang' do you mean stick an
semi-ownerless MessageBox on the screen, or something nastier ?

Even a Console Mode App can generate a MessageBox

This silly little demo might give you some ideas :-

Sub Main()
    App.TaskVisible = False
    If App.UnattendedApp Then
       MsgBox "Wha Hay" + Str$(App.TaskVisible)
    End If
End Sub



Relevant Pages

  • Re: To MsgBox, or not to MsgBox
    ... MsgBox from a Windows Services, or from within an IIS component, and you'll ... >>result in a hang if MsgBox is called. ... > semi-ownerless MessageBox on the screen, ... > Sub Main ...
    (microsoft.public.vb.general.discussion)
  • Problems creating an exchange mailbox and setting permissions
    ... Exchange Mailbox the rest is working fine. ... sub Window_Onload ... msgbox "Please enter the users First Name" ... msgbox "Please select the Account Type" ...
    (microsoft.public.scripting.vbscript)
  • Re: Unable to add "X-Header" to a mail that is being sent...
    ... MsgBox "Initialize Event Handlers successful" ... Private Sub Command1_Click ... It shows howw to change the "From" header, ... ChangeHeader() from my ItemSend event handler, ...
    (microsoft.public.outlook.program_vba)
  • Re: Unable to add "X-Header" to a mail that is being sent...
    ... MsgBox "Initialize Event Handlers successful" ... Private Sub Command1_Click ... It shows howw to change the "From" header, but it is equally applicable to ... ChangeHeader() from my ItemSend event handler, ...
    (microsoft.public.outlook.program_vba)
  • Re: Protection & SpellCheck in Merged Forms
    ... If the message boxes are not appearing then the MsgBox statements are almost ... putting MsgBox statements at the beginning and end of that Sub ... i.e. use a macro to unprotect the document, spell check, then reprotect, ...
    (microsoft.public.word.mailmerge.fields)