📄 readme.wzd
字号:
/////////////////////////////////////////////////////////////////////
// Modify any class.
/////////////////////////////////////////////////////////////////////
NOTE: Typically you create shared memory in your Application Class's InitInstance()
and destroy it in ExitInstance().
// 1) open a segment of the swap file for shared memory
m_hMap=::CreateFileMapping((HANDLE)0xffffffff, //or can be an open file handle
0, // security
PAGE_READWRITE, // or PAGE_READONLY or PAGE_WRITECOPY
0, // size -- high order (required if no file handle)
0x1000, // size -- low order (required if no file handle)
MAP_ID); // unique id--required if no file handle
// view file--since we are using swap file, offset should be zero
m_pSharedData=::MapViewOfFile(m_hMap,
FILE_MAP_WRITE, // or FILE_MAP_READ, FILE_MAP_COPY (FILE_MAP_WRITE is read/write)
0, // offset -- high order
0, // offset -- low order
0); // number of bytes (zero maps entire file)
// 2) writing to shared memory
LPBYTE pData=(LPBYTE)((CWzdApp*)AfxGetApp())->GetSharedData();
memcpy(pData,pWrite,10);
// 3) reading from shared memory
BYTE pRead[10];
LPBYTE pData=(LPBYTE)((CWzdApp*)AfxGetApp())->GetSharedData();
memcpy(pRead,pData,10);
// 4) unview and close shared data
::UnmapViewOfFile(m_pSharedData);
::CloseHandle(m_hMap);
/////////////////////////////////////////////////////////////////////
// From: Visual C++ MFC Programming by Example by John E. Swanke
// Copyright (C) 1999 jeswanke. All rights reserved.
/////////////////////////////////////////////////////////////////////
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -