BUG: SENDTIME Sample Does Not WorkID: Q171457
|
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.
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.
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);
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.
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
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.C2064: term does not evaluate to a function
Keywords : kberrmsg kbole kbEEdition kbMFC kbVC kbVC420bug
Version : 4.2
Platform : WINDOWS
Issue type : kbbug
Last Reviewed: August 5, 1999