Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Public Declare Function SetForegroundWindow& Lib "user32" (ByVal hwnd As Long)
then
Public Function ShowWindow(ByVal sWindowName As String)
Dim lWindowHandle As Long
lWindowHandle = FindWindow(vbNullString, Trim(sWindowName))
If lWindowHandle <> 0 Then
SetForegroundWindow (lWindowHandle)
Else
' Error Message
End If
End Function
sWindow name = the title bar of the programs window to be pulled forward.
It works, but inconsistently.
http://www.tek-tips.com/viewthread.cfm?qid=31084&page=42
沒有留言:
張貼留言