Conversion Types
ConvType = 0x01 ASCII to EBCDIC
ConvType = 0x02 EBCDIC to ASCII
Note:
The string to be converted must be stored in a memory
block that is accessible across processes. In Win32, this can only
be accomplished by use of memory-mapped files. The global memory is
created and named in the client application and the names are sent
to Personal Communications through the DDE message. The steps required to implement
this are demonstrated in the following example:
//Steps for a Source Buffer (done in client application)
HANDLE hMapFile;
LPVOID lpMapAddress;
ATOM aCONV;
hMapFile = CreateFileMapping((HANDLE)0xFFFFFFFF, // not a real file
NULL, // Default security.
PAGE_READWRITE, // Read/write
(DWORD)0, // Ignored
(DWORD)nStringLength, // Length of string
(LPCTSTR)szSourceName); // Name of
// mapping object.
If (hMapFile == NULL)
{
MessageBox ("Could not create file-mapping Source object.");
return;
}
// Now treat buffer like local memory
strcpy((LPSTR)lpMapAddress, szConcersionString);
// Repeat steps for a Target Buffer
.....
.....
// Set up ATOM information
aCONV = GlobalAddAtom("CONV"); // MUST be this string
// Post DDE Message Now ....
// When done with memory blocks, clean up
if (!UnmapViewOfFile(lpMapAddress))
{
MessageBox ("Could not unmap view of Target.");
}
CloseHandle(hMapSFile);
// CODE ENDS