Connecting Tech Pros Worldwide Help | Site Map

Calling a dll from a Javascript

Venkat
Guest
 
Posts: n/a
#1: Jul 20 '05
Hi All,

I am not able to access a dll function from a remote script using
ActiveXobject when
an output parameter is used, but i could able to access the same when no
output parameter
is used.

While calling a DLL function from my javascript app i am passing 3
parameters
(2 input parameters and 1 output parameter).
The output parameter basically stores the return value which then will be
used
in my Javascript app.
Pl note that in my IDL file i changed the return type of output parameter to
[out, retval].

Here is my Javascript file.

fun1(id,password)
{
var AutherizedUser;
var ValidateObject = new ActiveXobject("InstallDLL.Install");
ValidateObject.ValidateUser(id,password,Autherized User);
return AutherizedUser;
}

DLL

STDMETHODIMP CInstall::ValidateUser(BSTR userId, BSTR pwd, BOOL* pVal)
{
// TODO: Add your implementation code here
LDAP *ldap;

ldap = ldap_open("ldap.xyz.com", LDAP_PORT);

if(ldap == NULL)
{
*pVal = FALSE;
return S_FALSE;
}

ULONG val = ldap_simple_bind_s(ldap, dn, BSTRToChar(pwd));
//pl note that these functions are working properly and no problem with
them.
if (val == LDAP_SUCCESS)
{
*pVal = TRUE;
}
else
{
*pVal = FALSE;
return S_FALSE;
}
return S_OK;
}

I appreciate your help.


Regards
Venkat



Venkat
Guest
 
Posts: n/a
#2: Jul 20 '05

re: Calling a dll from a Javascript


"Steve van Dongen" <stevevd@hotmail.com> wrote in message
news:1uktkvo871t8fc1ebok5b5snvd39s7rfnb@4ax.com...[color=blue]
> On Thu, 28 Aug 2003 17:05:06 -0500, "Venkat" <venkat_kp@yahoo.com>
> wrote:
>[color=green]
> >Hi All,
> >
> >I am not able to access a dll function from a remote script using
> >ActiveXobject when
> >an output parameter is used, but i could able to access the same when no
> >output parameter
> >is used.[/color]
> <snip />
>
> Unfortunately, JScript doesn't support out parameters. If you're
> working in an environment where its possible to use VBScript, you
> could write a wrapper function in VBScript that you could call from
> JScript.
>
> Regards,
> Steve[/color]

I found the problem and i don't avoid anyone any point.
The calling of DLL function is different when output parameters are used.

If id,password and AutherizedUser are Input parameters then Javascript
calling is

var AutherizedUser;
var ValidateObject = new ActiveXobject("InstallDLL.Install");
ValidateObject.ValidateUser(id,password,Autherized User);
return AutherizedUser;

If id and password are input parameters and AuthorizedUser is output
parameter then the calling is
var AutherizedUser;
var ValidateObject = new ActiveXobject("InstallDLL.Install");
AutherizedUser = ValidateObject.ValidateUser(id,password);
return AutherizedUser;


Thought it will be helpful to others.

Regards
Venkat


Closed Thread