Click here to Skip to main content
15,921,452 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: run a perticuler registry key ? Pin
imran_rafique23-Oct-02 17:39
imran_rafique23-Oct-02 17:39 
GeneralRe: run a perticuler registry key ? Pin
Christian Graus23-Oct-02 17:52
protectorChristian Graus23-Oct-02 17:52 
GeneralRe: run a perticuler registry key ? Pin
Stephane Rodriguez.23-Oct-02 21:44
Stephane Rodriguez.23-Oct-02 21:44 
AnswerRe: run a perticuler registry key ? Pin
valikac23-Oct-02 17:36
valikac23-Oct-02 17:36 
GeneralRe: run a perticuler registry key ? Pin
imran_rafique23-Oct-02 17:54
imran_rafique23-Oct-02 17:54 
GeneralRe: run a perticuler registry key ? Pin
valikac23-Oct-02 18:02
valikac23-Oct-02 18:02 
GeneralRe: run a perticuler registry key ? Pin
Todd Smith23-Oct-02 18:12
Todd Smith23-Oct-02 18:12 
GeneralMutex problem Pin
Abin23-Oct-02 15:54
Abin23-Oct-02 15:54 
I'm working on a program which is not allowed to be run more than once in same directory, but is allowed to be run as many times as users want if the programs are located in diffrent directory. For example, suppose my program is named "abc.exe":

run c:\path1\abc.exe -> OK
run c:\path1\abc.exe -> Not OK

However:

run c:\path1\abc.exe -> OK
run c:\path2\abc.exe -> OK
run c:\path3\abc.exe -> OK

I wish I explained clear enoguh in above scenario. Now, to accomplish this, I thought using mutex should be good, this is how I did:

In beginning of the program I use GetModuleFileName to obtain application path and store it in a string, say g_szAppPath, and I use this string to create MUTEX object. Hmm, I thought it should work since g_szAppPath would only be different if the programs are located in different directory, is it not? But somehow this method does not work, I can always run the program multiple times in same directory.

What am I doing wrong? Is there a good way to get what I want? Thanks guys.
GeneralRe: Mutex problem Pin
l a u r e n23-Oct-02 17:08
l a u r e n23-Oct-02 17:08 
GeneralRe: Mutex problem Pin
includeh1024-Oct-02 6:51
includeh1024-Oct-02 6:51 
GeneralRe: Mutex problem Pin
Alvaro Mendez24-Oct-02 9:13
Alvaro Mendez24-Oct-02 9:13 
GeneralRe: Mutex problem Pin
Abin24-Oct-02 9:38
Abin24-Oct-02 9:38 
GeneralRe: Mutex problem Pin
Alvaro Mendez24-Oct-02 9:56
Alvaro Mendez24-Oct-02 9:56 
GeneralRe: Mutex problem Pin
Abin24-Oct-02 10:07
Abin24-Oct-02 10:07 
Questionis there any change in logic ? Pin
imran_rafique23-Oct-02 15:47
imran_rafique23-Oct-02 15:47 
AnswerRe: is there any change in logic ? Pin
valikac23-Oct-02 17:37
valikac23-Oct-02 17:37 
GeneralRe: is there any change in logic ? Pin
imran_rafique24-Oct-02 15:15
imran_rafique24-Oct-02 15:15 
GeneralRe: is there any change in logic ? Pin
valikac24-Oct-02 15:50
valikac24-Oct-02 15:50 
Questionhow to make? Pin
imran_rafique23-Oct-02 15:15
imran_rafique23-Oct-02 15:15 
AnswerRe: how to make? Pin
Christian Graus23-Oct-02 16:28
protectorChristian Graus23-Oct-02 16:28 
GeneralRe: how to make? Pin
imran_rafique23-Oct-02 16:47
imran_rafique23-Oct-02 16:47 
GeneralRe: how to make? Pin
Christian Graus23-Oct-02 17:00
protectorChristian Graus23-Oct-02 17:00 
GeneralRe: how to make? Pin
imran_rafique23-Oct-02 17:34
imran_rafique23-Oct-02 17:34 
GeneralRe: how to make? Pin
Christian Graus23-Oct-02 17:54
protectorChristian Graus23-Oct-02 17:54 
GeneralRe: how to make? Pin
imran_rafique24-Oct-02 16:31
imran_rafique24-Oct-02 16:31 

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.