0

I have an Executable ActiveX component created with VB 6, consumed by an application made with C++ (32bits) that Instantiate it.

Everything works fine under win 7, XP, Win 2003 32 bits, but when I run under Windows 7 or windows 2012 64 bits I got “-2147221503 (0x80040001) Invalid advise flags”

I’m using VS2008 ….

C++ code :

UINT test_exe_ativex_call()
{
HRESULT hr;
CLSID clsid;
_Arquivo *cls = NULL;
CoInitializeEx(NULL, COINIT_MULTITHREADED);
hr = CLSIDFromProgID(OLESTR("ACTIVEX.Class"), &clsid);
hr = CoCreateInstance(clsid, NULL, CLSCTX_LOCAL_SERVER, __uuidof(_Arquivo), (LPVOID*) &cls);
return 1;
}

… my stdafx.h has the reference for the executable activeX:

# import "ACTIVEX.tlb"
using namespace ACTIVEX;

The error happens executing CoCreateInstance.

I debugged my vb 6 code trying to understand and I realize that the main block of my activex module “Sub Main()” is executed well but when it is supposed to call my Class “Private Sub Class_Initialize()” the C++ program receive the error “0x80040001 Invalid advise flags”.

The same code works perfectly fine when I run on any 32bits windows version.

  • At a certain level, maybe a 32 bits VB6 component can't be consumed by a 64bits application (http://stackoverflow.com/questions/1167102/can-a-vb6-component-be-compiled-to-64-bit). Try to use only 32bits signed variables/values in your 64bits app when working with the VB6 component. – Rubik Feb 26 '15 at 16:40
  • Tks for the insight. My c++ application is a 32 bits... – Luiz Ricardo Mouro Feb 27 '15 at 17:11

0 Answers0