i need to show the running application if it is already running.For this i used
app.PrevInstance and used showwindow.Show widow never worked to me.
pls help me abt.
Thankyou
Gopal
Printable View
i need to show the running application if it is already running.For this i used
app.PrevInstance and used showwindow.Show widow never worked to me.
pls help me abt.
Thankyou
Gopal
Put this code in a Form
Code:Private Declare Function BringWindowToTop Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Sub Command1_Click()
If App.PrevInstance = True Then
Let w& = FindWindow(vbNullString, "Form1") ' Replace Form1 with the caption of the App.
BringWindowToTop w&
End If
End Sub
VB Code:
Sub Main() If App.PrevInstance Then AppActivate "[i]Title of main form[/i]" End Else frmMain.Show End If End Sub
:)