Dirt Simple OCX Created in VB6 crashes when I call empty method in BCB4 
Author Message
 Dirt Simple OCX Created in VB6 crashes when I call empty method in BCB4

Hello All,

I'm creating a 3rd party ActiveX component in VB6, and I'd like for it to be
compatible with Borlands product line.

I'm using BCB verson 4 with both service packs, under 98.

In an attempt to simplify the issue I've created a dirt simple OCX in VB
with one method, Empty().  The code generated by the import is shown at the
bottom of this message, and my implementation is immediately below:

void __fastcall TForm1::cbEmptySubClick(TObject *Sender)
{
  EmptyOCX11->EmptySub();

Quote:
}

Simply calling this empty subroutine in my OCX calls a fault, " Project
Demo.EXE raised exception class EAccessViolation with message 'Access
violation at address 66023C23 in module 'MSVBVM60.DLL'.  Read of Address
FFFFFFFF'. Process stopped.  Use Step or Run to continue."

I must be doing something obviously wrong here, since I'm not even passing
parameters.

Any help is greatly appreciated,

Alen Seigel

------------------------------------------------------------------
  Code generated by importing the ACTIVEX
-----------------------------------------------------------------
// ************************************************************************
//
// WARNING
// -------
// The types declared in this file were generated from data read from a
// Type Library. If this type library is explicitly or indirectly (via
// another type library referring to this type library) re-imported, or the
// 'Refresh' command of the Type Library Editor activated while editing the
// Type Library, the contents of this file will be regenerated and all
// manual modifications will be lost.
// ************************************************************************
//

// C++ TLBWRTR : $Revision:   1.96.1.40  $
// File generated on 06/13/00 8:40:07 PM from Type Library described below.

// ************************************************************************
//
// Type Lib: C:\CLIENTS WORK IN PROGRESS\SII\EMPTYOCX\EMPTYOCX.OCX
// IID\LCID: {970F4D0C-4148-11D4-B48D-005004ADD3D9}\0
// Helpfile:
// DepndLst:
//   (1) v2.0 stdole, (C:\WINDOWS\SYSTEM\stdole2.tlb)
//   (2) v4.0 StdVCL, (C:\WINDOWS\SYSTEM\STDVCL40.DLL)
// ************************************************************************
//

#include <vcl.h>
#pragma hdrstop
#if defined(USING_ATL)
#include <atl\atlvcl.h>
#endif

#include "EmptyOCX_OCX.h"

#if !defined(__PRAGMA_PACKAGE_SMART_INIT)
#define      __PRAGMA_PACKAGE_SMART_INIT
#pragma package(smart_init)
#endif

namespace Emptyocx_tlb
{

// *********************************************************************//
// OCX PROXY CLASS IMPLEMENTATION
// (The following variables/methods implement the class TEmptyOCX1 which
// allows "" to be hosted in CBuilder IDE/apps).
// *********************************************************************//
TControlData TEmptyOCX1::CControlData =
{
  // GUID of CoClass and Event Interface of Control
  {0x970F4D0E, 0x4148, 0x11D4,{ 0xB4, 0x8D, 0x00, 0x50, 0x04, 0xAD, 0xD3,
0xD9} }, // CoClass
  {0x5C48CA20, 0x416A, 0x11D4,{ 0xB4, 0x8D, 0x00, 0x50, 0x04, 0xAD, 0xD3,
0xD9} }, // Events

  // Count of Events and array of their DISPIDs
  0, NULL,

  // Pointer to Runtime License string
  NULL,  // HRESULT(0x00000000)
  // Flags for OnChanged PropertyNotification
  0x00000000,
  300,// (IDE Version)

  // Count of Font Prop and array of their DISPIDs
  0, NULL,

  // Count of Pict Prop and array of their DISPIDs
  0, NULL,
  0, // Reserved
  0, // Instance count (used internally)
  0, // List of Enum descriptions (internal)

Quote:
};

GUID     TEmptyOCX1::DEF_CTL_INTF = {0x5C48CA1F, 0x416A, 0x11D4,{ 0xB4,
0x8D, 0x00, 0x50, 0x04, 0xAD, 0xD3, 0xD9} };
TNoParam TEmptyOCX1::OptParam;

static inline void ValidCtrCheck(TEmptyOCX1 *)
{
   delete new TEmptyOCX1((TComponent*)(0));

Quote:
};

void __fastcall TEmptyOCX1::InitControlData(void)
{
  ControlData = &CControlData;

Quote:
};

void __fastcall TEmptyOCX1::CreateControl(void)
{
  if (!m_OCXIntf)
  {
    _ASSERTE(DefaultDispatch);
    DefaultDispatch->QueryInterface(DEF_CTL_INTF, (LPVOID*)&m_OCXIntf);
  }

Quote:
};

TCOM_EmptyOCX1 __fastcall TEmptyOCX1::GetControlInterface(void)
{
  CreateControl();
  return m_OCXIntf;
Quote:
};

void/*HR*/ __fastcall TEmptyOCX1::EmptySub(void)
{
  GetControlInterface().EmptySub();

Quote:
}
};     // namespace Emptyocx_tlb

// *********************************************************************//
// The Register function is invoked by the IDE when this module is
// installed in a Package. It provides the list of Components (including
// OCXes) implemented by this module. The following implementation
// informs the IDE of the OCX proxy classes implemented here.
// *********************************************************************//
namespace Emptyocx_ocx
{

void __fastcall PACKAGE Register()
{
  // [1]
  TComponentClass classes[] = {
                              __classid(Emptyocx_tlb::TEmptyOCX1)
                             };
  RegisterComponents("ActiveX", classes,
                     sizeof(classes)/sizeof(classes[0])-1);

Quote:
}
};     // namespace Emptyocx_ocx



Sun, 01 Dec 2002 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. VB6 crashes when using user created ocx and dll

2. VB6 crashes when using user created ocx and dll

3. Quit method causes crash called from automation

4. Wang OCX Imaging controls: closescanner method crash!!!

5. Wang OCX Imaging controls: closescanner method crash!!!

6. VB crashes on return from an OCX call

7. Flash 10 OCX update causing System Error crash in vb6 IDE

8. Calling COM crashes VB6

9. VB5CCE created ocx causes VB4 to crash

10. VB6.EXE crash calling Help

11. Creating a non-com simple dll that exports methods

12. Calling CoInitialize( ) in a new thread crashes vb6 application

 

 
Powered by phpBB® Forum Software