DdeAddData

  HDDEDATA DdeAddData(hData, lpbSrcBuf, cbAddData, offObj)    
  HDDEDATA hData; /* handle of global memory object */
  LPBYTE lpbSrcBuf; /* address of source buffer */
  DWORD cbAddData; /* length of data */
  DWORD offObj; /* offset within global memory object */

The DdeAddData function adds data to the given global memory object. An application can add data beginning at any offset from the beginning of the object. If new data overlaps data already in the object, the new data overwrites the old data in the bytes where the overlap occurs. The contents of locations in the object that have not been written to are undefined.

Parameters

hData

Identifies the global memory object that receives additional data.

lpbSrcBuf

Points to a buffer containing the data to add to the global memory object.

cbAddData

Specifies the length, in bytes, of the data to be added to the global memory object.

offObj

Specifies an offset, in bytes, from the beginning of the global memory object. The additional data is copied to the object beginning at this offset.

Return Value

The return value is a new handle of the global memory object if the function is successful. The new handle should be used in all references to the object. The return value is zero if an error occurs.

Errors

Use the DdeGetLastError function to retrieve the error value, which may be one of the following:

DMLERR_DLL_NOT_INITIALIZED
DMLERR_INVALIDPARAMETER
DMLERR_MEMORY_ERROR
DMLERR_NO_ERROR

Comments

After a data handle has been used as a parameter in another Dynamic Data Exchange Management Library (DDEML) function or returned by a DDE callback function, the handle may only be used for read access to the global memory object identified by the handle.

If the amount of global memory originally allocated is not large enough to hold the added data, the DdeAddData function will reallocate a global memory object of the appropriate size.

See Also

DdeAccessData, DdeCreateDataHandle, DdeGetLastError, DdeUnaccessData