🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.delphi.activex.controls.using
1 messages
1 total messages Started by Mark Gorst Wed, 15 Jun 2005 14:27
3rd Party Active X control - odd behaviour
#90
Author: Mark Gorst
Date: Wed, 15 Jun 2005 14:27
185 lines
9325 bytes
This is a multi-part message in MIME format.

------=_NextPart_000_0209_01C571BE.ADB9B140
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

I'm using a 3rd party controller for a hi-res digital camera. The =
manufacturer supplies a series of COM objects which import fine, and =
give me 11 new entries on my ActiveX control menu. However the behaviour =
is not as expected. They have a support forum but are not currently =
replying, and there is already an entry there with exactly the same =
problem. The supply an example in MS Visual Studio (yawn) which works =
fine. So it's something with Delphi that's not quite working.=20

The theory is that there is a camera class which has a list of devices =
(camera.devices.count) and you pick one and set camera.device to that =
camera (as you may have more than one connected, plus there is always at =
least one in a software emulation).

However if you look at camera.devices then it's "nil". So you can't get =
the device. They have posted a work round whereby you load the another =
set of controls in the "singleton server" and access the device count =
list from there, this works fine, but you can't get the=20
device from that list to assign. In both modules the class of the device =
is TU1Device, but as the class definitions are from different modules =
they neither can assign or be cast.

I know that this is really something that the 3rd party should help =
with, but so far we've not managed to get any help, but are gradually =
shouting louder and louder.

We're still in Delphi7, as was the other person with the same problem. =
They tried the fix in Delphi 2005, but didn't take it far enough to be =
useful.

I was wondering if this rings and bells and anyone has any suggestions =
as to what I could try next. The relevant bit of posting from their site =
as an explantion is below, the assignment they can't do is the one I =
want to do FUICamera.Device and FU1Devices are both of the same type in =
terms of name (TU1Device) but defined in different modules).

As a work-around, I imported the type library for DsU1.exe (appears as =
Nikon DS-5M-U1 SDK Server).  This out-of-process COM server is the =
low-level module that creates the U1Devices collection for DsCamera.dll. =
 This collection is a singleton object, so all references point to the =
same object in memory.  So, the following code returns the correct value =
for the device count:
    FU1Devices :=3D TU1Devices.Create (Self);
    DeviceCount :=3D FU1Devices.Count;

    if DeviceCount > 0 then
    begin
      FU1Camera :=3D TU1Camera.Create(Self);
      // FU1Camera.Device :=3D FU1Devices[0];
      AStr :=3D IntToStr(DeviceCount) + ' Devices found.';
    end;


Delphi 2005 wouldn't let me do the assignment that is commented out.  =
The reason is that U1Device was qualified differently for each type =
library.  From your note on TImage, you might not have to worry about =
this with Delphi 7.



We've used Delphi quite successfully with other manufacturers COM =
objects, but this one has us stumped, especially when it appears to be =
ok for VC++. Thanks in anticipation

Mark

------=_NextPart_000_0209_01C571BE.ADB9B140
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1400" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>I'm using a 3rd party controller for a =
hi-res=20
digital camera. The manufacturer supplies a series of COM objects which =
import=20
fine, and give me 11 new entries on my ActiveX control menu. However the =

behaviour is not as expected. They have a support forum but are not =
currently=20
replying, and there is already an entry there with exactly the same =
problem. The=20
supply an example in MS Visual Studio (yawn) which works fine. So it's =
something=20
with Delphi that's not quite working. </FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>The theory is that there is a camera =
class which=20
has a list of devices (camera.devices.count) and you pick one and set=20
camera.device to that camera (as you may have more than one connected, =
plus=20
there is always at least one in a software emulation).</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>However if you look at camera.devices =
then it's=20
"nil". So you can't get the device. They have posted a work round =
whereby you=20
load the another set of controls in the "singleton server" and access =
the device=20
count list from there, this works fine, but you can't get the =
</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>device from that list to assign. In =
both modules=20
the class of the device is TU1Device, but as the class definitions are =
from=20
different modules they neither can assign or be cast.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I know that this is really something =
that the 3rd=20
party should help with, but so far we've not managed to get any help, =
but are=20
gradually shouting louder and louder.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>We're still in Delphi7, as was the =
other person=20
with the same problem. They tried the fix in Delphi 2005, but didn't =
take it far=20
enough to be useful.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I was wondering if this rings and bells =
and anyone=20
has any suggestions as to what I could try next. The relevant bit of =
posting=20
from their site as an explantion is below, the assignment they can't do =
is the=20
one I want to do FUICamera.Device and FU1Devices are both of the same =
type in=20
terms of name (TU1Device) but defined in different =
modules).</FONT></DIV>
<DIV><FONT color=3D#0000ff></FONT>&nbsp;</DIV>
<DIV><FONT color=3D#0000ff>As a work-around, I imported the type library =
for=20
DsU1.exe (appears as Nikon DS-5M-U1 SDK Server).&nbsp; This =
out-of-process COM=20
server is the low-level module that creates the U1Devices collection for =

DsCamera.dll.&nbsp; This collection is a singleton object, so all =
references=20
point to the same object in memory.&nbsp; So, the following code returns =
the=20
correct value for the device count:</FONT></DIV>
<DIV>
<P><FONT color=3D#0000ff>&nbsp;&nbsp;&nbsp; FU1Devices :=3D =
TU1Devices.Create=20
(Self);<BR>&nbsp;&nbsp;&nbsp; DeviceCount :=3D =
FU1Devices.Count;</FONT></P>
<P><FONT color=3D#0000ff>&nbsp;&nbsp;&nbsp; if DeviceCount &gt; 0=20
then<BR>&nbsp;&nbsp;&nbsp; begin<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
FU1Camera :=3D=20
TU1Camera.Create(Self);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // =
FU1Camera.Device :=3D=20
FU1Devices[0];<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AStr :=3D =
IntToStr(DeviceCount) +=20
' Devices found.';<BR>&nbsp;&nbsp;&nbsp; end;</FONT></P><FONT =
face=3DArial=20
size=3D2></FONT><FONT face=3DArial size=3D2></FONT>
<P><BR><FONT color=3D#0000ff>Delphi 2005 wouldn't let me do the =
assignment that is=20
commented out.&nbsp; The reason is that U1Device was qualified =
differently for=20
each type library.&nbsp; From your note on TImage, you might not have to =
worry=20
about this with Delphi 7.</FONT></P>
<P><FONT color=3D#0000ff></FONT>&nbsp;</P>
<P><FONT face=3DArial size=3D2>We've used Delphi quite successfully with =
other=20
manufacturers COM objects, but this one has us stumped, especially when =
it=20
appears to be ok for VC++. Thanks in anticipation</FONT></P>
<P><FONT face=3DArial size=3D2>Mark</FONT></P></DIV></BODY></HTML>

------=_NextPart_000_0209_01C571BE.ADB9B140--
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads