'Code By 魑魅魍魉
'mailto:DemonStudio@hotmail.com
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function MessageBox Lib "user32" Alias "MessageBoxA" (ByVal hwnd As Long, ByVal lpText As String, ByVal lpCaption As String, ByVal wType As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) 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 Const WM_SETFONT = &H30
Private Const WM_GETFONT = &H31
Private Const WM_KILLFOCUS = &H8
Private Sub Command1_Click()
Timer1.Enabled = True
MessageBox Me.hwnd, "我爱你", "bbbb", 0
End Sub
Private Sub Form_Load()
Timer1.Interval = 100
Timer1.Enabled = False
End Sub
Private Sub Timer1_Timer()
Dim a, b As Long
a = FindWindowEx(FindWindow("#32770", "bbbb"), 0, "button", "确定")
b = FindWindowEx(FindWindow("#32770", "bbbb"), 0, "static", "我爱你") '""是图标STATIC的窗口名
If a <> 0 Then
SetWindowLong a, -16, &H50008000
SendMessage a, &H8, 0, 0
Text1 = SendMessage(Text1.hwnd, &H31, 0, 0)
SendMessage a, &H30, CLng(Text1), 0
SendMessage b, &H30, CLng(Text1), 0
End If
Timer1.Enabled = False
End Sub
效果如下: