🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #2151

API Ado Events (not AdoExpress)

#2151
From: Maurice Anderson
Date: Fri, 13 Apr 2007 15:34
44 lines
2161 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: <461fa306$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news4.google.com!news.germany.com!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,ac92c1e5cbb18641,start
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Maurice Anderson" <mauriceanderson@hotmail.com>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: API Ado Events (not AdoExpress)
Date: Fri, 13 Apr 2007 08:34:21 -0700
Lines: 46
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: <461fa306$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1176478470 64.30.203.223 (13 Apr 2007 08:34:30 -0800)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news4.google.com!news.germany.com!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail