IT SOLUTIONS
Your full service technology partner! 
-Collapse +Expand
Delphi
Search Delphi Group:

Advanced
-Collapse +Expand Delphi To/From
To/FromCODEGuides
-Collapse +Expand Delphi Store
PRESTWOODSTORE

Prestwood eMagazine

January Edition
Subscribe now! It's Free!
Enter your email:

   ► MB LobbyPascal and Delphi Coding BoardDelphi COM / ActiveX / DCOM Topic   Print This     

COM Routine Problems

COM Routine Problems in Delphi COM / ActiveX / DCOM topic (part of our Pascal and Delphi Coding group).

Quick Search: Routine   Problems   COM Routine   COM Routine Problems  
gordon
 (Inactive)
-- USA
I have imported a COM Dll and I need to use a class in it called
_IVIADABRXEVENTS This has no CoClass declaration, but there is one other
CoClass declaration, that I can use. It is kind of hard to descibe, so I
have appended the source code to bellow my message. If anyone can shed any
light. Please let me know.



Gordon
p.s. A resolution to my previous post would solve the problem below, but if no-one has any thoughts on my Component Wrappers problem then an answer to this in the short term would be good...

Thanks

Gordon
=======================
unit VIADABRECEIVERLib_TLB;

// ************************************************************************
//
// 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.
// ************************************************************************
//

// PASTLWTR : $Revision: 1.88 $
// File generated on 08/03/2001 18:49:48 from Type Library described below.

// ************************************************************************
//
// Type Lib: C:\Program Files\Common Files\RadioScape\ViadabReceiver.dll (1)
// IID\LCID: {E0EDB401-885F-11D3-982E-00C04F71996F}\0
// Helpfile:
// DepndLst:
// (1) v2.0 stdole, (C:\WINNT\System32\stdole2.tlb)
// (2) v4.0 StdVCL, (C:\WINNT\System32\STDVCL40.DLL)
// ************************************************************************
//
{$TYPEDADDRESS OFF} // Unit must be compiled without type-checked pointers.
interface

uses Windows, ActiveX, Classes, Graphics, OleServer, OleCtrls, StdVCL;

// *********************************************************************//
// GUIDS declared in the TypeLibrary. Following prefixes are used:
// Type Libraries : LIBID_xxxx
// CoClasses : CLASS_xxxx
// DISPInterfaces : DIID_xxxx
// Non-DISP interfaces: IID_xxxx
// *********************************************************************//
const
// TypeLibrary Major and minor versions
VIADABRECEIVERLibMajorVersion = 1;
VIADABRECEIVERLibMinorVersion = 0;

LIBID_VIADABRECEIVERLib: TGUID = '{E0EDB401-885F-11D3-982E-00C04F71996F}';

IID__IViadabRxEvents: TGUID = '{E0EDB412-885F-11D3-982E-00C04F71996F}';
IID_IViadabRx: TGUID = '{E0EDB410-885F-11D3-982E-00C04F71996F}';
CLASS_ViadabRx: TGUID = '{E0EDB411-885F-11D3-982E-00C04F71996F}';
type

// *********************************************************************//
// Forward declaration of types defined in TypeLibrary
// *********************************************************************//
_IViadabRxEvents = interface;
IViadabRx = interface;
IViadabRxDisp = dispinterface;

// *********************************************************************//
// Declaration of CoClasses defined in Type Library
// (NOTE: Here we map each CoClass to its Default Interface)
// *********************************************************************//
ViadabRx = IViadabRx;


// *********************************************************************//
// Declaration of structures, unions and aliases.
// *********************************************************************//
PByte1 = ^Byte; {*}


// *********************************************************************//
// Interface: _IViadabRxEvents
// Flags: (0)
// GUID: {E0EDB412-885F-11D3-982E-00C04F71996F}
// *********************************************************************//
_IViadabRxEvents = interface(IUnknown)
['{E0EDB412-885F-11D3-982E-00C04F71996F}']
function ReceiverStatusChanged(lFlag: Integer; var data: Byte; lSize:
Integer): HResult; stdcall;
function ReceiverData(lComponent: Integer; var data: Byte; lSize:
Integer): HResult; stdcall;
end;

// *********************************************************************//
// Interface: IViadabRx
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {E0EDB410-885F-11D3-982E-00C04F71996F}
// *********************************************************************//
IViadabRx = interface(IDispatch)
['{E0EDB410-885F-11D3-982E-00C04F71996F}']
function TuneTo(dMHz: Double): Integer; safecall;
function GetTrackingStatus: Integer; safecall;
function IsTuned: Integer; safecall;
function GetBER: Double; safecall;
function GetEnsemble: Integer; safecall;
function GetFirstService: Integer; safecall;
function GetNextService: Integer; safecall;
function GetFirstComponent(lService: Integer): Integer; safecall;
function GetNextComponent(lService: Integer): Integer; safecall;
function GetDABItemName(lItem: Integer): WideString; safecall;
function IsAudio(lComponent: Integer): Integer; safecall;
function SelectComponent(lComponent: Integer): Integer; safecall;
function DeselectComponent(lComponent: Integer): Integer; safecall;
function IsSelected(lComponent: Integer): Integer; safecall;
function PlayAudio(lComponent: Integer): Integer; safecall;
function StopAudio(lComponent: Integer): Integer; safecall;
function IsPlayingAudio(lComponent: Integer): Integer; safecall;
function GetProgramType(lService: Integer): Integer; safecall;
function GetComponentType(lComponent: Integer): Integer; safecall;
function GetDLS(lComponent: Integer): WideString; safecall;
function GetDABInfo(const Question: WideString): WideString; safecall;
end;

// *********************************************************************//
// DispIntf: IViadabRxDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {E0EDB410-885F-11D3-982E-00C04F71996F}
// *********************************************************************//
IViadabRxDisp = dispinterface
['{E0EDB410-885F-11D3-982E-00C04F71996F}']
function TuneTo(dMHz: Double): Integer; dispid 1;
function GetTrackingStatus: Integer; dispid 2;
function IsTuned: Integer; dispid 3;
function GetBER: Double; dispid 4;
function GetEnsemble: Integer; dispid 5;
function GetFirstService: Integer; dispid 6;
function GetNextService: Integer; dispid 7;
function GetFirstComponent(lService: Integer): Integer; dispid 8;
function GetNextComponent(lService: Integer): Integer; dispid 9;
function GetDABItemName(lItem: Integer): WideString; dispid 10;
function IsAudio(lComponent: Integer): Integer; dispid 11;
function SelectComponent(lComponent: Integer): Integer; dispid 12;
function DeselectComponent(lComponent: Integer): Integer; dispid 13;
function IsSelected(lComponent: Integer): Integer; dispid 14;
function PlayAudio(lComponent: Integer): Integer; dispid 15;
function StopAudio(lComponent: Integer): Integer; dispid 16;
function IsPlayingAudio(lComponent: Integer): Integer; dispid 17;
function GetProgramType(lService: Integer): Integer; dispid 18;
function GetComponentType(lComponent: Integer): Integer; dispid 19;
function GetDLS(lComponent: Integer): WideString; dispid 20;
function GetDABInfo(const Question: WideString): WideString; dispid 21;
end;

// *********************************************************************//
// The Class CoViadabRx provides a Create and CreateRemote method to
// create instances of the default interface IViadabRx exposed by
// the CoClass ViadabRx. The functions are intended to be used by
// clients wishing to automate the CoClass objects exposed by the
// server of this typelibrary.
// *********************************************************************//
CoViadabRx = class
class function Create: IViadabRx;
class function CreateRemote(const MachineName: string): IViadabRx;
end;

implementation

uses ComObj;

class function CoViadabRx.Create: IViadabRx;
begin
Result := CreateComObject(CLASS_ViadabRx) as IViadabRx;
end;

class function CoViadabRx.CreateRemote(const MachineName: string):
IViadabRx;
begin
Result := CreateRemoteComObject(MachineName, CLASS_ViadabRx) as IViadabRx;
end;

end.
==================


------------------
 Posted 21 years ago (Thread Starter)
Comment Quote
About gordon -Collapse +Expand
Visit Profile
Inactive member.
Member does not subscribe to this thread.
Email Not Verified!
Once email is verified, we will review and approve the account.
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html, social networking links, message board signature, company profile, etc.

Post ID #1529, 4 replies
Thread Started 3/26/2001 1:03:00 PM
View Counter=2451
Last Reply Posted 4/15/2001 11:10:00 PM)
Location=-- USA 
Joined=21 years ago   MB Posts=23  
gordon
 (Inactive)
-- USA
Thanks for the info, is there any way of importing another coClass into the Type Library. I cannot seem to get the Type Library Editor to access the file.

Many Thanks in advance

Gordon ALLAN

------------------
gordon-allan@bigfoot.com
 Posted 21 years ago (Thread Starter)
Comment Quote
About gordon -Collapse +Expand
Visit Profile
Inactive member.
Member does not subscribe to this thread.
Email Not Verified!
Once email is verified, we will review and approve the account.
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html, social networking links, message board signature, company profile, etc.

Post ID #1591 (Level 1.1)  Reply to 1529
Thread Started 3/31/2001 3:02:00 AM
View Counter=2
Location=-- USA 
Joined=21 years ago   MB Posts=23  
Most Recent Post
gordon
 (Inactive)
-- USA
Thanks for your reply. Do you have any suggestions on how I could implement the CoClass routine??

I realise that this might be quite involved, and I think I may have found another solution. I have managed to get the Component Wrapper problem sorted, and now the ViadabRxEvents Appears as an event in the Object Inspector. The only problem I have with this now, is that OLE Server that the component calls with the Connect Procedure brings up an error.

I cannot remember this error off hand, but as soon as I get back to my development station I will post it to you, and then you can let me know if this is a known problem.

The arror appears around a variable called Count which I also use in my program. This could also be the problem as my Count variable is a global one avbailable to all units in the program.

Thanks for all your help, and I will let you know as soon as I know more about the error.

In the meantime thanks for all your efforts and I hope that I can help you out some time in the future.

Thanks

Gordon
 Posted 21 years ago (Thread Starter)
Comment Quote
About gordon -Collapse +Expand
Visit Profile
Inactive member.
Member does not subscribe to this thread.
Email Not Verified!
Once email is verified, we will review and approve the account.
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html, social networking links, message board signature, company profile, etc.

Post ID #1746 (Level 1.2)  Reply to 1529
Reply Posted 4/15/2001 11:10:00 PM
Location=-- USA 
Joined=21 years ago   MB Posts=23  
William Pantoja
Woodinville, WA, USA
The problem is the type-library is incomplete if you wish to use a coClass. To the use interfance without a coClass requires implementing what Delphi normally does for you.

Check out "IConnectionPointContainer", "IConnectionPoint", and "Events in COM" in
Old UBB Archived Link: [URL=http://msdn.microsoft.com/]MSDN[/URL]
.

If you import the ADO type library (Microsoft ActiveX Data Objects 2.5 Library) you can see a real life example of how Delphi implements the coClass.

---
William Pantoja

Consultant/Software Engineer
ForceOne Technologies, Inc.

 Posted 21 years ago
Comment Quote
About William Pantoja -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.

Post ID #1586 (Level 1.3)  Reply to 1529
Reply Posted 3/30/2001 4:28:00 PM
Location=Woodinville, WA, USA  
Joined=21 years ago   MB Posts=163   KB Posts=1  
William Pantoja
Woodinville, WA, USA
Normally Delphi will do it for you when you import the type library. However, sometimes Delphi will screw it up. The coClass that Delphi creates for you is nothing more than a wrapper around the interface to make life a little easier when dealing with COM objects.

With some COM objects, you'll find that the coClass will not help or Delphi has a problem creating it when the type library is imported. In those cases, you must either create a coClass by hand or use the COM objects manually.

A good example of this is when you are dealing with Active Directory objects. Although you can import the ADSI type library, if you need to make calls to a custom interface the type library will not help you (For example, when using the IIS ADSI objects).

Hope this helps a little.

------------------
----------------------------------------
William Pantoja
Sr. Software Engineer
eTotalSource, Inc.

---
William Pantoja

Consultant/Software Engineer
ForceOne Technologies, Inc.

 Posted 21 years ago
Comment Quote
About William Pantoja -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.

Post ID #1668 (Level 1.4)  Reply to 1529
Reply Posted 4/6/2001 2:44:00 PM
Location=Woodinville, WA, USA  
Joined=21 years ago   MB Posts=163   KB Posts=1  

Revive Thread!

Add a comment to revive this old thread and make this archived thread more useful.

Write a Comment...
Full Editor
...
Sign in...

If you are a member, Sign In. Or, you can Create a Free account now.


Anonymous Post (text-only, no HTML):

Enter your name and security key.

Your Name:
Security key = P1183A1
Enter key:
Icon: A Post    Thread    Idea    Important!    Cool    Sad    No    Yes    Includes a Link...   
Thread #1529 Counter
2451
Since 4/2/2008
Go ahead!   Use Us! Call: 916-726-5675  Or visit our new sales site: 
www.prestwood.com


©1995-2022 Prestwood IT Solutions.   [Security & Privacy]