DOCERR: DdeQueryConvInfo() Returns Zero When Called

ID: Q111012

3.10 WINDOWS kbprg kbdocerr

The information in this article applies to:

SYMPTOMS

The DdeQueryConvInfo() function returns zero when called to retrieve information about a DDE conversation.

CAUSE

The function returns zero when the cb member of the CONVINFO structure is not properly initialized prior to calling DdeQueryConvInfo().

The documentation for the lpConvInfo parameter of the DdeQueryConvInfo() function in the Windows 3.1 SDK "Programmer's Reference, Volume 2: Functions" manual mentions how the cb member of the CONVINFO structure must specify the length of the structure. However, the code sample right below it omits the initialization part before the function call, and thus causes confusion.

RESOLUTION

The cb member of the CONVINFO structure should be initialized to the size of the structure, as sample in the code sample below:

   CONVINFO ci;

   ci.cb = sizeof (CONVINFO);
   DdeQueryConvInfo(hConv, QID_SYNC, &ci);

MORE INFORMATION

Although this problem occurs in the DDEML version that ships with Microsoft Windows version 3.1, the problem has been fixed in the version that ships with Microsoft Windows for Workgroups version 3.1, because it added more robust handling to the DdeQueryConvInfo() function to correctly initialize an improperly set cb field when the function is called. For compatibility purposes, however, initializing the structure as described above is recommended.

For more information on the changes made between the Windows 3.1 and Windows for Workgroups 3.1 versions of DDEML, please see the following article(s) in the Microsoft Knowledge Base:

   ARTICLE-ID: Q102572
   TITLE     : Changes Between Win 3.1 and WFW Versions of DDEML

Additional reference words: 3.10 KBCategory: kbprg kbdocerr KBSubcategory: UsrDde Keywords : kb16bitonly

Last Reviewed: July 24, 1997