Microsoft KB Archive/183214

= 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

 Microsoft ActiveX Template Library 2.0, when used with:  Microsoft Visual C++ 4.2 Enterprise Edition

 Microsoft Visual C++ 5.0 Enterprise Edition

 Microsoft Visual C++ 6.0 Enterprise Edition

 Microsoft Visual C++ 4.2 Professional Edition</li></ul>

 Microsoft Visual C++ 5.0 Professional Edition</li></ul>

 Microsoft Visual C++ 6.0 Professional Edition</li></ul>

 Microsoft Visual C++ 6.0 Standard Edition</li></ul> </li> Microsoft ActiveX Template Library 2.1, when used with:  Microsoft Visual C++ 4.2 Enterprise Edition</li></ul>

 Microsoft Visual C++ 5.0 Enterprise Edition</li></ul>

 Microsoft Visual C++ 6.0 Enterprise Edition</li></ul>

 Microsoft Visual C++ 4.2 Professional Edition</li></ul>

 <li>Microsoft Visual C++ 5.0 Professional Edition</li></ul>

<ul> <li>Microsoft Visual C++ 6.0 Professional Edition</li></ul>

<ul> <li>Microsoft Visual C++ 6.0 Standard Edition</li></ul>

<ul> <li>Microsoft Visual C++ .NET 2002 Standard Edition</li></ul>

<ul> <li>Microsoft Visual C++ .NET 2003 Standard Edition</li></ul> </li> <li>Microsoft ActiveX Template Library 3.0, when used with: <ul> <li>Microsoft Visual C++ 4.2 Enterprise Edition</li></ul>

<ul> <li>Microsoft Visual C++ 5.0 Enterprise Edition</li></ul>

<ul> <li>Microsoft Visual C++ 6.0 Enterprise Edition</li></ul>

<ul> <li>Microsoft Visual C++ 4.2 Professional Edition</li></ul>

<ul> <li>Microsoft Visual C++ 5.0 Professional Edition</li></ul>

<ul> <li>Microsoft Visual C++ 6.0 Professional Edition</li></ul>

<ul> <li>Microsoft Visual C++ 6.0 Standard Edition</li></ul> </li></ul>

-

<div class="notice_section">

This article was previously published under Q183214

<div class="symptoms_section">

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

<pre class="fixed_text">  E_INVALIDARG (0x80070057 or "The parameter is incorrect")

<div class="cause_section">

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.

<div class="resolution_section">

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:

http://www.microsoft.com/downloads/details.aspx?familyid=d7a4de78-81a9-4db7-beb6-84ff99342172&displaylang=en

<div class="status_section">

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

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.