DdeKeepStringHandle

3.1

  #include <ddeml.h>    

  BOOL DdeKeepStringHandle(idInst, hsz)    
  DWORD idInst; /* instance identifier, */  
  HSZ hsz; /* handle of string, */  

The DdeKeepStringHandle function increments the usage count (increases it by one) associated with the given handle. This function makes it possible for an application to save a string handle that was passed to the application's dynamic data exchange (DDE) callback function. Otherwise, a string handle passed to the callback function is deleted when the callback function returns.

Parameters

idInst

Specifies the application-instance identifier obtained by a previous call to the DdeInitialize function.

hsz

Identifies the string handle to be saved.

Return Value

The return value is nonzero if the function is successful. Otherwise, it is zero.

Example

The following example is a portion of a DDE callback function that increases the usage count and saves a local copy of two string handles:

HSZ hsz1;
HSZ hsz2;
static HSZ hszServerBase;
static HSZ hszServerInst;
DWORD idInst;

case XTYP_REGISTER:

    /* Keep the handles for later use. */

    DdeKeepStringHandle(idInst, hsz1);
    DdeKeepStringHandle(idInst, hsz2);
    hszServerBase = hsz1;
    hszServerInst = hsz2;
    .
    . /* Finish processing the transaction. */
    .

See Also

DdeCreateStringHandle, DdeFreeStringHandle, DdeInitialize, DdeQueryString