SmartCode Web Forum

Problem using OpenFileTransfer in HTML code

https://www.s-code.com/forum/Topic3135.aspx

By Bonji - 30 Jul 2010

I'm trying to create a button that opens the File Transfer window, but I've been unsuccessful so far.

Here's the button itself:

<input onclick="OnXfer()" type="button" value="File Transfer">


Here's the javascript for the button:

function OnXfer() {
   window.ViewerX.OpenFileTransfer()
}



And here's how I define the object I'm manipulating:

   <OBJECT id="ViewerX" style="BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid; BORDER-LEFT: 1px solid; BORDER-BOTTOM: 1px solid"
    width="1022" height="639" classid="CLSID:62FA83F7-20EC-4D62-AC86-BAB705EE1CCD" VIEWASTEXT CodeBase="viewerx.cab">



It seems to me that the ViewerX object is using the ISmartCodeVNCViewer interface when I actually need to use the ISmartCodeVNCViewer2 interface because that is the one that contains the OpenFileTransfer method.  I always get the error "Object expected" when I call the OpenFileTransfer function.

Any suggestions?  Also, HTML code examples are required as I can't translate other programming languages into the necessary HTML code.  Thanks!
By Yury Averkiev (s-code) - 30 Jul 2010

Hi, I just tested File Transfer via our Web VNC page and it works just fine.

Most likely window.ViewerX in your code returns null object and that's why you are getting the error.
Please double check this by running the page under a debugger.

Just to let you know, when an ActiveX is instantiated in IE, it will return pointer to its "default" interface. Default interface for the current version of ViewerX is ISmartCodeVNCViewer3.

One more thing CodeBase="viewerx.cab">
The cab file for ViewerX was renamed to scvncctrl.cab a long time ago.

Please let me know if you need any additional assistance.
By Bonji - 2 Aug 2010

I figured out I'm using a version that is quite a bit older than the latest release, and the latest version has all methods available in the default interface.  Also, I renamed the cab file myself just for simplicity.

Thanks!