Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
|
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 28th, 2011, 03:22 AM
Registered User
 
Join Date: Nov 2011
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Question refering to com object

HI Guys

I would like to ask if I need to call a dll com object do I have to
refer to it as ActiveXObject or I can just call it like :
new com("Soundclass.Soundrec");

I would appreciate your answer soon pls thanks.

also I have a problem where I inherit a com object from a dll file like so:

<?

$test = new com("Soundclass.Soundrec");
$test->startrec;
$test->stoprec;

?>

in php I was wondering if is it possible to do this in javascript and how can I do it pls guys provide code samples if you can I as I am a javascript newbie thanks
 
Old November 28th, 2011, 04:08 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

If the DLL supports being called from script then you need:
Code:
var recorder = new ActiveXObject("Soundclass.Soundrec");
recorder.startRec();
This will only work on Internet Explorer and only if the user has allowed ActiveX to run. (There are two settings, one for safe ActiveX and another for unsafe ActiveX. Most users allow safe ones by default but I imagine that this control if unsafe so would only be suitable for an intranet scenario where you have some degree of control over the settings.)
__________________
Joe
http://joe.fawcett.name/
 
Old November 28th, 2011, 04:12 AM
Registered User
 
Join Date: Nov 2011
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Wink

Quote:
Originally Posted by joefawcett View Post
If the DLL supports being called from script then you need:
Code:
var recorder = new ActiveXObject("Soundclass.Soundrec");
recorder.startRec();
This will only work on Internet Explorer and only if the user has allowed ActiveX to run. (There are two settings, one for safe ActiveX and another for unsafe ActiveX. Most users allow safe ones by default but I imagine that this control if unsafe so would only be suitable for an intranet scenario where you have some degree of control over the settings.)
Hi Joe

Thank you for your reply, so I have to write this code on the head of the file as I am using zend or can I put this code on the body?

Last edited by Phumlani; November 28th, 2011 at 05:06 AM..
 
Old November 28th, 2011, 05:07 AM
Registered User
 
Join Date: Nov 2011
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by joefawcett View Post
If the DLL supports being called from script then you need:
Code:
var recorder = new ActiveXObject("Soundclass.Soundrec");
recorder.startRec();
This will only work on Internet Explorer and only if the user has allowed ActiveX to run. (There are two settings, one for safe ActiveX and another for unsafe ActiveX. Most users allow safe ones by default but I imagine that this control if unsafe so would only be suitable for an intranet scenario where you have some degree of control over the settings.)
Hi Joe

I have tried using your example and nothing happens here is the example of how I tested it please advise
"<script type="text/javascript">
var test = new ActiveXObject("Soundclass.Soundrec");
test.startRec ();
setTimeout("test.stoprec()",5000);
</script>
"

Last edited by Phumlani; November 28th, 2011 at 05:10 AM..
 
Old November 28th, 2011, 05:11 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

As I have no idea what should happen it's hard to tell. Unfortunately newer versions of IE hide error messages so, if you're using IE9, then you need to run the developer tools (F12 usually) and see what's going on.
Did you allow unsafe controls in your browser? Does the controls support the IQueryable interface?
__________________
Joe
http://joe.fawcett.name/
 
Old November 28th, 2011, 06:54 AM
Registered User
 
Join Date: Nov 2011
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by joefawcett View Post
As I have no idea what should happen it's hard to tell. Unfortunately newer versions of IE hide error messages so, if you're using IE9, then you need to run the developer tools (F12 usually) and see what's going on.
Did you allow unsafe controls in your browser? Does the controls support the IQueryable interface?
Hey Joe

Just a thought is possible that I can invoke the stop code on the php code I have provided above?
 
Old November 28th, 2011, 07:06 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

No, PHP code runs on the server, JavaScript runs in the browser.
__________________
Joe
http://joe.fawcett.name/





Similar Threads
Thread Thread Starter Forum Replies Last Post
program that call its method automatically mfahadwallam BOOK: Beginning Java 2 0 January 28th, 2008 09:26 AM
Calling a function on every method call Takashi321 General .NET 1 September 21st, 2007 09:33 AM
Can I call a method that populate a Label??? cp75 ASP.NET 1.0 and 1.1 Basics 2 January 12th, 2007 05:39 AM
how to call a method from childMDI1 into childMDI2 raj_k C# 0 June 26th, 2005 04:54 PM
How to call a C# method from VB.Net? aliarifpk General .NET 1 February 26th, 2004 04:11 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.