Click here to Skip to main content
15,885,309 members
Home / Discussions / C#
   

C#

 
Answerwhat the ascii figure should look like... Pin
misterbear29-Jan-04 21:55
misterbear29-Jan-04 21:55 
GeneralRe: what the ascii figure should look like... Pin
Heath Stewart30-Jan-04 4:31
protectorHeath Stewart30-Jan-04 4:31 
GeneralRe: what the ascii figure should look like... Pin
misterbear31-Jan-04 11:30
misterbear31-Jan-04 11:30 
GeneralRegular Expression Pin
Member 33502229-Jan-04 20:36
Member 33502229-Jan-04 20:36 
GeneralRe: Regular Expression Pin
Kentamanos29-Jan-04 21:32
Kentamanos29-Jan-04 21:32 
GeneralRe: Regular Expression Pin
Heath Stewart30-Jan-04 4:03
protectorHeath Stewart30-Jan-04 4:03 
Generalprevent re-opening of application Pin
azusakt29-Jan-04 19:46
azusakt29-Jan-04 19:46 
GeneralRe: prevent re-opening of application Pin
Kentamanos29-Jan-04 20:03
Kentamanos29-Jan-04 20:03 
The best method is probably creating a "named" Mutex (in the System.Threading namespace). When your application first comes up, you try to claim the named Mutex, which is system-wide. If you can't claim it, another instance of the application is already running. The only thing you really have to do is make the name of the Mutex very unique. A good way to create something with a very unique name is to use a GUID.

So you do something like set a string up to be the Mutex name you want, like:

string mutexName = "...";

where you use a GUID in place of the ...

Then do something like:

bool weGotIt = false;
Mutex mutex = new Mutex(true, mutexName, out weGotIt);

if (weGotIt)
{
// Run like normal...
}
else
{
// Exit...another instance of the application already has it...
}

Let me know if I didn't explain this well or if you need more help.



I, for one, do not think the problem was that the band was down. I think that the problem may have been that there was a Stonehenge monument on the stage that was in danger of being crushed by a dwarf.

-David St. Hubbins
GeneralRe: prevent re-opening of application Pin
Mazdak30-Jan-04 1:57
Mazdak30-Jan-04 1:57 
GeneralRe: prevent re-opening of application Pin
Heath Stewart30-Jan-04 4:00
protectorHeath Stewart30-Jan-04 4:00 
GeneralRe: prevent re-opening of application Pin
azusakt30-Jan-04 14:18
azusakt30-Jan-04 14:18 
GeneralRe: prevent re-opening of application Pin
Heath Stewart30-Jan-04 14:39
protectorHeath Stewart30-Jan-04 14:39 
GeneralRe: prevent re-opening of application Pin
Bo Hunter30-Jan-04 14:43
Bo Hunter30-Jan-04 14:43 
GeneralC# Pin
BP12829-Jan-04 18:17
BP12829-Jan-04 18:17 
GeneralRe: C# Pin
Kentamanos29-Jan-04 19:00
Kentamanos29-Jan-04 19:00 
GeneralDirectX Tutorial Pin
Shree29-Jan-04 17:35
Shree29-Jan-04 17:35 
GeneralRe: DirectX Tutorial Pin
Mazdak29-Jan-04 19:07
Mazdak29-Jan-04 19:07 
GeneralMissing file Pin
BP12829-Jan-04 16:43
BP12829-Jan-04 16:43 
GeneralRe: Missing file Pin
Kentamanos29-Jan-04 16:51
Kentamanos29-Jan-04 16:51 
GeneralRe: Missing file Pin
BP12829-Jan-04 16:53
BP12829-Jan-04 16:53 
GeneralRe: Missing file Pin
Heath Stewart30-Jan-04 3:37
protectorHeath Stewart30-Jan-04 3:37 
GeneralAutomatic WSDL generation Pin
Kentamanos29-Jan-04 15:48
Kentamanos29-Jan-04 15:48 
GeneralRe: Automatic WSDL generation Pin
Kentamanos29-Jan-04 16:09
Kentamanos29-Jan-04 16:09 
GeneralRe: Automatic WSDL generation Pin
Kentamanos29-Jan-04 16:32
Kentamanos29-Jan-04 16:32 
GeneralRe: Automatic WSDL generation Pin
Heath Stewart30-Jan-04 3:54
protectorHeath Stewart30-Jan-04 3:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.