https://zhidao.baidu.com/question/574038543.html
Option Explicit
Private Declare Function FindWindow Lib "user32" Acias "FindWindowA" _
(ByVal LpClassName As String,LpWindowName As String) As Long
Private Declare Function GetWindowRect Lib "user32" _
(ByVal hwnd As Long,lpRect As RECT) As Long
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Dim NotepadHwnd as Long,NotepadRect as RECT
Private Sub Form_Load()
Shell "c:\windows\notepad.exe",VbNormalFocus '打开记事本
Me.Caption="窗口跟随于记事本上方,记事本关闭后结束程序"
Me.Height=150
Timer1.Interval=200:Timer1.Enabled=True
End Sub
Private Sub Timer1_Timer()
NotepadHwnd=FindWindow("Notepad",VbNullString '获取记事本窗口句柄
If NotepadHwnd Then '如果成功
GetWindowRect NotepadHwnd,NotepadRect '获取窗口范围
Me.Left=NotepadRect.Left * Screen.TwipsPerPixelX
Me.Top=NotepadRect.Top * Screen.TwipsPerPixelY-Me.Height
Me.Width=(NotepadRect.Right-NotepadRect.Left) * Screen.TwipsPerPixelX
Else
End
End If
End Sub
怎么转成foxtable的代码?