DdeGetLastError
3.1
|
UINT DdeGetLastError(idInst) |
|
|
|
DWORD idInst; |
/* instance identifier, */ |
|
The DdeGetLastError function returns the most recent error value set by the failure of a Dynamic Data Exchange Management Library (DDEML) function and resets the error value to DMLERR_NO_ERROR.
Parameters
idInst
Specifies the application-instance identifier obtained by a previous call to the DdeInitialize function.
Return Value
The return value is the last error value. Following are the possible DDEML error values:
DMLERR_ADVACKTIMEOUT |
A request for a synchronous advise transaction has timed out. |
DMLERR_BUSY |
The response to the transaction caused the DDE_FBUSY bit to be set. |
DMLERR_DATAACKTIMEOUT |
A request for a synchronous data transaction has timed out. |
DMLERR_DLL_NOT_INITIALIZED |
A DDEML function was called without first calling the DdeInitialize function, or an invalid instance identifier was passed to a DDEML function. |
DMLERR_DLL_USAGE |
An application initialized as APPCLASS_MONITOR has attempted to perform a DDE transaction, or an application initialized as APPCMD_CLIENTONLY has attempted to perform server transactions. |
DMLERR_EXECACKTIMEOUT |
A request for a synchronous execute transaction has timed out. |
DMLERR_INVALIDPARAMETER |
A parameter failed to be validated by the DDEML. Some of the possible causes are as follows: |
The application used a data handle initialized with a different item-name handle than that required by the transaction. |
The application used a data handle that was initialized with a different clipboard data format than that required by the transaction. |
The application used a client-side conversation handle with a server-side function or vise versa. |
The application used a freed data handle or string handle. |
More than one instance of the application used the same object. |
DMLERR_LOW_MEMORY |
A DDEML application has created a prolonged race condition (where the server application outruns the client), causing large amounts of memory to be consumed. |
DMLERR_MEMORY_ERROR |
A memory allocation failed. |
DMLERR_NO_CONV_ESTABLISHED |
A client's attempt to establish a conversation has failed. |
DMLERR_NOTPROCESSED |
A transaction failed. |
DMLERR_POKEACKTIMEOUT |
A request for a synchronous poke transaction has timed out. |
DMLERR_POSTMSG_FAILED |
An internal call to the PostMessage function has failed. |
Value |
Meaning |
DMLERR_REENTRANCY |
An application instance with a synchronous transaction already in progress attempted to initiate another synchronous transaction, or the DdeEnableCallback function was called from within a DDEML callback function. |
DMLERR_SERVER_DIED |
A server-side transaction was attempted on a conversation that was terminated by the client, or the server terminated before completing a transaction. |
DMLERR_SYS_ERROR |
An internal error has occurred in the DDEML. |
DMLERR_UNADVACKTIMEOUT |
A request to end an advise transaction has timed out. |
DMLERR_UNFOUND_QUEUE_ID |
An invalid transaction identifier was passed to a DDEML function. Once the application has returned from an XTYP_XACT_COMPLETE callback, the transaction identifier for that callback is no longer valid. |
Example
The following example calls the DdeGetLastError function if the DdeCreateDataHandle function fails:
DWORD idInst;
HDDEDATA hddeMyData;
HSZPAIR ahszp[2];
HSZ hszClock, hszTime;
/* Create string handles. */
hszClock = DdeCreateStringHandle(idInst, (LPSTR) "Clock",
CP_WINANSI);
hszTime = DdeCreateStringHandle(idInst, (LPSTR) "Time",
CP_WINANSI);
/* Copy handles to an HSZPAIR structure. */
ahszp[0].hszSvc = hszClock;
ahszp[0].hszTopic = hszTime;
ahszp[1].hszSvc = (HSZ) NULL;
ahszp[1].hszTopic = (HSZ) NULL;
/* Create a global memory object. */
hddeMyData = DdeCreateDataHandle(idInst, ahszp,
sizeof(ahszp), 0, NULL, CF_TEXT, 0);
if (hddeMyData == NULL)
/*
* Pass error value to application-defined error handling
* function.
*/
HandleError(DdeGetLastError(idInst));
See Also
DdeInitialize