comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Problem concerning accessing external library in IDL6.0
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Problem concerning accessing external library in IDL6.0 [message #47746] Thu, 02 March 2006 09:55 Go to next message
Rick Towler is currently offline  Rick Towler
Messages: 821
Registered: August 1998
Senior Member
yingjie, Peng wrote:

> Thanks for your kind reply. I think the problem is that the library
> which I used (DirectX.Capture.dll) is COM object, but it is not an
> ActiveX library. It is a .NET library. In .NET framework, you do not
> need to (or simply you can't) register the .NET library. This
> function is used to simplify coding within the .NET framework, such as
> C#. However, for us, the IDL user, we can't use ActiveX control to
> access this kind of library any more since we can't get the CLSID.

Are you *sure* you can't get the CLSID? Again, I am not a .NET guy, but
I see a ".NET Category" in my COM/OLE browser. I can then look for
something that I might be able to find docs or guess a method... I see:

"System.Random"

I use the COM/OLE browser to get the CLSID and then create the IDL COM
object:

test=obj_new('IDLcomIDispatch$CLSID$4E77EC8F_51D8_386C_85FE_ 7DC931B7A8E7')

I then try to guess a method or two, and fail. Then I go to the VS .net
docs, find the .net random class, see that the method to get a random
number is "next" and voila!

IDL> print, test->next()
1957853535
IDL> print, test->nextdouble()
0.80895216
IDL> print,test->tostring()
System.Random
IDL> print,test->gethashcode()
54267293

So I think you should at least *try* to find the CLSID using the COM/OLE
browser. I mean it will only take a few minutes and you may save
yourself a lot of time.


If you do find the CLSID, you still may not be "out of the woods" as we
say. I have had mixed success with IDL's COM interface. Simple things
tend to work, but more complex methods can run into problems. For
example, the nextbytes method of our aforementioned system.random object
seemed very straightforward. It fills a byte array with random bytes.
So you would think it would be as easy as:

IDL> a=bytarr(5)
IDL> print, test->nextbytes(a)
IDLCOMIDISPATCH$CLSID$4E77EC8F_51D8_386C_85FE_7DC931B7A8E7:: NEXTBYTES:
Unable to call method NEXTBYTES.
The parameter is incorrect.

I tried numerous variations with no success. I'm sure there is a
reason, and maybe some way to get it to work, but my point is that it
isn't always smooth sailing on the IDL COM seas.


So in the end you may end up writing a DLM anyways. It isn't as hard as
it may seem, especially if you buy Ronn Kling's book "Calling C from
IDL". You can order it from his website www.kilvarock.com.

Good luck!

-Rick
Re: Problem concerning accessing external library in IDL6.0 [message #47752 is a reply to message #47746] Thu, 02 March 2006 05:32 Go to previous messageGo to next message
Haje Korth is currently offline  Haje Korth
Messages: 651
Registered: May 1997
Senior Member
Did you check the webcam manual to see whether it is VFW compatible at all?
If not, this DLM is not the way to go for you! Then the question is whether
to spend days/weeks on programming or 50 Euro for a new web cam. Personally,
I would go for the latter...

Haje


"yingjie, Peng" <yingjiepeng@yahoo.com> wrote in message
news:1141253695.165134.309290@j33g2000cwa.googlegroups.com.. .
> Hi, Ronn
> Thanks for your kind reply. I have tried the library and the test code
> you gave to me. When I run the test code, I received an error message:
> These are the devices found
> Microsoft WDM Image Capture (Win32)Version: 5.1.2600.1106
> % TESTVFW: No WebCam found
> I did connect my Web Cam to my computer through USB. I also have no
> idea whether the Microsoft WDM Image Capture has relationship with the
> Web Cam or not. I will spend more time to read the instruction of
> Randall Frank's library and try again. I will tell you my results later
> and if you have some good suggestions, please let me know. Thanks a
> lot.
>
> Yingjie, Peng
> Information Department VII
> University of Wurezburg
> Germany
>
Re: Problem concerning accessing external library in IDL6.0 [message #47754 is a reply to message #47752] Thu, 02 March 2006 02:35 Go to previous messageGo to next message
ronn is currently offline  ronn
Messages: 123
Registered: April 1999
Senior Member
Someone else just emailed me and reported the same problem. I have
this running on two windows XP computers but I don't remember having to
do anything special. I am getting ready to add it to a third later
today so I may have the same problem.

-Ronn
Re: Problem concerning accessing external library in IDL6.0 [message #47755 is a reply to message #47754] Wed, 01 March 2006 14:54 Go to previous messageGo to next message
yingjie, Peng is currently offline  yingjie, Peng
Messages: 11
Registered: March 2006
Junior Member
Hi, Ronn
Thanks for your kind reply. I have tried the library and the test code
you gave to me. When I run the test code, I received an error message:
These are the devices found
Microsoft WDM Image Capture (Win32)Version: 5.1.2600.1106
% TESTVFW: No WebCam found
I did connect my Web Cam to my computer through USB. I also have no
idea whether the Microsoft WDM Image Capture has relationship with the
Web Cam or not. I will spend more time to read the instruction of
Randall Frank's library and try again. I will tell you my results later
and if you have some good suggestions, please let me know. Thanks a
lot.

Yingjie, Peng
Information Department VII
University of Wurezburg
Germany
Re: Problem concerning accessing external library in IDL6.0 [message #47756 is a reply to message #47755] Wed, 01 March 2006 14:52 Go to previous messageGo to next message
yingjie, Peng is currently offline  yingjie, Peng
Messages: 11
Registered: March 2006
Junior Member
Hi, Rick
Thanks for your kind reply. I think the problem is that the library
which I used (DirectX.Capture.dll) is COM object, but it is not an
ActiveX library. It is a .NET library. In .NET framework, you do not
need to (or simply you can't) register the .NET library. This
function is used to simplify coding within the .NET framework, such as
C#. However, for us, the IDL user, we can't use ActiveX control to
access this kind of library any more since we can't get the CLSID.

BTW, do you have any library or do you know where I can find some
library to control a web cam from IDL? Thanks a lot.

Yingjie, Peng
Information Department VII
University of Wurezburg
Germany
Re: Problem concerning accessing external library in IDL6.0 [message #47773 is a reply to message #47756] Tue, 28 February 2006 13:41 Go to previous messageGo to next message
ronn is currently offline  ronn
Messages: 123
Registered: April 1999
Senior Member
Hi Peng,

Have you tried using Randall Frank's Video For Windows dll on my
website?

http://www.kilvarock.com/freesoftware/dlms/randallfrank.htm

I am currently using it to control a web cam from IDL and it works
great.

Here is a simple test procedure that you can use

pro testVFW

if VFW_PRESENT() eq 0 then begin
void = dialog_message('No Devices Found!')
return
endif

err=VFW_LIST(names,descs)

print, 'These are the devices found'
location = -1
for i=0,n_elements(names)-1 do begin
print, names[i], descs[i]
;find the webcam
if strpos(strupcase(names[i]),'WEBCAM') ge 0 then location=i+1
endfor

if location eq -1 then message,'No WebCam found'

err = VFW_CONNECT(location)
if err ne 0 then message,'Cannot connect to Webcam'
err= vfw_dialog(1)
err = vfw_grab(image, info)
window,0,xsize=(info.dimensions)[0],ysize=(info.dimensions)[ 1]
tvscl,image,/true
for i=0,10 do begin
err = vfw_grab(image, info)
tvscl,image,/true
endfor

return & end

thanks,
Ronn Kling
KRS, inc.
email: ronn@rlkling.com
Use these books to upgrade your IDL skills.
"Application Development with IDL"
"Calling C from IDL, Using DLM's to extend your IDL code". SECOND
EDITION includes C++ and debugging!
"Power Graphics with IDL, A Beginner's Guide to Object Graphics",
Re: Problem concerning accessing external library in IDL6.0 [message #47782 is a reply to message #47773] Tue, 28 February 2006 10:51 Go to previous messageGo to next message
Rick Towler is currently offline  Rick Towler
Messages: 821
Registered: August 1998
Senior Member
yingjie, Peng wrote:

> I am a master student in Germany. Now we are planning to use IDL 6.0 to
> develop software for our smart rover robots. This project requires the
> software should be able to capture video from a camera (e.g. a Webcam).
> It seems to me that it's almost impossible to complete this job
> purely in IDL.

Well, yes and no. If your webcams are networked then you can grab
images using IDL's SOCKET procedure. Those interfaces tend to be slow
though which may not work for your application. If your webcams are
serial/USB based then yes, you will need to use one of the external
interfaces provided by IDL.

> So we plan to use a well developed class library
> (DirectX.Capture.dll). Since I am not very sure about how to use an
> external library, the only way for me is to use ActiveX Control to
> access this library. In order to get the COM object's class
> identifier (CLSID), I try to use the command line below to register
> this library: regsvr32 DirectX.Capture.dll. Unfortunately, I received
> an error message: the DirectX.Capture.dll is loaded, but cannot find
> the DllRegisterServer entry point and the registration failed. The
> reason I finally figured out is that this library is a .NET library,
> which do not need to be registered under .NET framework. But without
> the CLSID, I have no idea how to use ActiveX control to access this
> library anymore. Could you please give me some idea how to achieve this
> requirement? Thank you very much for your kind assistance!

Does that library implement a COM/ActiveX interface? (I'm no COM expert
but the error makes me think it doesn't.) If it does, you should be
able to get the CLSID using the COM/OLE viewer which ships with MS
visual studio and can also be downloaded for free from MS.

I would start with the docs for the capture library and determine what
interfaces it provides. Then it would be worth your time to read the
external development guide ($IDL_DIR/help/edg.pdf) to learn about the
different methods for accessing external libraries. With that
information you should be able to determine the best technique and move
forward from there.

-Rick
Re: Problem concerning accessing external library in IDL6.0 [message #47818 is a reply to message #47754] Mon, 06 March 2006 05:23 Go to previous message
ronn is currently offline  ronn
Messages: 123
Registered: April 1999
Senior Member
Hello Peng,
I just loaded IDL6.2 on a new XP machine, the Creative WebCam software
and the idl_tools dll and dlm and everything worked great. I will bet
that Haje is correct in that your weCam doesn't support VFW.

-Ronn
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: idl 6.2 segmentation fault on SUSE 10
Next Topic: Re: problem with dual monitor setup

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:49:05 PDT 2025

Total time taken to generate the page: 0.00563 seconds