Application Can Allocate Memory with DdeCreateDataHandleLast reviewed: November 2, 1995Article ID: Q85680 |
The information in this article applies to:
SUMMARYAn application can use the DdeCreateDataHandle function to create a handle to a block of data. The application can use the handle to pass the data to another application in a dynamic data exchange (DDE) conversation using the Dynamic Data Exchange Management Libraries (DDEML). All DDEML functions refer to blocks of memory using data handles. An application can allocate memory and manually create a data handle associated with the memory (using method 1 below), or automatically by using the DdeCreateDataHandle function (method 2 below).
Method 1
Method 2
// Retrieve the length of the data to be stored cbLen = lstrlen("This is a test") + 1; // Create the data handle and allocate the memory hData = DdeCreateDataHandle(idInst, NULL, 0, cbLen, hszItem, wFmt, 0); // Access the data handle lpstrData = (LPSTR)DdeAccessData(hData, NULL); // Fill the block of memory lstrcpy(lpstrData, "This is a test"); // Unaccess the data handle DdeUnaccessData(hData);When an application obtains a data handle from DdeCreateDataHandle, the application should next call DdeAccessData with the handle. If a data handle is first specified as a parameter to a DDEML function other than DdeAccessData, when the application later calls DdeAccessData, the application receives only read access to the associated memory block.
|
Additional reference words: 3.10 3.50 3.51 4.00 95
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |