Sign in to follow this  
Followers 0
neo van matix

ObjCreate() - doesn't work?!

10 posts in this topic

#1 ·  Posted (edited)

Hi,

i'm trying to integrate an ActiveX-Control from the Mobotix SDK.

Mobotix is a leading company in the IP-Videocam branch.

The ActiveX-Control is used in IE to stream Video&Audio from the mobotix-cam in its native codec (mxpeg).

I'm sorry, its the first time i try to implement an activeX-obj in autoit...

What i have:

- a *.cab; in it:

-> the ocx-file

-> an ini-file with the content:

[version]
signature="$CHICAGO$"
AdvancedINF=2.0
[Add.Code]
MxPEG_ActiveX.ocx=MxPEG_ActiveX.ocx
[MxPEG_ActiveX.ocx]
file-win32-x86=thiscab
clsid={304171C0-65EA-4B51-B5D9-93A311E26EB1}
FileVersion=1,6,3,0
RegisterServer=yes

- A working implementation of this activex-control in IE and a full description of the parameters:

http://developer.mobotix.com/mobotix_sdk_1.0.2/ocx/MxPEG_ActiveX.html

My Problem: I cant create an object of this ocx in autoit.

Sample:

$path = @ScriptDir&"\MxPEG_ActiveX.ocx"
IF NOT FileExists($path) Then MsgBox(16, "", "error")
 
$mxpeg_activex_obj = ObjCreate($path)
 
if not IsObj($mxpeg_activex_obj) then msgbox(0,"", "no object")

The MsgBox is poping up with "no object". I tried MxPEG_ActiveX.cab instead of the ocx-file - but with the same error.

Where's my mistake? Is there a... "limitation" or something, that not every ActiveX-component can be implemented in autoit?

*Update* This is a link to the *.cab-file, if you would like to test is by yourself.

Edited by neo van matix

Attention! English noob ^^

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

I registered it by "regsvr32 *.ocx" successfully, but if i run my autoit-script, i always get a "no object"-error :-/

Do you have another idea, what could be wrong?

Edited by neo van matix

Attention! English noob ^^

Share this post


Link to post
Share on other sites

What makes you think ObjCreate() takes a path to a file as an argument? The help file should be your first stop.

Share this post


Link to post
Share on other sites

Works for me. Try this first:

$mxpeg_Obj = ObjCreate("MXPEGACTIVEX.MxPEGActiveXCtrl.1")

then follow wraithdu's path. That's where I started and still return for searching...

Share this post


Link to post
Share on other sites

U can use this code to list all COM objects:

Br,

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

Hi,

thanks for your aswers.

I tried to specify a path, because i searched for some examples. There where several, that used the OCX-File to create the object (like WMPlayer.ocx).

It seems, that i've another problem:

I put the OCX to c:\ and typed "regsvr32 *.ocx" in cmd (started with admin-rights). Then i get a msg, that the ocx-file was successfully registered.

Then i run the script, that UEZ posted - no entry for MXPEGACTIVEX... if i run my script with the correct Object-Path (posted by taietel), i still get "no object".

I googled for a solution; i tried to deregister and re-register the ocx (both times with success, if i promise the windows-dialogs..), but still no COM-Object installed.

I'm running Win7 x64, but i thought, i could still register 32bit-OCX-files? I copyied the ocx to windows\syswow64\ too and registered it there - success, but no COM-Object listed...


Attention! English noob ^^

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

That was it... i get no object, because the script runs on 64bit... thank you! :-)

*Update* And my next problem...

Original, in IE source, there will be set some parameters to initialisize the addin:

<OBJECT id=mxpeg1
        name="mxpeg1"
        style="width:400px;height:300px;border:2px solid #000000;"
        classid='clsid:304171C0-65EA-4B51-B5D9-93A311E26EB1'
        codebase='../paks/MxPEG_ActiveX.cab#version=1,6,3.0'
>
 
  <PARAM NAME="IP" VALUE="10.3.136.84">
  <PARAM NAME="Port" VALUE="80">
  <PARAM NAME="SSL" VALUE="0">
  <PARAM NAME="Audio" VALUE="1">
  <PARAM NAME="AudioToCam" VALUE="0">
  <PARAM NAME="AudioFullduplex" VALUE="0">
 
  <PARAM NAME="Framerate" VALUE="25">
  <PARAM NAME="EnablePopupmenu" VALUE="1">
  <PARAM NAME="EnableClickInterface" VALUE="0">
  <PARAM NAME="DisplayStrategy" VALUE="minimum delay">
  <PARAM NAME="Proxy" VALUE="">
  <PARAM NAME="ProxyPort" VALUE="">
  <PARAM NAME="ScaleImage" VALUE="Auto">
  <PARAM NAME="AccessLevel" VALUE="User">
  <PARAM NAME="Username" VALUE="">
 
  <PARAM NAME="Password" VALUE="">
  <PARAM NAME="BackColor" VALUE="0x00ff0000">
  <PARAM NAME="Player" VALUE="0">
  <PARAM NAME="Live" VALUE="1">
  <PARAM NAME="UnLockCode" VALUE="">
  <PARAM NAME="FireEventOnFinishedFrame" VALUE="0">
  <PARAM NAME="maxdelay" VALUE="15">
  <PARAM NAME="GoodRender" VALUE="1">
 
 
</OBJECT>

I tried to set them by:

With $mxpeg_obj
.IP = "192.168.1.1"
.Port = "80"
...
WEnd

or

$mxpeg_obj.ip = "..."

but i'm getting the error:

xxx\mxactivex.au3 (27) : ==> The requested action with this object has failed.:
$mxpeg_Obj.Port = 80
$mxpeg_Obj.Port = 80^ ERROR

Is there something wrong in the way i try to set the parameters?

I'm tried to adapt the namens&functions from the javascript-IE-code:

<SELECT name=mode1 style="WIDTH: 250px" size=1 ID="id_Mode" onchange='if (this.form.mode1.value=="Live") {document.all.mxpeg1.Live=1;} else if (this.form.mode1.value=="Player") {document.all.mxpeg1.Player=1;} else if (this.form.mode1.value=="HttpClip") {document.all.mxpeg1.HttpClip=""} else {};ShowOrHide(this);'>
   <OPTION selected value="Live">Live</OPTION>
   <OPTION value="Player">Player</OPTION>
   <OPTION value="HttpClip">HttpClip</OPTION>
 
  </SELECT>

-> mxpeg1 should be the activeX-class, so "Live" should be a method or variable. But $mxpeg_obj.live=1 isn't working, same error as above :/

Edited by neo van matix

Attention! English noob ^^

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

Dont know much about objects, but think I've seem some values set like this

$obj.IP("192.168.1.1")

$obj.Port(80)

Also you entered your port as a string when its a long on that page you linked, so just try = 80

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0