|
-
Jan 22nd, 2003, 03:11 PM
#1
Thread Starter
Frenzied Member
OK, set forground window problem?
Hey,
OK, if there is already a copy of my application open, i wanna bring that copy to the front,
and then unload the new copy.
Now, it is making the screen flicker, but nothing other then that happens...
should this work?
My app's form caption is "[" & webbrowser PageTitle & "] - The Walks Chat"
so is there something im doing wrong with this, since it dont work proper?
VB Code:
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As Long) As Long
Private Sub Form_Load()
If App.PrevInstance = True Then GoTo PrevInst:
' Some code here
Exit Sub
PrevInst:
' Theres a previous open copy of the application,
' so lets bring that copy to the front, and unload this copy
Dim WinHan As Long
WinHan = FindWindow(vbNullString, " - The Walks Chat")
WinHan = SetForegroundWindow(WinHan)
Unload Me
Exit Sub
' More Sub's ETC
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|