🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

API Ado Events (not AdoExpress)

#155
From: Maurice Anderson
Date: Sat, 14 Apr 2007 20:26
44 lines
2200 bytes
I am not usung AdoExpress.

I have some Ado code using the API which works good.

        hr = CoCreateInstance(
                CLSID_CADOConnection,
                NULL,
                CLSCTX_INPROC_SERVER,
                IID_IADOConnection,
                (LPVOID *)&piTmpConnection
        );

        hr = piTmpConnection->put_Provider(L"Microsoft.Jet.OLEDB.4.0");
        piTmpConnection->put_Mode(adModeReadWrite);

        if(FAILED(hr))
        {
          return status;
        }

        hr = piTmpConnection->Open(
                        WideString(FConnectionString), WideString(FUser),
                                   WideString(FPassword),
adConnectUnspecified);

I also have a event handler; something like:

          if( FOnConnect != NULL )
          {
                        // call the handler
             FOnConnect( this, GetErrorMessage(hr), hr, IntToHex((int)hr,
10));

          }

Assume all the code snippet above works fine.  I now want to use Ado Events
to fire when I connect and disconnect.  msdn defines the events here:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ado270/htm/mdmthcnnopen.asp

My question is, how do I implement the Events?  How would I integrate them
into my evens handly system?

Thanks
Technical Details
Message-ID: <462a89db$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 10698b,c7474627bd251e5e,start
X-Google-Attributes: gid10698b,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Maurice Anderson" <mauriceanderson@hotmail.com>
Newsgroups: borland.public.cppbuilder.database.ado
Subject: API Ado Events (not AdoExpress)
Date: Sat, 14 Apr 2007 13:26:23 -0700
Lines: 47
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3028
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028
NNTP-Posting-Host: 64.30.203.223
Message-ID: <462a89db$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1177192923 64.30.203.223 (21 Apr 2007 15:02:03 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail