Click here to Skip to main content
15,898,134 members
Home / Discussions / C#
   

C#

 
GeneralRe: DataGrid Images Pin
Anonymous11-Nov-03 13:25
Anonymous11-Nov-03 13:25 
QuestionHow can I limit my program to running just one instance. Pin
mcgahanfl11-Nov-03 10:47
mcgahanfl11-Nov-03 10:47 
AnswerRe: How can I limit my program to running just one instance. Pin
jeff_martin11-Nov-03 11:06
jeff_martin11-Nov-03 11:06 
GeneralRe: How can I limit my program to running just one instance. Pin
mcgahanfl11-Nov-03 12:30
mcgahanfl11-Nov-03 12:30 
GeneralRe: How can I limit my program to running just one instance. Pin
Alvaro Mendez12-Nov-03 10:25
Alvaro Mendez12-Nov-03 10:25 
GeneralRe: How can I limit my program to running just one instance. Pin
jeff_martin12-Nov-03 10:30
jeff_martin12-Nov-03 10:30 
GeneralRe: How can I limit my program to running just one instance. Pin
Alvaro Mendez12-Nov-03 10:39
Alvaro Mendez12-Nov-03 10:39 
AnswerRe: How can I limit my program to running just one instance. Pin
Kentamanos13-Nov-03 6:11
Kentamanos13-Nov-03 6:11 
While getting the process list is one way to do it, it relies on nobody else running an executable with the same name.

The approach most people seem to use is creating a "named mutex". A mutex is an object that can only be owned by one thread. If you make this a "named" mutex, then its effect is machine wide (as opposed to just process wide).

The approach is you try to create a named mutex with a unique name (use a GUID and you'll never have to worry about some other program using the same name). If you are able to create it and own the mutex, then you're the first instance running. If you can't create it, someone else is already running.

For an example of this technique, use this link I found in a Google search:
Link

Look at the 2nd reply (third message) from "Adam".



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: How can I limit my program to running just one instance. Pin
mcgahanfl13-Nov-03 8:05
mcgahanfl13-Nov-03 8:05 
GeneralC# seting valuse in another form Pin
Anonymous11-Nov-03 8:55
Anonymous11-Nov-03 8:55 
GeneralRe: C# seting valuse in another form Pin
Hesham Amin11-Nov-03 9:43
Hesham Amin11-Nov-03 9:43 
GeneralRe: C# seting valuse in another form Pin
Member 44190911-Nov-03 10:50
Member 44190911-Nov-03 10:50 
GeneralRe: C# seting valuse in another form Pin
Hesham Amin12-Nov-03 0:33
Hesham Amin12-Nov-03 0:33 
GeneralRe: C# seting valuse in another form Pin
WuRunZhe17-Nov-13 21:31
WuRunZhe17-Nov-13 21:31 
GeneralProblem firing event and passing "this" Pin
andrewstan11-Nov-03 7:04
andrewstan11-Nov-03 7:04 
GeneralRe: Problem firing event and passing "this" Pin
Heath Stewart11-Nov-03 7:14
protectorHeath Stewart11-Nov-03 7:14 
GeneralRe: Problem firing event and passing "this" Pin
andrewstan11-Nov-03 23:20
andrewstan11-Nov-03 23:20 
GeneralRe: Problem firing event and passing "this" Pin
Heath Stewart12-Nov-03 2:53
protectorHeath Stewart12-Nov-03 2:53 
GeneralRe: Problem firing event and passing "this" Pin
andrewstan12-Nov-03 3:13
andrewstan12-Nov-03 3:13 
Generaldrag window wothout titlebar Pin
troels_sorensen11-Nov-03 6:21
troels_sorensen11-Nov-03 6:21 
GeneralRe: drag window wothout titlebar Pin
Amirjalaly11-Nov-03 7:04
Amirjalaly11-Nov-03 7:04 
GeneralRe: drag window wothout titlebar Pin
troels_sorensen11-Nov-03 22:20
troels_sorensen11-Nov-03 22:20 
GeneralRe: drag window wothout titlebar Pin
Alvaro Mendez11-Nov-03 7:45
Alvaro Mendez11-Nov-03 7:45 
GeneralRe: drag window wothout titlebar Pin
Judah Gabriel Himango11-Nov-03 10:27
sponsorJudah Gabriel Himango11-Nov-03 10:27 
GeneralReading a used file Pin
j-hannemann11-Nov-03 6:16
j-hannemann11-Nov-03 6:16 

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.