about CreateFileMapping on wince

HANDLE hMapFile;
LPVOID lpMapAddress;
//SendMessage(g_hwndScope, SCM_GETSCOPEINFO, 0, (LPARAM)psi);
hMapFile = CreateFileMapping (INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, sizeof(SCOPEINFO), (LPCTSTR)TEXT("MAP_FILE_GETSCOPEINFO"));
if (hMapFile == NULL)
{
}
lpMapAddress = MapViewOfFile(hMapFile,FILE_MAP_ALL_ACCESS, 0, 0, 0);
if (lpMapAddress)
{
     memcpy((SCOPEINFO*)lpMapAddress, psi, sizeof(SCOPEINFO));
     SendMessage(g_hwndScope, SCM_GETSCOPEINFO, 0, (LPARAM)psi);
     memcpy(psi, (SCOPEINFO*)lpMapAddress, sizeof(SCOPEINFO));  
     UnmapViewOfFile(lpMapAddress);
}
if (hMapFile)
{
     CloseHandle(hMapFile);
}

 

 

hMapFile = CreateFileMapping (INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, sizeof(SCOPEINFO), TEXT("MAP_FILE_GETSCOPEINFO"));
           if (hMapFile == NULL)
           {
               bRet = ScopeControl::GetScopeInfo(hwnd, (SCOPEINFO*)lParam);
           }
           lpMapAddress = MapViewOfFile(hMapFile,FILE_MAP_ALL_ACCESS,0,0,0);
           if (lpMapAddress)
           {
               bRet = ScopeControl::GetScopeInfo(hwnd, (SCOPEINFO*)lpMapAddress);
           }
           if (hMapFile)
           {
               CloseHandle(hMapFile);
           }

你可能感兴趣的:(mapping)