INFO: What Do the cmiCommandDispatch() Errors Mean?

ID: Q183165


The information in this article applies to:
  • Microsoft Office 2000 Developer
  • Microsoft Visual C++, 32-bit Editions, version 5.0
  • Microsoft Word Developer's Kit, version 95
  • Microsoft Word 97 for Windows


SUMMARY

This article describes error codes returned by the cmiCommandDispatch() function exported from the Win32Cmi.dll included with the Microsoft Word Developer's Kit, Third Edition. CMI stands for the CAPI messaging interface, and is used to drive Microsoft Word from another process.


MORE INFORMATION

Error 0

  • Description: Success

Error -1

  • Description: Microsoft Word is invisible, or not running.
  • Suggestion: Start Microsoft Word before executing.

Error -2

  • Description: Win32Cmi.dll's shared memory block was not big enough.
  • More Information: The default size is 131072.
  • Suggestion: Recompile the Win32Cmi project with a bigger size.

Error -3

  • Description: Could not obtain Microsoft Word's thread ID.
  • More Information: The Win32 API GetWindowThreadProcessId() failed.

Error -4

  • Description: Win32Cmi.dll could not install its WH_GETMESSAGE hook.
  • More Information: The Win32 API SetWindowsHookEx() failed.

Error -5

  • Description: The current instance of Microsoft Word was not the original instance hooked by the Win32Cmi Dll.
  • More Information: Win32Cmi.dll's hooked thread id doesn't match the current Microsoft Word thread id. Win32Cmi.dll is only designed to work with a specific instance of Microsoft Word.
  • Suggestion 1: Use CMI with only one Microsoft Word instance.
  • Suggestion 2: Use OLE Automation as an alternative to CMI.
  • Suggestion 3: Modify the Win32Cmi project yourself to support multiple instances of Microsoft Word.

Error -6

  • Description: Win32Cmi.dll could not create an event object.
  • More Information: The Win32 API CreateEvent() failed.

Error -7

  • Description: Win32Cmi.dll could not create a file-mapping object.
  • More Information: The Win32 API CreateFileMapping() failed.

Error -8

  • Description: Win32Cmi.dll's call to MapViewOfFile() failed.

Error -9

  • Description: Time-out (default=60 seconds).
  • More Information: Win32Cmi.dll calls WaitForSingleObject() with a time-out value of 60000 milliseconds (60 seconds). If the return value is not WAIT_OBJECT_0, then cmiCommandDispatch() returns -9.
  • Suggestion 1: The calling thread may be in a synchronous context with Word. Try calling from a separate thread.
  • Suggestion 2: Increase time-out value in the Win32Cmi project.

Errors 5001 thru 5034

  • Description: General CAPI error.
  • More Information: This code is defined and described in WdError.h.
  • Suggestion: Lookup error in WdError.h, and modify parameters to cmiCommandDispatch().

© Microsoft Corporation 1998, All Rights Reserved.
Contributions by Joe Crump, Microsoft Corporation

Additional query words: word win32cmi cmi wdCommandDispatch capi

Keywords : kbdta kbVC500 kbSDKWord kbWord kbGrpDSO kbOffice2000
Version : :; WINDOWS:95,97; winnt:5.0
Platform : WINDOWS winnt
Issue type : kbinfo


Last Reviewed: June 8, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.