BUG: SENDTIME Sample Does Not Work

Last reviewed: February 17, 1998
Article ID: Q171457
The information in this article applies to:
  • Microsoft Visual C++, 32-bit Enterprise Edition, version 4.2 on the following platform: - x86

SYMPTOMS

When you execute the SENDTIME sample build with Visual C++ 4.2 Enterprise Edition without the Visual C++ 4.2b patch installed, it will fail in CoCreateInstanceEx(). If the Visual C++ 4.2b patch is installed, the sample will not build at all and will generate 7 compiler errors.

CAUSE

Some of the structures used by DCOM have changed since the Visual C++ 4.2 Enterprise Edition shipped. As a result, the sample will fail in CoCreateInstanceEx() with "error invalid parameter" without the Visual C++ 4.2b patch applied. If the Visual C++ 4.2b patch is applied, the header files are updated to reflect the correct DCOM structures. However, since the SENDTIME source is trying to use the old structures, compilation errors will be generated.

RESOLUTION

Apply the Visual C++ 4.2b patch to update the DCOM structures in the header files. When you build the sample, 7 compiler errors will be generated. In the project settings add the _WIN32_DCOM preprocessor symbol. Then, in the CallMachine() function in SENDTDLG.CPP, replace the following lines:

   ServerInfo.dwSize = sizeof(COSERVERINFO);
   ServerInfo.pszName = T2OLE(lpszMachine);

with

   memset(&ServerInfo, 0, sizeof(ServerInfo));
   ServerInfo.pwszName = T2OLE(lpszMachine);

STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this bug and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

Following are the compilation errors that are generated when you build the sample after applying the patch:

   C2039: 'dwSize' : is not a member of '_COSERVERINFO'
   C2039: 'pszName' : is not a member of '_COSERVERINFO'
   C2065: 'CoCreateInstanceEx' : undeclared identifier
   C2064: term does not evaluate to a function SendTime.cpp
   C2065: 'CoInitializeEx' : undeclared identifier
   C2065: 'COINIT_MULTITHREADED' : undeclared identifier
   C2064: term does not evaluate to a function

The first 2 errors are a result of the structure changing and, therefore, these members are no longer valid. The remaining errors occur because the function prototypes for CoCreateInstanceEx() and CoInitializeEx() are conditionally included depending on whether the preprocessor symbol _WIN32_DCOM is defined.
Keywords          : MfcOLE vcbuglist420 VCEntIss kberrmsg
Technology        : kbole kbMfc
Version           : 4.2
Platform          : WINDOWS
Issue type        : kbbug


================================================================================


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: February 17, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.