Subject:
|
Re: ASP and Spirit.ocx
|
Newsgroups:
|
lugnet.robotics
|
Date:
|
Sun, 14 Nov 1999 22:58:39 GMT
|
Original-From:
|
peter renshaw <GOON@BATTINC.COM.AUantispam>
|
Viewed:
|
912 times
|
| |
| |
At 10:22 11/13/99 GMT, you wrote:
> Hi all,
>
> I've built a mount for my webcam out of the Mindstorms kit - but I can't see
> how to use the spirit.ocx in my ASP.
>
> Has anyone already done this? All I really need to see is how you talk to
> the ocx from your ASP - just for a simple pan/tilt webcam mount.
yeah I've had a stab at this a while ago. I should write this up I guess.
The main problem I found with the spirit.ocx is the that (as far as I can
tell) is not a console app, say like an ActiveX dll. Read the steps below I
took....
1. Install the OCX into c:\winnt\system32(\inetsrv) _< this is optional
...Web server path
2. Register the OCX with regsrv32 in the directory path. ... register OCX
so web server can see it a s inprocess DLL
3. Test if OCX is registered (ie: create object in Visual Interdev and see
if the properties, methods are there
with code completion...
4. create myLegoAspPage.asp as follows....
'# ------------------------------------------------------------------------
'#
option explicit '#check for undimensioned vars
...............
...............
...............
dim myLegoObj '#dimension var
dim getLinkType '#type of link (1:IR,2:Cable,3:Radio)
'#
'#create instance of lego object
'#note here the 'projectName.className' to reference the OCX
"#took a whike hunting throught ther registry to find this
'#
set myLegoObj = server.CreateObject("SPIRITLib.Spirit.1")
'#
'#test object is valid
'#
if ( isObject(myLegoObj)=true ) then
'#valid
'#get return type of link
getLinkType=myLegoObj.LinkType
'#write valid result: what type of link type to pBrick
response.write("object success - getLinkType=" & getLinkType & "<br>" &
vbCrLf)
else
'#invalid
response.write("object creation failed!" & "<br>" & vbCrLf)
end if
myLegoObj=nothing '#dereference object
'#
'#----------------------------------------------------------------------
Problems:
Registering the OCX. Took a while to find the correct OCX name, register
the OCX with regsrv32 etc. Now when I tried the code above (or code
slightly different to this) it failed on (by memory: i did this a while
ago) on either the creation of the object or a particular method used. The
reason I suspect is that the method I called a method had a visual control.
Poor old IIS had a heart attack and failed.
Solution:
The way around this is to use VB, and test the methods to see if any
visual controls do indeed pop up.
Then test which methods return basic types such as integers, strings etc.
This would all be nice and easy had the Lego OCX been an ActiveX dll (or
included a ActiveX dll) thus allow a console interface to work with.
> I've previously used ASP to connect to databases using ADO, but I've never
> had to instantiate any other controls.
If you have used ADO, you can use the OCX. Regesting the OCX is the hard
bit (finding the project name and class name), then knowing what to do them
is the next. It was about this time that I really wanted to make more lego
robots. I'd by then switched to RCX and never quite got back to it. Let us
know how you progress. There are lot's of steps I've left out
Regs PR
|
|
Message has 1 Reply: | | Re: ASP and Spirit.ocx
|
| Try something a little more like this: option explicit dim PBrickCtrl dim getLinkType set PBrickCtrl = server.CreateObject(...itCtrl.1") if ( isObject(PBrickCtrl)=true ) then getLinkType=PBrickCtrl.LinkType response.write("object success - (...) (25 years ago, 8-Jan-00, to lugnet.robotics)
|
Message is in Reply To:
| | ASP and Spirit.ocx
|
| Hi all, I've built a mount for my webcam out of the Mindstorms kit - but I can't see how to use the spirit.ocx in my ASP. Has anyone already done this? All I really need to see is how you talk to the ocx from your ASP - just for a simple pan/tilt (...) (25 years ago, 13-Nov-99, to lugnet.robotics, lugnet.robotics.tele)
|
6 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
This Message and its Replies on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|