Subhashini
2005-07-20 12:23:07 UTC
Hi
I am newbie to scprting languages.
We have some interfaces and when I'm trying to call functions in them
using Jscript , they are failing with " Microsoft JScript runtime
error: Invalid procedure call or argument ".
Below is my program and my idl file. I am able to call some functions
but when I have to pass some GUID or pointers, its failing. How do I
pass arguments like these?
Please help me out.
Thanks
Subhashini
====================================
// My Jscript
var testGUID = "{A456F5EA-D718-42d6-B858-62F82A143456}";
function GetTotalProfiles()
{
NumProfiles=ProfileMgr.GetNumProfiles();
WScript.Echo("Total Profiles = "+NumProfiles);
return NumProfiles;
}
function GetProfiles()
{
totalProfiles= GetTotalProfiles();
WScript.Echo("Profiles ="+totalProfiles);
var NumProfiles=0;
profiles=profileMgr.GetProfilesforDeviceID"0002",totalProfiles);
///This is working
var profileName=profiles.GetName(); //This is also working
WScript.Echo("profile name="+ profileName);
var ppid;
profiles.GetProperty(nopropId,ppid); // GetProperty giving error :
Microsoft JScript runtime error: Invalid procedure clal or agrument
profiles.GetGUID(); // GETGUID giving error Microsoft JScript runtime
error: Invalid procedure call or agrument
}
function CreateProfile()
{
var profile;
WScript.Echo("Create Profile");
profile=ProfileMgr.CreateProfile("0002","Test Profile",testGUID);
// CreateProfile ginving error "Microsoft JScript runtime error:
Invalid procedure call or agrument "
var ProfileName=profile.GetName();
WScript.Echo("profile name="+ profileName);
}
GetProfiles();
===========================
IDL file looks like this
interface IProfileMgr : IDispatch
{
HRESULT GetProfilesforDeviceID([in] BSTR bstrDeviceID, [ref,in,out]
ULONG * pulNumProfiles, [out,retval] IProfile ** ppProfile);
HRESULT GetNumProfiles([out,retval] ULONG * pulNumProfiles);
HRESULT CreateProfile([in] BSTR bstrDeviceID, [in] BSTR bstrName,
[in] GUID guidCategory, [out,retval] Iprofile ** ppprofile);
}
interface IProfile : IDispatch
{
HRESULT GetProperty([in] ULONG num, [ref,in] PROPID * pid,
[out,retval] PROPVARIANT * pvar);
HRESULT GetGUID([out,retval] GUID * pGUID);
HRESULT GetName([out,retval] BSTR * pbstrName);
I am newbie to scprting languages.
We have some interfaces and when I'm trying to call functions in them
using Jscript , they are failing with " Microsoft JScript runtime
error: Invalid procedure call or argument ".
Below is my program and my idl file. I am able to call some functions
but when I have to pass some GUID or pointers, its failing. How do I
pass arguments like these?
Please help me out.
Thanks
Subhashini
====================================
// My Jscript
var testGUID = "{A456F5EA-D718-42d6-B858-62F82A143456}";
function GetTotalProfiles()
{
NumProfiles=ProfileMgr.GetNumProfiles();
WScript.Echo("Total Profiles = "+NumProfiles);
return NumProfiles;
}
function GetProfiles()
{
totalProfiles= GetTotalProfiles();
WScript.Echo("Profiles ="+totalProfiles);
var NumProfiles=0;
profiles=profileMgr.GetProfilesforDeviceID"0002",totalProfiles);
///This is working
var profileName=profiles.GetName(); //This is also working
WScript.Echo("profile name="+ profileName);
var ppid;
profiles.GetProperty(nopropId,ppid); // GetProperty giving error :
Microsoft JScript runtime error: Invalid procedure clal or agrument
profiles.GetGUID(); // GETGUID giving error Microsoft JScript runtime
error: Invalid procedure call or agrument
}
function CreateProfile()
{
var profile;
WScript.Echo("Create Profile");
profile=ProfileMgr.CreateProfile("0002","Test Profile",testGUID);
// CreateProfile ginving error "Microsoft JScript runtime error:
Invalid procedure call or agrument "
var ProfileName=profile.GetName();
WScript.Echo("profile name="+ profileName);
}
GetProfiles();
===========================
IDL file looks like this
interface IProfileMgr : IDispatch
{
HRESULT GetProfilesforDeviceID([in] BSTR bstrDeviceID, [ref,in,out]
ULONG * pulNumProfiles, [out,retval] IProfile ** ppProfile);
HRESULT GetNumProfiles([out,retval] ULONG * pulNumProfiles);
HRESULT CreateProfile([in] BSTR bstrDeviceID, [in] BSTR bstrName,
[in] GUID guidCategory, [out,retval] Iprofile ** ppprofile);
}
interface IProfile : IDispatch
{
HRESULT GetProperty([in] ULONG num, [ref,in] PROPID * pid,
[out,retval] PROPVARIANT * pvar);
HRESULT GetGUID([out,retval] GUID * pGUID);
HRESULT GetName([out,retval] BSTR * pbstrName);