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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
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
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

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
mcglincheyCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
knillAuthor Commented:
It's a shame. :-(
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.