Hi,
in a project we want to use the DCOM-API of a Win98-based measurement instrument.
We need to access different so called Inputs which have some common settings but also some individual settings.
This is mapped to the API by creating a Class "IInput" (which is IDispatch type according to OLEViewer.exe) for all the settings common to all the channels, and to derive other Classes like "IBridgeInput" (which is IInput type according to OLEViewer.exe) for the specific settings.
To my understanding so far IBridgeInput inherits the structure from IInput and adds the additional special features.
Well, so far so good:
The problem arises from the way of access to the objects.
+++The only way+++ to access the API is by referencing a structure in a way like:
my $MyInput = $InputBoard->Inputs->Item(3)
here the method Item($i) return ++always++ an IInput-type, however the physical situation is:
Item(1) and Item(2) are in fact IInput (only common settings)
Item (3) is an IBridgeInput (certain special settings)
Item (4) is a IIPCInput (other certain special settings)
Item(5) is a ICounterInput (again other special settings)
The API defines this types and exports them, i.e. when I do the same in Visual Basic I just do
Dim MyInput as BridgeInput; REM make it a bridge input, no matter what is returned
Set MyInput = InputBoard.Inputs.Item(3)
and violas, I can access common ++and++ special settings.
So my question is: Is there a way to cast an OLE-Object type onto an existing/returned Object of parent-type.
Like:
my $MyInput = $InputBoard->Inputs->Item(3);
castObjectType($MyInput, BridgeInput); # function non-existent
which is a replacement for the explicit "DIM .... as ...." in Visual Basic.
Sorry for the long description, but it's a difficult issue I think,
TIA,
Thomas
--------------------------------------------------------------------------------------
Dr. Thomas Bruns <[EMAIL PROTECTED]>
Physikalisch-Technische Bundesanstalt
Braunschweig
Arbeitsgruppen: 1.31 & 1.34
Bundesallee 100 Tel: 0531/592 - 1220
D-38116 Braunschweig Fax: 0531/592-69-1220
--------------------------------------------------------------------------------------
_______________________________________________ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs