Knowledge Base

You receive an "E_INVALIDARG (0x80070057 or 'The parameter is incorrect')" error message from the CoCreateInstance function in Visual C++ on a computer that is running Windows 95

Article ID: 183214

Article Last Modified on 6/2/2005


APPLIES TO


This article was previously published under Q183214

SYMPTOMS

Under Windows 95, you might get the following error returned from the CoCreateInstance() function:

   E_INVALIDARG (0x80070057 or "The parameter is incorrect")
				

CAUSE

Your project might have the following macro:

   #define _WIN32_WINNT 0x0400
				


By default, ATL projects contain this macro in StdAfx.h. In ObjBase.h, the CLSCTX_ALL and CLSCTX_SERVER flags are defined to include the CLSCTX_REMOTE_SERVER flag if the preprocessor symbol, _WIN32_WINNT, is defined to be greater than or equal to 0x0400 (_WIN32_WINNT >= 0x400).

CLSCTX_REMOTE_SERVER is only valid on Windows NT 4.0 or later, Windows 95 with DCOM for Windows 95 installed, Windows 98, and Windows Millennium Edition (Me). If you call CoCreateInstance() on Windows 95 (without DCOM for Windows 95) with a flag that includes CLSCTX_REMOTE_SERVER, it returns an E_INVALIDARG error.

RESOLUTION

Remove the following from StdAfx.h:

   #define _WIN32_WINNT 0x0400
				


Or, you can install DCOM for Windows 95, which comes with an updated Ole32.dll. This version recognizes the CLSCTX_REMOTE_SERVER flag. You can download DCOM for Windows 95 from the following Web location:

STATUS

This behavior is by design.

(c) Microsoft Corporation 1998, All Rights Reserved. Contributions by Samson Tanrena, Microsoft Corporation.


Additional query words: CreateInstance [ASCII 150]2147942487

Keywords: kberrmsg kbtshoot kbbug kbarchitecture kbdebug kbprb kbctrl kbfunctions KB183214