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);
           }

posted on 2010-04-21 20:30  酸辣大白菜  阅读(443)  评论(0编辑  收藏  举报

导航