473,416 Members | 1,683 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,416 software developers and data experts.

one instance of my application

how to have only one instance of my application ?

Nov 23 '05 #1
3 1004

use a mutex

see:
http://groups.google.nl/group/micros...9b5ad8b16ab96e
regards

Michel Posseth [MCP]
"ucasesoftware" <uc***********@hotmail.fr> schreef in bericht
news:11*********************@g49g2000cwa.googlegro ups.com...
how to have only one instance of my application ?

Nov 23 '05 #2
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.GetProcessesByNa me( _

System.Diagnostics.Process.GetCurrentProcess.Proce ssName)) > 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

__________________________________________________ _________
"ucasesoftware" <uc***********@hotmail.fr> wrote in message
news:11*********************@g49g2000cwa.googlegro ups.com...
how to have only one instance of my application ?

Nov 23 '05 #3
"ucasesoftware" <uc***********@hotmail.fr> schrieb:
how to have only one instance of my application ?


<URL:http://dotnet.mvps.org/dotnet/code/application/#SingleInstance>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Nov 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: johnmann56 | last post by:
Hello. I have written a simple image viewer application using C# .NET. It only needs to display one image at a time. When a different program, in C, running on the same machine, does a...
2
by: Mike | last post by:
Greetings, Having a major problem here. running version 8.2 on win2003 server. The problem I am having is backing up a database seems to get to the last part of the backup and then fails. This...
6
by: Dmitry Karneyev | last post by:
Hi! I guess this question have been asked a lot of times, but please be tolerant and if you have any ideas share it. The question is: how to make availibale only one instance of application and...
18
by: Steve Barnett | last post by:
I want to ensure that there is only ever one instance of my app running on a single PC at any time. I understand that I can achieve this by using a mutex and, if I can't take ownership of the...
3
by: Adam | last post by:
We have a web site that uses .vb for the web pages and .cs for a class module. We are getting the error in .NET 2.0 and VS 2005 beta 2. It does work with .NET 1.1. When trying to access a page...
2
by: Mesan | last post by:
Hello everyone, Thanks to many useful posts in this newsgroup and others, I've been able to come very close to something I've been wanting to do for a very long time. I've figured out how to...
1
by: vijay.db | last post by:
Hi Team, Very serious problem with my DB2 V8.1 Fixpack 6 running in AIX 5.1 machine. Every one hour my DB2 instance processes are killed and it's going down. Several trap files are generated in...
2
by: pamela fluente | last post by:
I have an application running. A file type is registered with this application. When the user click on a file of such type a new instance of the application is loaded with command line (file name)....
4
by: Dave | last post by:
I have a global.asax file with Application_Start defined and create some static data there and in another module used in the asp.net application and I realize that static data is shared amongst...
4
by: James R. Davis | last post by:
.... due to failure in receiving user's application data path. Okay, this simply cannot be a problem unique to me and I assume there is a straight forward solution, but it escapes me. I have...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.