Results 1 to 9 of 9

Thread: [VERY MUCH UNRESOLVED, THANK YOU iPRANK] test

  1. #1

    Thread Starter
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    [VERY MUCH UNRESOLVED, THANK YOU iPRANK] test


  2. #2

    Thread Starter
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Re: test

    more pics
    Attached Images Attached Images      

  3. #3
    PoorPoster iPrank's Avatar
    Join Date
    Oct 2005
    Location
    In a black hole
    Posts
    2,729
    Usefull VBF Threads/Posts I Found . My flickr page .
    "I love being married. It's so great to find that one special person you want to annoy for the rest of your life." - Rita Rudner


  4. #4
    PoorPoster iPrank's Avatar
    Join Date
    Oct 2005
    Location
    In a black hole
    Posts
    2,729

    Re: test

    Quote Originally Posted by Sahuja Ali
    ********s
    Shouldn't it be, J*****s

    Edit: You think you can get away with it ?
    Usefull VBF Threads/Posts I Found . My flickr page .
    "I love being married. It's so great to find that one special person you want to annoy for the rest of your life." - Rita Rudner


  5. #5

    Thread Starter
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Change MsgBox button's text without subclassing

    In module:
    VB Code:
    1. Option Explicit
    2.  
    3. Private Declare Function SetTimer Lib "user32" _
    4.     (ByVal hwnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, _
    5.     ByVal lpTimerFunc As Long) As Long
    6.  
    7. Private Declare Function KillTimer Lib "user32" (ByVal hwnd As Long, _
    8.     ByVal nIDEvent As Long) As Long
    9.  
    10. Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
    11.     (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
    12.  
    13. Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" _
    14.     (ByVal hwndParent As Long, ByVal hwndChildAfter As Long, _
    15.     ByVal lpszClass As String, ByVal lpszWindow As String) As Long
    16. Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" _
    17.     (ByVal hwnd As Long, ByVal lpString As String) As Long
    18.  
    19. Private Const NV_MSGBOX As Long = &H5000&
    20. Private sBut(2) As String, sTit As String
    21.  
    22. Public Function CustMsgBox(ByVal F As Form, ByVal sText As String, ByVal sTitle As String, _
    23.                            ByVal Picture As VbMsgBoxStyle, _
    24.                            ByVal sButton1 As String, _
    25.                            Optional ByVal sButton2 As String, _
    26.                            Optional ByVal sButton3 As String) As Long
    27.     Dim N As Long, lBut As Long, lRet As Long
    28.     sTit = sTitle
    29.     sBut(0) = sButton1: sBut(1) = sButton2: sBut(2) = sButton3
    30.     SetTimer F.hwnd, NV_MSGBOX, 10, AddressOf ChangeButtons
    31.     For N = 0 To 2
    32.         If Len(sBut(N)) Then lBut = lBut + 1
    33.     Next N
    34.     lRet = MsgBox(sText, Picture Or (lBut - 1), sTitle)
    35.     If lRet > 2 Then lRet = lRet - 2
    36.     CustMsgBox = lRet
    37. End Function
    38.  
    39. Private Sub ChangeButtons(ByVal plngHandle As Long, ByVal uMsg As Long, _
    40.                           ByVal plngEventId As Long, ByVal dwTime As Long)
    41.     Dim lhWnd As Long, lhBut As Long, lhTemp As Long, N As Long
    42.    
    43.     lhWnd = FindWindow("#32770", sTit)
    44.     For N = 0 To 2
    45.         If Len(sBut(N)) Then
    46.             Do
    47.                 lhTemp = FindWindowEx(lhWnd, lhBut, "Button", vbNullString)
    48.             Loop While lhTemp = lhBut
    49.             lhBut = lhTemp
    50.             SetWindowText lhBut, sBut(N)
    51.         End If
    52.     Next N
    53.     KillTimer plngHandle, plngEventId
    54. End Sub
    You then call it like this:
    VB Code:
    1. Private Sub Command1_Click()
    2.     Dim lRet As Long
    3.     lRet = CustMsgBox(Me, "Click a button", "MsgBox Title", vbExclamation, "button1", "button2", "button3")
    4.     ' lRet is the number of the button pressed, either button 1, 2 or 3
    5. End Sub

  6. #6

    Thread Starter
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Re: test

    more
    Attached Images Attached Images   

  7. #7
    PoorPoster iPrank's Avatar
    Join Date
    Oct 2005
    Location
    In a black hole
    Posts
    2,729

    Re: test

    You,
    Mark Thread Resolved
    ....
    Last edited by iPrank; Jan 5th, 2007 at 12:14 PM.
    Usefull VBF Threads/Posts I Found . My flickr page .
    "I love being married. It's so great to find that one special person you want to annoy for the rest of your life." - Rita Rudner


  8. #8

    Thread Starter
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Re: [VERY MUCH UNRESOLVED, THANK YOU iPRANK] test

    i fly in the face of your suggestion!

  9. #9
    Banned timeshifter's Avatar
    Join Date
    Mar 2004
    Location
    at my desk
    Posts
    2,465

    Re: [VERY MUCH UNRESOLVED, THANK YOU iPRANK] test

    Can I add a pic?
    Last edited by timeshifter; Mar 23rd, 2007 at 09:33 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width