one instance of my application

  • Thread starter Thread starter ucasesoftware
  • Start date Start date
This only works if you are loading a Windows Form, not a Module.



Bobbo



If NoLoad(Me) then end



Private Declare Auto Function FindWindow Lib "user32.dll" _

(ByVal lpClassName As String, ByVal lpWindowName As String) As
IntPtr



Private Declare Auto Function ShowWindow Lib "user32.dll" _

(ByVal hWnd As IntPtr, ByVal nCmdShow As Integer) As Boolean



Public Function NoLoad(ByRef sender As System.Object) As Boolean

If UBound(System.Diagnostics.Process.GetProcessesByName( _

System.Diagnostics.Process.GetCurrentProcess.ProcessName)) > 0 Then

Const SW_RESTORE As Integer = 9

Dim SearchText As String = sender.Text

sender.Text = sender.Text & "X"

ShowWindow(FindWindow(Nothing, SearchText), SW_RESTORE)

sender.Text = SearchText

Return True

Else

Return False

End If

End Function

___________________________________________________________
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top