Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String) As Long
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Sub Form_Load()
Form1.AutoRedraw = True : Form1.Show
Timer1.Enabled = True : Timer1.Interval = 1
MsgBox "123", vbOKCancel, "testmsgbox"
End Sub
Private Sub Timer1_Timer()
Dim r As Long, r1 As Long
r = FindWindow(vbNullString, "testmsgbox")
If r <> 0 Then
r1 = FindWindowEx(r, ByVal 0&, "Button", "確定")
If r1 <> 0 Then SetWindowText r1, "阿戊的Sure"
r1 = FindWindowEx(r, ByVal 0&, "Button", "取消")
If r1 <> 0 Then SetWindowText r1, "阿戊的Cancel"
Timer1.Enabled = False
End If
End Sub