Click here to Skip to main content
15,914,162 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
GeneralRe: Returning any HRESULT from FinalConstruct other than S_OK, results in client receiving REGDB_E_CLASSNOTREG Pin
Stone Free15-Oct-08 23:35
Stone Free15-Oct-08 23:35 
GeneralRe: Returning any HRESULT from FinalConstruct other than S_OK, results in client receiving REGDB_E_CLASSNOTREG Pin
Stuart Dootson16-Oct-08 2:57
professionalStuart Dootson16-Oct-08 2:57 
GeneralRe: Returning any HRESULT from FinalConstruct other than S_OK, results in client receiving REGDB_E_CLASSNOTREG Pin
Stone Free16-Oct-08 4:37
Stone Free16-Oct-08 4:37 
QuestionC#.net and VC++ Pin
balu1234514-Oct-08 7:23
balu1234514-Oct-08 7:23 
AnswerRe: C#.net and VC++ Pin
Stuart Dootson14-Oct-08 21:46
professionalStuart Dootson14-Oct-08 21:46 
QuestionIs it safe to use a iterator to keep a reference to an element in a container? Pin
followait10-Oct-08 17:34
followait10-Oct-08 17:34 
AnswerRe: Is it safe to use a iterator to keep a reference to an element in a container? Pin
Stuart Dootson11-Oct-08 7:44
professionalStuart Dootson11-Oct-08 7:44 
QuestionAssertion failed: _pAtlModule == 0 Pin
Christian Bayer8-Oct-08 23:32
Christian Bayer8-Oct-08 23:32 
Hello!

I am working on a C# COM-Server and a C++ COM client app. The client in fact loads a dll-plugin containing the COM client in a class that acts as a com event reciever:

extern "C"
__declspec(dllexport)
int ndofInit();

extern "C"
__declspec(dllexport)
void* ndofOpen(void* wnd);

extern "C"
__declspec(dllexport)
void ndofShutdown(void* deviceHandle);

[ event_receiver(com) ]
[ module(type=dll, name="NDOF") ]
class NDOFServer
{
public:
NDOFServer() {}
virtual ~NDOFServer();

...
}

Everytime I start the client I get the following error:

Debug Assertion failed!
Program ...
File: C:\Programme\Microsoft Visual Studio 8\VC\atlmfc\include\atlbase.h
Line 2706

Expression _pAtlModule == 0

Clicking Retry and returning to my code reveals that this error occurs when the constructor of NDOFServer() is called.
The constructor is called this way by the client app:

extern "C"
__declspec(dllexport)
int ndofInit()
{
if (sNdofServer == NULL)
sNdofServer = new NDOFServer();

return 1;
}

This error seems not to occur when the client plugin-DLL is used with another COM server offering the same classes etc. written in C++ (whose code I do not know).

I tried to switch some more or less relevant options in the project properties like:
- MFC usage static/shared/Windows shared
- ATL usage static/shared/none
- minimize CRT usage in ATL yes/no
- CLR support no/CLR

stdafx.h looks like this:

#if defined(_WIN32)
#ifndef WINVER // Allow use of features specific to #define WINVER 0x0501 // Change this to to target other
#endif
#ifndef _WIN32_WINNT // Allow use of features specific to
#define _WIN32_WINNT 0x0501 // (was 0x0501) Change to target other versions
#endif

#ifndef _WIN32_WINDOWS // Allow use of features specific to
#define _WIN32_WINDOWS 0x0410 // Change this to target Windows Me or later.
#endif

#ifndef _WIN32_IE // Allow use of features specific to IE
#define _WIN32_IE 0x0600 // Change this to target other versions of IE.
#endif

#define _ATL_APARTMENT_THREADED
#define _ATL_NO_AUTOMATIC_NAMESPACE
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS
#include <atlbase.h>
#include <atlcom.h>

<---->
//#include <atlwin.h>
//#include <atltypes.h>
//#include <atlctl.h>
//#include <atlhost.h>
--> commenting these headers out did neither help nor hurt

using namespace ATL;
#import "progid:AerionInput.Device" embedded_idl no_namespace
#endif //_WIN32

The C# DLL is nothing spectacular and the "main" class(or the first one being instanciated), which is not instanciated at this time. The COM-visible interface looks like this:

using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;

namespace AerionInput
{
[
Guid("CB3BF65E-0816-482A-BB11-64AF1E837812"),
InterfaceType(ComInterfaceType.InterfaceIsDual)
]
public interface ISimpleDevice
{
int Type
{
get;
}

IKeyboard Keyboard
{
get;
}

ISensor Sensor
{
get;
}

void Connect();
void Disconnect();
void LoadPreferences(string preferencesName);
}
}

And the AssemblyInfo.cs reads this like:

using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("TDxInput")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("n/a")]
[assembly: AssemblyProduct("TDxInput")]
[assembly: AssemblyCopyright("Copyright © n/a 2008")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(true)]
[assembly: Guid("7858b9e0-5793-4be4-9b53-661d922790d2")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]


I am doing this on Windows 2000 with Visual Studio 2005 Pro latest SP and .NET 2.0.50727 SP1.
AnswerRe: Assertion failed: _pAtlModule == 0 Pin
led mike10-Oct-08 5:22
led mike10-Oct-08 5:22 
GeneralRe: Assertion failed: _pAtlModule == 0 Pin
Christian Bayer12-Oct-08 22:14
Christian Bayer12-Oct-08 22:14 
GeneralRe: Assertion failed: _pAtlModule == 0 Pin
led mike13-Oct-08 6:07
led mike13-Oct-08 6:07 
GeneralRe: Assertion failed: _pAtlModule == 0 Pin
Christian Bayer13-Oct-08 9:40
Christian Bayer13-Oct-08 9:40 
GeneralRe: Assertion failed: _pAtlModule == 0 Pin
led mike13-Oct-08 9:56
led mike13-Oct-08 9:56 
GeneralRe: Assertion failed: _pAtlModule == 0 Pin
Christian Bayer13-Oct-08 12:38
Christian Bayer13-Oct-08 12:38 
QuestionAutomatically Start Windows Service on Startup [modified] Pin
narayanagvs6-Oct-08 22:10
narayanagvs6-Oct-08 22:10 
AnswerRe: Automatically Start Windows Service on Startup Pin
KarstenK6-Oct-08 23:22
mveKarstenK6-Oct-08 23:22 
AnswerRe: Automatically Start Windows Service on Startup Pin
Stuart Dootson6-Oct-08 23:53
professionalStuart Dootson6-Oct-08 23:53 
Questionwhy use parenthsis ? Pin
palmer774-Oct-08 17:47
palmer774-Oct-08 17:47 
Answer[Message Deleted] Pin
Steve Echols4-Oct-08 19:41
Steve Echols4-Oct-08 19:41 
GeneralRe: why use parenthsis ? Pin
palmer774-Oct-08 20:59
palmer774-Oct-08 20:59 
AnswerRe: why use parenthsis ? Pin
Michael Dunn5-Oct-08 20:34
sitebuilderMichael Dunn5-Oct-08 20:34 
AnswerRe: why use parenthsis ? Pin
KarstenK6-Oct-08 23:23
mveKarstenK6-Oct-08 23:23 
GeneralRe: why use parenthsis ? Pin
Michael Dunn7-Oct-08 19:51
sitebuilderMichael Dunn7-Oct-08 19:51 
GeneralRe: why use parenthsis ? Pin
KarstenK7-Oct-08 20:31
mveKarstenK7-Oct-08 20:31 
QuestionCCombobox question Pin
monsieur_jj2-Oct-08 21:00
monsieur_jj2-Oct-08 21:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.