October 2009
M T W T F S S
    Nov »
 1234
567891011
12131415161718
19202122232425
262728293031  

Archives

Categories

  • [+]ASP.NET (7) 
  • [+]C# (87) 
  • [+]C++ (13) 
  • [+]Delphi (20) 
  • [+]JavaScript (24) 
  • [+]Regular Expressions (7) 
  • [+]SQL (13) 
  • [—]VB (100) 
  • [+]VB.NET (4) 

Online

Users: 6 Guests
  • Loading...


    Loading...

    Login






    Register | Lost password?

    Register





    A password will be mailed to you.
    Log in | Lost password?

    Retrieve password





    A confirmation mail will be sent to your e-mail address.
    Log in | Register
  • Forces mouse pointer to default and calls VB’s MsgBox function

    '-----------------------------------------------------------
    ' FUNCTION: MsgFunc
    '
    ' Forces mouse pointer to default and calls VB's MsgBox
    ' function.  See also MsgError.
    '
    ' IN: [strMsg] - message to display
    '     [intFlags] - MsgBox function type flags
    '     [strCaption] - caption to use for message box
    ' Returns: Result of MsgBox function
    '-----------------------------------------------------------
    '
    Function MsgFunc(ByVal strMsg As String, ByVal intFlags As Integer, ByVal strCaption As String) As Integer
        Dim intOldPointer As Integer
    
        intOldPointer = Screen.MousePointer
        If gfNoUserInput Then
            MsgFunc = GetDefMsgBoxButton(intFlags)
        Else
            Screen.MousePointer = gintMOUSE_DEFAULT
            MsgFunc = MsgBox(strMsg, intFlags, strCaption)
            Screen.MousePointer = intOldPointer
        End If
    End Function
    
    '-----------------------------------------------------------
    ' FUNCTION: GetDefMsgBoxButton
    ' Decode the flags passed to the MsgBox function to
    ' determine what the default button is.  Use this
    ' for silent installs.
    '
    ' IN: [intFlags] - Flags passed to MsgBox
    '
    ' Returns: VB defined number for button
    '               vbOK        1   OK button pressed.
    '               vbCancel    2   Cancel button pressed.
    '               vbAbort     3   Abort button pressed.
    '               vbRetry     4   Retry button pressed.
    '               vbIgnore    5   Ignore button pressed.
    '               vbYes       6   Yes button pressed.
    '               vbNo        7   No button pressed.
    '-----------------------------------------------------------
    '
    Function GetDefMsgBoxButton(intFlags) As Integer
        '
        ' First determine the ordinal of the default
        ' button on the message box.
        '
        Dim intButtonNum As Integer
        Dim intDefButton As Integer
    
        If (intFlags And vbDefaultButton2) = vbDefaultButton2 Then
            intButtonNum = 2
        ElseIf (intFlags And vbDefaultButton3) = vbDefaultButton3 Then
            intButtonNum = 3
        Else
            intButtonNum = 1
        End If
        '
        ' Now determine the type of message box we are dealing
        ' with and return the default button.
        '
        If (intFlags And vbRetryCancel) = vbRetryCancel Then
            intDefButton = IIf(intButtonNum = 1, vbRetry, vbCancel)
        ElseIf (intFlags And vbYesNoCancel) = vbYesNoCancel Then
            Select Case intButtonNum
                Case 1
                    intDefButton = vbYes
                Case 2
                    intDefButton = vbNo
                Case 3
                    intDefButton = vbCancel
                'End Case
            End Select
        ElseIf (intFlags And vbOKCancel) = vbOKCancel Then
            intDefButton = IIf(intButtonNum = 1, vbOK, vbCancel)
        ElseIf (intFlags And vbAbortRetryIgnore) = vbAbortRetryIgnore Then
            Select Case intButtonNum
                Case 1
                    intDefButton = vbAbort
                Case 2
                    intDefButton = vbRetry
                Case 3
                    intDefButton = vbIgnore
                'End Case
            End Select
        ElseIf (intFlags And vbYesNo) = vbYesNo Then
            intDefButton = IIf(intButtonNum = 1, vbYes, vbNo)
        Else
            intDefButton = vbOK
        End If
    
        GetDefMsgBoxButton = intDefButton
    
    End Function
    
    Share: These icons link to social bookmarking sites where readers can share and discover new web pages.
    • Digg
    • del.icio.us
    • Bloglines
    • Facebook
    • Google Bookmarks
    • LinkedIn
    • Technorati
    • TwitThis
    • Webnews

    Leave a Reply

     

     

     

    You can use these HTML tags

    <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <font color="" face="" size=""> <span style="">

    Spam Protection by WP-SpamFree Plugin