Calling a dll from a Javascript

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Venkat

    Calling a dll from a Javascript

    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,passwor d)
    {
    var AutherizedUser;
    var ValidateObject = new ActiveXobject(" InstallDLL.Inst all");
    ValidateObject. ValidateUser(id ,password,Authe rizedUser);
    return AutherizedUser;
    }

    DLL

    STDMETHODIMP CInstall::Valid ateUser(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_bin d_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

    #2
    Re: Calling a dll from a Javascript

    "Steve van Dongen" <stevevd@hotmai l.com> wrote in message
    news:1uktkvo871 t8fc1ebok5b5snv d39s7rfnb@4ax.c om...[color=blue]
    > On Thu, 28 Aug 2003 17:05:06 -0500, "Venkat" <venkat_kp@yaho o.com>
    > wrote:
    >[color=green]
    > >Hi All,
    > >
    > >I am not able to access a dll function from a remote script using
    > >ActiveXobjec t 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.Inst all");
    ValidateObject. ValidateUser(id ,password,Authe rizedUser);
    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.Inst all");
    AutherizedUser = ValidateObject. ValidateUser(id ,password);
    return AutherizedUser;


    Thought it will be helpful to others.

    Regards
    Venkat


    Comment

    Working...