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

C / C++ / MFC

 
QuestionWriting in a file using CArchive class Pin
Le@rner11-Dec-09 22:47
Le@rner11-Dec-09 22:47 
AnswerRe: Writing in a file using CArchive class Pin
Nuri Ismail11-Dec-09 23:51
Nuri Ismail11-Dec-09 23:51 
AnswerRe: Writing in a file using CArchive class Pin
pacotest17-Dec-09 18:42
pacotest17-Dec-09 18:42 
QuestionNamed Mutex not visible from DLL Pin
Bram van Kampen11-Dec-09 15:03
Bram van Kampen11-Dec-09 15:03 
AnswerRe: Named Mutex not visible from DLL Pin
«_Superman_»11-Dec-09 18:37
professional«_Superman_»11-Dec-09 18:37 
AnswerRe: Named Mutex not visible from DLL Pin
Rajesh R Subramanian11-Dec-09 22:29
professionalRajesh R Subramanian11-Dec-09 22:29 
GeneralRe: Named Mutex not visible from DLL Pin
krmed12-Dec-09 4:16
krmed12-Dec-09 4:16 
AnswerRe: Named Mutex not visible from DLL Pin
Rajesh R Subramanian12-Dec-09 4:52
professionalRajesh R Subramanian12-Dec-09 4:52 
krmed wrote:
Calling GetLastError when the call did not fail is not recommended - the error code that you get will probably be from the last failed action.
You should only call GetLastError if the CreateMutex call failed - then it will give you a reliable error code.


That statement is wrong and misleading. Please read the documentation[^]:

Return Value

If the function succeeds, the return value is a handle to the newly created mutex object.

If the function fails, the return value is NULL. To get extended error information, call GetLastError.

If the mutex is a named mutex and the object existed before this function call, the return value is a handle to the existing object, GetLastError returns ERROR_ALREADY_EXISTS, bInitialOwner is ignored, and the calling thread is not granted ownership. However, if the caller has limited access rights, the function will fail with ERROR_ACCESS_DENIED and the caller should use the OpenMutex function.


I also mentioned in my original post that the call to GetLastError() must be made immediately (before anything else).


“Follow your bliss.” – Joseph Campbell

GeneralRe: Named Mutex not visible from DLL Pin
krmed12-Dec-09 5:14
krmed12-Dec-09 5:14 
GeneralRe: Named Mutex not visible from DLL Pin
Rajesh R Subramanian12-Dec-09 6:15
professionalRajesh R Subramanian12-Dec-09 6:15 
GeneralRe: Named Mutex not visible from DLL Pin
Bram van Kampen12-Dec-09 15:46
Bram van Kampen12-Dec-09 15:46 
GeneralRe: Named Mutex not visible from DLL Pin
Bram van Kampen12-Dec-09 16:54
Bram van Kampen12-Dec-09 16:54 
GeneralRe: Named Mutex not visible from DLL Pin
Rajesh R Subramanian12-Dec-09 18:54
professionalRajesh R Subramanian12-Dec-09 18:54 
GeneralRe: Named Mutex not visible from DLL Pin
Bram van Kampen14-Dec-09 12:25
Bram van Kampen14-Dec-09 12:25 
AnswerRe: Named Mutex not visible from DLL Pin
Richard MacCutchan12-Dec-09 1:46
mveRichard MacCutchan12-Dec-09 1:46 
GeneralRe: Named Mutex not visible from DLL Pin
Bram van Kampen12-Dec-09 16:08
Bram van Kampen12-Dec-09 16:08 
GeneralRe: Named Mutex not visible from DLL Pin
Richard MacCutchan12-Dec-09 22:55
mveRichard MacCutchan12-Dec-09 22:55 
AnswerRe: Named Mutex not visible from DLL Pin
Migounette13-Dec-09 2:36
Migounette13-Dec-09 2:36 
GeneralRe: Named Mutex not visible from DLL Pin
Bram van Kampen13-Dec-09 21:34
Bram van Kampen13-Dec-09 21:34 
QuestionIm just new in c++ [modified] Pin
Amr M. K.11-Dec-09 9:32
Amr M. K.11-Dec-09 9:32 
AnswerRe: Im just new in c++ Pin
«_Superman_»11-Dec-09 9:53
professional«_Superman_»11-Dec-09 9:53 
GeneralRe: Im just new in c++ Pin
Amr M. K.11-Dec-09 9:58
Amr M. K.11-Dec-09 9:58 
GeneralRe: Im just new in c++ Pin
EliottA11-Dec-09 9:58
EliottA11-Dec-09 9:58 
QuestionRe: Im just new in c++ Pin
CPallini11-Dec-09 11:30
mveCPallini11-Dec-09 11:30 
AnswerRe: Im just new in c++ Pin
Luc Pattyn11-Dec-09 11:53
sitebuilderLuc Pattyn11-Dec-09 11:53 

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.