Article ID: 183165 - Last Review: February 12, 2007 - Revision: 3.2

INFO: What Do the cmiCommandDispatch() Errors Mean?

This article was previously published under Q183165

On This Page

Expand all | Collapse all

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().

APPLIES TO
  • Microsoft Visual C++ 5.0 Enterprise Edition
  • Microsoft Visual C++ 5.0 Professional Edition
  • Microsoft Word Developer's Kit 95
  • Microsoft Word 2002 Standard Edition
  • Microsoft Word 2000 Standard Edition
  • Microsoft Word 97 Standard Edition
Keywords: 
kbinfo KB183165
 

Article Translations

 

Related Support Centers