🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.database.ado
Article #399

Re: Getting ADO events in a DLL???

#399
From: Clayton Arends
Date: Tue, 17 Oct 2006 16:16
52 lines
2409 bytes
Since all event handlers are "closures" (a pointer to a method in a class) 
you will need an object that handles your ADOp connection and houses the 
event handlers.  Something like this should work for you:

  class TMyDllClass
  {
    private:
      TADOConnection* ADOp;

      void __fastcall ADOpConnectComplete(TADOConnection* Connection,
        const _di_Error Error, TEventStatus &EventStatus);
      void __fastcall ADOpWillConnect(TADOConnection* Connection,
        WideString &ConnectionString, WideString &UserID,
        WideString &Password, TConnectOption &ConnectOptions,
        TEventStatus &EventStatus);

    public:
      TMyDllClass();
      ~TMyDllClass();
  };

  TMyDllClass::TMyDllClass()
  {
    OleInitialize(NULL);

    ADOp = new TADOConnection(NULL);
    ADOp->OnConnectComplete = &ADOpConnectComplete;
    ADOp->OnWillConnect = &ADOpWillConnect;
  }

  TMyDllClass::~TMyDllClass()
  {
    OleUninitialize();
  }

  void __fastcall TMyDllClass::ADOpConnectComplete(TADOConnection* 
Connection,
    const _di_Error Error, TEventStatus &EventStatus)
  {
    // do whatever
  }

  void __fastcall TMyDllClass::ADOpWillConnect(TADOConnection* Connection,
    WideString &ConnectionString, WideString &UserID,
    WideString &Password, TConnectOption &ConnectOptions,
    TEventStatus &EventStatus)
  {
    // do whatever
  }

HTH,
- Clayton
Technical Details
Message-ID: <453501c8$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <1161099090.459997.102700@m7g2000cwm.googlegroups.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10698b,b68f8160aec90a52
X-Google-Attributes: gid10698b,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Clayton Arends" <nospam_claytonarends@hotmail.com>
Newsgroups: borland.public.cppbuilder.database.ado
References: <1161099090.459997.102700@m7g2000cwm.googlegroups.com>
Subject: Re: Getting ADO events in a DLL???
Date: Tue, 17 Oct 2006 09:16:28 -0700
Lines: 54
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2869
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2962
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 71.83.251.192
Message-ID: <453501c8$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1161101768 71.83.251.192 (17 Oct 2006 09:16:08 -0700)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail