G gudubinghe Unregistered / Unconfirmed GUEST, unregistred user! 2005-06-29 #1 我要建立一个内存映射文件,用c++builder编写.该怎么写啊。 用delphi我倒是知道.
G gudubinghe Unregistered / Unconfirmed GUEST, unregistred user! 2005-06-29 #2 我要建立一个内存映射文件,用c++builder编写.该怎么写啊。 用delphi我倒是知道.
腰 腰子比猪大 Unregistered / Unconfirmed GUEST, unregistred user! 2005-07-02 #3 用api函数吧 1、CreateFile打开你要映射的文件,并得到句柄 2、CreateFileMapping生成内存映射对象 3、MapViewOfFile映射文件
W WebBar Unregistered / Unconfirmed GUEST, unregistred user! 2005-08-11 #4 我的一段代码, 同时支持 BC, VC, GCC bool TSwapMemory::Init() { m_Handle = ::CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE | SEC_COMMIT, 0, m_Size, m_Name.c_str()); bool Result = false; if ( m_Handle != NULL ) { m_Data = static_cast<char*> :MapViewOfFile(m_Handle, FILE_MAP_ALL_ACCESS, 0, 0, 0)); if ( m_Data != NULL ) { m_Exist = GetLastError() == ERROR_ALREADY_EXISTS; if ( ! m_Exist ) { Clear(); }else { } Result = true; }else { CloseHandle(m_Handle); m_Handle = NULL; } } return Result; }
我的一段代码, 同时支持 BC, VC, GCC bool TSwapMemory::Init() { m_Handle = ::CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE | SEC_COMMIT, 0, m_Size, m_Name.c_str()); bool Result = false; if ( m_Handle != NULL ) { m_Data = static_cast<char*> :MapViewOfFile(m_Handle, FILE_MAP_ALL_ACCESS, 0, 0, 0)); if ( m_Data != NULL ) { m_Exist = GetLastError() == ERROR_ALREADY_EXISTS; if ( ! m_Exist ) { Clear(); }else { } Result = true; }else { CloseHandle(m_Handle); m_Handle = NULL; } } return Result; }