Dim FileHwnd As Long
FileHwnd = FindWindow(vbNullString, "form2")
Debug.Print "Findwindow ->" & FileHwnd
Dim pid As Long
GetWindowThreadProcessId FileHwnd, pid
Debug.Print "PID -> " & pid
Dim hProcess As Long
hProcess = OpenProcess(PROCESS_ALL_ACCESS, 0, pid)
Debug.Print "OPEN process ->" & hProcess
Dim FilePath As String
FilePath = Space(256)
Dim FlagPath As Long
FlagPath = GetModuleFileName(hProcess, FilePath, 255)
Debug.Print "FlagPath -> " & FlagPath
MsgBox FilePath
这样的写法如何???