Click here to Skip to main content
15,888,282 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Accessing a Variable Pin
T.RATHA KRISHNAN27-Sep-10 23:50
T.RATHA KRISHNAN27-Sep-10 23:50 
GeneralRe: Accessing a Variable Pin
bleedingfingers28-Sep-10 0:04
bleedingfingers28-Sep-10 0:04 
AnswerRe: Accessing a Variable Pin
bleedingfingers27-Sep-10 23:42
bleedingfingers27-Sep-10 23:42 
GeneralRe: Accessing a Variable Pin
Moak27-Sep-10 23:49
Moak27-Sep-10 23:49 
JokeRe: Accessing a Variable Pin
bleedingfingers28-Sep-10 0:03
bleedingfingers28-Sep-10 0:03 
GeneralRe: Accessing a Variable Pin
T.RATHA KRISHNAN28-Sep-10 0:38
T.RATHA KRISHNAN28-Sep-10 0:38 
QuestionWM_COPYDATA fails with error RPC_E_CANTCALLOUT_ININPUTSYNCCALL [modified] Pin
sashoalm27-Sep-10 21:15
sashoalm27-Sep-10 21:15 
QuestionMutex blocks CreateFileMapping Pin
Maxwell Chen27-Sep-10 20:52
Maxwell Chen27-Sep-10 20:52 
I am adding a feature into my application programs which will be using shared (mapped) memory to communicate between two programs.

I made a demo1 program to test and verify the class implementations. It works well.

So I started to do one of the real application program. To prevent two instances in the system, I used CreateMutex for that.
HANDLE hMutex = CreateMutex(NULL, FALSE, MUTEX_NAME);
if(hMutex) {
    if(ERROR_ALREADY_EXISTS == GetLastError()) {
        return FALSE;    // Exit.
    }
}

Later during the initialization of the program, I found CreateFileMapping failed.
m_hFile = CreateFileMapping(
    INVALID_HANDLE_VALUE,        // use paging file
    NULL,                        // default security
    PAGE_READWRITE,                // read/write access
    0,                            // maximum object size (high-order DWORD)
    m_dwBufSize,                // maximum object size (low-order DWORD)
    m_sMappingName);            // name of mapping object

When I removed the CreateMutex line, CreateFileMapping returned a valid handle.
Are they using the same system resource?
  Maxwell Chen

AnswerRe: Mutex blocks CreateFileMapping Pin
Code-o-mat27-Sep-10 22:46
Code-o-mat27-Sep-10 22:46 
GeneralRe: Mutex blocks CreateFileMapping Pin
Maxwell Chen27-Sep-10 22:54
Maxwell Chen27-Sep-10 22:54 
GeneralRe: Mutex blocks CreateFileMapping Pin
Code-o-mat27-Sep-10 23:04
Code-o-mat27-Sep-10 23:04 
GeneralRe: Mutex blocks CreateFileMapping Pin
Maxwell Chen27-Sep-10 23:05
Maxwell Chen27-Sep-10 23:05 
GeneralRe: Mutex blocks CreateFileMapping Pin
Code-o-mat27-Sep-10 23:17
Code-o-mat27-Sep-10 23:17 
GeneralRe: Mutex blocks CreateFileMapping Pin
Maxwell Chen27-Sep-10 23:32
Maxwell Chen27-Sep-10 23:32 
GeneralRe: Mutex blocks CreateFileMapping Pin
Code-o-mat27-Sep-10 23:57
Code-o-mat27-Sep-10 23:57 
GeneralRe: Mutex blocks CreateFileMapping Pin
Maxwell Chen28-Sep-10 0:04
Maxwell Chen28-Sep-10 0:04 
GeneralRe: Mutex blocks CreateFileMapping Pin
Code-o-mat28-Sep-10 0:04
Code-o-mat28-Sep-10 0:04 
GeneralRe: Mutex blocks CreateFileMapping Pin
Aescleal28-Sep-10 1:03
Aescleal28-Sep-10 1:03 
GeneralRe: Mutex blocks CreateFileMapping Pin
Code-o-mat28-Sep-10 1:11
Code-o-mat28-Sep-10 1:11 
AnswerRe: Mutex blocks CreateFileMapping PinPopular
«_Superman_»28-Sep-10 0:05
professional«_Superman_»28-Sep-10 0:05 
AnswerRe: Mutex blocks CreateFileMapping Pin
Luc Pattyn28-Sep-10 3:37
sitebuilderLuc Pattyn28-Sep-10 3:37 
GeneralRe: Mutex blocks CreateFileMapping Pin
Maxwell Chen28-Sep-10 4:31
Maxwell Chen28-Sep-10 4:31 
GeneralRe: Mutex blocks CreateFileMapping Pin
Luc Pattyn28-Sep-10 4:41
sitebuilderLuc Pattyn28-Sep-10 4:41 
GeneralRe: Mutex blocks CreateFileMapping Pin
Maxwell Chen28-Sep-10 4:44
Maxwell Chen28-Sep-10 4:44 
GeneralRe: Mutex blocks CreateFileMapping Pin
Blake Miller28-Sep-10 11:05
Blake Miller28-Sep-10 11:05 

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.