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".
knillAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
mcglincheyConnect With a Mentor Commented:
The real problem is that you are using ASP to try to retrieve two values at a time.  ASP communicates with COM objects using the Automation standard, aka using IDispatch.  What this means is that you can only get a value out of a COM object in one way: with a property.

With C or C++ as a client of a COM object, you can of course call:
DATE From, To;
Obj.GetTime(&From, &To);

In ASP (either Javascript or VB, doesn't matter, as it's a property of IIS's underlying access to COM, not the language) you can't do that, as there are no pointers.  You would have to do it like this:

[propget, id(1), helpstring("property dateFrom")] HRESULT dateFrom([out, retval] DATE *pVal);
[propget, id(2), helpstring("property dateTo")] HRESULT dateTo([out, retval] DATE *pVal);
            
Then you can use ASP to go:

var from;
var to;
from = obj.dateFrom;
to   = obj.dateTo;

0
 
rmgalanteCommented:
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
0
 
knillAuthor Commented:
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.
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
lexenCommented:
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.
0
 
rmgalanteCommented:
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
0
 
knillAuthor Commented:
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?
0
 
knillAuthor Commented:
It's a shame. :-(
0
All Courses

From novice to tech pro — start learning today.