Recently a colegue of mine needed to know how he can determine whether his application is already running in the machine at application start.
Using this post I am going to share the solution with you all, showing how you can determine whether your application is already running in the computer. By detecting this either you can stop starting of the second instance of the application and activate the already running application for the user or you can attempt to close the earlier application and start the new one. If you does not check this then multiple applications might start and the user might complain about the application performance. Also this may cause problems occurring from locked resources.
* Visual Basic (VB)
Using VB you can easily check this by using the App object.
------------------------------------------------------------
If App.PrevInstance = True Then
MsgBox("The program '" & App.EXEName & "'is already running. Please use the running application.")
End
End If
------------------------------------------------------------
* Visual Basic .NET (VB.NET)
Using VB.NET you can do this by using Diagnostics.Process class.
------------------------------------------------------------
If Diagnostics.Process.GetProcessesByName(Diagnostics.Process.GetCurrentProcess().ProcessName).Length > 1 Then
Application.Exit()
End If
------------------------------------------------------------
Showing posts with label VB 6. Show all posts
Showing posts with label VB 6. Show all posts
Tuesday, December 04, 2007
Friday, September 29, 2006
Interop Forms Toolkit 1.0
Are you in Visual Basic 6 (VB 6) and would like to join the .net 2.0 fun? But is your application size stopping you?
Now with the Interop Forms Toolkit 1.0 you can run forms that you have created with .net hand in hand with vb 6 forms in a VB 6 process.
Big Picture? You don't have to convert your entire application to .net but you can partially convert your application to .net or the new forms that you plan to create can be done in .net and used in your VB6 application.
http://msdn2.microsoft.com/en-us/vbasic/aa701259.aspx
Enjoy.
Are you in Visual Basic 6 (VB 6) and would like to join the .net 2.0 fun? But is your application size stopping you?
Now with the Interop Forms Toolkit 1.0 you can run forms that you have created with .net hand in hand with vb 6 forms in a VB 6 process.
Big Picture? You don't have to convert your entire application to .net but you can partially convert your application to .net or the new forms that you plan to create can be done in .net and used in your VB6 application.
http://msdn2.microsoft.com/en-us/vbasic/aa701259.aspx
Enjoy.
Subscribe to:
Posts (Atom)
-
If you are wondering a way to change the column header appearing in the .Net GridView control in run time then this post will help you to ge...
-
Last week I spent few hours to figure out why Samsung Galaxy S2 was not connecting to Samsung Kies through USB cable. I could browse phone c...