正文: 添加一个按钮,(用于弹出msgbox),一个定时器,用于修改大小 以下是代码: —————————————————————————— Private Declare Function GetDesktopWindow Lib "user32" () As Long Private Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal wCmd As Long) As Long Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName 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 Const GW_CHILD = 5 Private Const GW_HWNDNEXT = 2 Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long Private Declare Function IsWindow Lib "user32" (ByVal hwnd As Long) As Long Function Findwindow2(ByVal str2 As String) As Long 'VB findwindow 之标题模糊搜索 On Error Resume Next Dim lngDeskTopHandle As Long Dim lngHand As Long Dim strName As String * 255 Dim A As Long lngDeskTopHandle = GetDesktopWindow() lngHand = GetWindow(lngDeskTopHandle, GW_CHILD) Do While lngHand <> 0 GetWindowText lngHand, strName, Len(strName) lngHand = GetWindow(lngHand, GW_HWNDNEXT) If Left$(strName, 1) <> vbNullChar Then If InStr(strName, str2) Then Findwindow2 = FindWindow(vbNullString, CStr(strName)) End If End If Loop End Function Private Sub Command1_Click() Timer1.Enabled = True MsgBox "测试", 0, "标题xx" Timer1.Enabled = False '特别注意,这里必需给msgbox设置一个独一无二的标题 End Sub Private Sub Form_Load() Timer1.Enabled = False Timer1.Interval = 100 End Sub Private Sub Timer1_Timer() On Error Resume Next If IsWindow(Findwindow2("标题xx")) <> "" Then SetWindowPos Findwindow2("标题xx"), -1, 400, 100, Me.Width \ 15, Me.Height \ 15, &H400 End If End Sub