Jump to content

Sample for COM with BCB


chrissi099

Recommended Posts

I was looking for some Examples, using dvbviewers COM interface with Borland C-Builder, nothing found. So here is a small sample source for next beginners (reading timers form DVBViewer)

 

void __fastcall TfrmMain::FillTimerBoxCOM( void )
{
Variant V;
Variant TimerCollection;
Variant tiv;
int Count;
AnsiString buf;
int i,j;
TimerEntry * te; // simple defined structure, you will find it out ;-)
TDateTime tm;
bool btmp;
TListItem *litem;

 ClearTimerList();

 LogText2File( "     Read Timers from DVBViewer:" );  // simple logging function of main program

 try {
   V  = Variant::GetActiveObject("DVBViewerServer.DVBViewer");
 } catch(...){
   LogText2File( "     DVBViewer not found" );
   return;
 }

 TimerCollection = V.OlePropertyGet("TimerManager");
 Count = TimerCollection.OlePropertyGet( "Count" );


 for ( i=0; i<Count; i++ ) {
   tiv = TimerCollection.OlePropertyGet( "Item", i );

   te = new TimerEntry;
   FTimerList->Add( te );

   buf = tiv.OlePropertyGet( "Description" );
   te->Titel = buf;

   buf = tiv.OlePropertyGet( "ChannelName" );
   te->Sender = buf;

   btmp = tiv.OlePropertyGet( "Recording" );
   te->isRecording = btmp;

   btmp = tiv.OlePropertyGet( "Executeable" );
   te->TimerError = !btmp;

   tm = (double)tiv.OlePropertyGet( "Date" );
   te->Datum = tm;

   tm = (double)tiv.OlePropertyGet( "StartTime" );
   te->Start = tm+te->Datum;

   tm = (double)tiv.OlePropertyGet( "EndTime" );
   te->End = tm+te->Datum;

   if (( (double)te->End - (double)te->Start ) < 0.0 )
     te->End += 1.0;
 }
}

 

HTH

Greetings, Christian

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...