Link to home
Start Free TrialLog in
Avatar of knill
knill

asked on

DCOM method with DATE* invocation

I've method of DCOM object:
GetTime([out] DATE* pFrom, [out] DATE* pTo)
How can I call this method from JavaScript?
I tried it this way:
var from;
var to;
obj.GetTime(from, to);
var f = new Date(from);
var t = new Date(to);
Response.Write(f.toLocaleString());
But in f and t is "NaN".
Avatar of rmgalante
rmgalante

I've made this work, but not with JavaScript, and given the following assumptions.

1.  The client machine is running Windows.
2.  The DCOM object has been loaded to the client machine via a CAB file inside of an <OBJECT> tag.
3.  I used VB Script to create and access the object.

VB Script is not a solution if you want to support browser other than IE.

DCOM is not a solution if you want clients that are not running Windows to access your object.

I hope you didn't think you could access server-side COM objects via JavaScript.  No, that couldn't be what your suggesting.

Let me know if you need more information.

Rob
Avatar of knill

ASKER

I use DCOM server running on Windows NT, and JavaScript on ASP page inside IIS 4.0. If it would be necessary, I could use VBScript.
So, I call DCOM object just from server script.
I've had similar problems when trying to use DCOM objects with parameters that are of any type other than VARIANT.  VBScript will likely have the same problem.  Try changing your published COM interface to take VARIANTs and do your type-checking within the interface.
Could it be that the dates that are being returned from your COM object are not compatible with the JavaScript Date object?  For example, JavaScript Date constructors take the following formats:

1.  a string ("month date, year hours:minutes:seconds")
2.  numbers (year, month, day) where month is zero-based.
3.  numbers (year, month, day, hours, minutes, seconds) where month is zero-based.

Rob
Avatar of knill

ASKER

It could be problem with DATE compatibilty, but I've also problem with calling:
Fxn([out] long* p1, [out]long* p2, [out, retval] long* status);
Whan I call from JavaScript:
var p1 = 0, p2 = 0;
var status = obj.Fxn(p1, p2);
In status is corect value, but in p1 and p2 is 0, even if in DCOM server set p1 and p2 to any other value!!!
What I do wrong?
ASKER CERTIFIED SOLUTION
Avatar of mcglinchey
mcglinchey

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of knill

ASKER

It's a shame. :-(