int64 method from COM into javascript

G

Guy Jacubovs

Hi

i have a property on a COM which returns int64:

var Milliseconds=Form1.Player.AbsolutePosition;


however for somereason the typeof(Milliseconds) isn't number but unknown....

I can't make any use of this.

Does any one knows how can I transfer it to number?

10x
Guy.
 
T

Thomas 'PointedEars' Lahn

Guy said:
i have a property on a COM which returns int64:

Which COM _object_? Which user agent?
var Milliseconds=Form1.Player.AbsolutePosition;


however for somereason the typeof(Milliseconds) isn't number but unknown....

There is no "unknown" type and, consequently, the typeof _operator_ (no
parantheses required) does not return an "unknown" string, only
"number", "string", "boolean", "object" and "function". Please specify.
I can't make any use of this.

With that little information I can't either and I doubt anyone else can.
Does any one knows how can I transfer it to number?

Provided that the property is a 64 bit integer value it should be
converted into a IEEE-754 double-precision floating-point number
as this is the only number format J(ava)Script supports.


PointedEars
 
T

Thomas 'PointedEars' Lahn

Guy said:
i have a property on a COM which returns int64:

Which COM _object_? Which user agent?
var Milliseconds=Form1.Player.AbsolutePosition;


however for somereason the typeof(Milliseconds) isn't number but
unknown....

There is no "unknown" type and, consequently, the typeof _operator_
(no parantheses required) does not return an "unknown" string, only
"number", "string", "boolean", "object", "function" and "undefined".
Please specify.
I can't make any use of this.

With that little information I can't either and I doubt anyone else can.
Does any one knows how can I transfer it to number?

Provided that the property is a 64 bit integer value it should be
converted into a IEEE-754 double-precision floating-point number
as this is the only number format J(ava)Script supports.


PointedEars
 
R

Richard Cornford

Thomas said:
Which COM _object_? Which user agent?


There is no "unknown" type and, consequently, the typeof _operator_
(no parantheses required) does not return an "unknown" string, only
"number", "string", "boolean", "object", "function" and "undefined".

<quote cite="ECMA 262 3rd edition">
11.4.3 The typeof Operator
The production UnaryExpression : typeof UnaryExpression is
evaluated as follows:

1. Evaluate UnaryExpression.
2. If Type(Result(1)) is not Reference, go to step 4.
3. If GetBase(Result(1)) is null, return "undefined".
4. Call GetValue(Result(1)).
5. Return a string determined by Type(Result(4)) according to
the following table:

Type | Result
-------------------------------------------------
Undefined | "undefined"
-------------------------------------------------
Null | "object"
-------------------------------------------------
Boolean | "boolean"
-------------------------------------------------
Number | "number"
-------------------------------------------------
String | "string"
-------------------------------------------------
Object (native and |
doesn't implement |
[[Call]]) | "object"
-------------------------------------------------
Object (native and |
implements [[Call]]) | "function"
-------------------------------------------------
Object (host) | Implementation-dependent
</quote>

That final "Implementation-dependent" means that an alien primitive
wrapped in a host object has every right to return "unknown" if it feels
like it (and on IE some of them do).

Richard.
 
G

Guy Jacubovs

Hello All

you are all missing the point,

i don't care what typeof returns.... ;)


Here is the definition of AbsolutePosition in the idl:

[propget, id(12), helpstring("property AbsolutePosition")] HRESULT
AbsolutePosition([out, retval] __int64 * pVal);



All I want to is use this value in jscript.
Every time I want to access this value as a number (of example
division) jscript gives me an error



10x for the replies

Guy.
 
G

Grant Wagner

Guy said:
Hi

i have a property on a COM which returns int64:

var Milliseconds=Form1.Player.AbsolutePosition;

however for somereason the typeof(Milliseconds) isn't number but unknown....

I can't make any use of this.

Does any one knows how can I transfer it to number?

10x
Guy.

typeof Milliseconds can't be "transferred" to a number, since there doesn't
appear to be any "AbsolutePosition" property for the "Player" object on "Form1".

You can _try_ something like:

var obj = Form1.Player;
for (var prop in obj) {
document.write(
prop + ' = ' + obj[prop] +
' (' + typeof obj[prop] + ')' +
'<br>'
);
}

to see if it lists an "absolutePosition" or "AbsolutePosition" property.

--
| Grant Wagner <[email protected]>

* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/frames.html

* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/author/dhtml/reference/dhtml_reference_entry.asp

* Netscape 6/7 DOM Reference available at:
* http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 7 / Mozilla
* http://www.mozilla.org/docs/web-developer/upgrade_2.html
 
T

Thomas 'PointedEars' Lahn

Guy said:
you are all missing the point,

I think in fact *you* do. Since ECMAScript and implementations use
IEEE-754 doubles only, there is no exact representation of a 64 bit
integer value in these languages. Proof: The largest value a signed
64 bit integer can hold is (2^63)-1 (1 MSB + 63 bits) which is
9223372036854775807. However, JavaScript (v1.5 in Mozilla Firefox)
returns 9223372036854776000 for Math.pow(2, 63)-1 because of the 64
bits available for the floating-point number some bits are required
for the exponent (the stored value is 9.2233720368547760E18):

i don't care what typeof returns.... ;)

If you would have bothered to read about J(ava)Script numbers as I
recommended previously, you would have recognized that "typeof" is
not really your problem.
Here is the definition of AbsolutePosition in the idl:

[propget, id(12), helpstring("property AbsolutePosition")] HRESULT
AbsolutePosition([out, retval] __int64 * pVal);



All I want to is use this value in jscript.

You can use only a rounded representation of it.
Every time I want to access this value as a number (of example
division) jscript gives me an error

We are not truthsayers. Show the source and the other information
requested previously.


PointedEars
 
L

Lasse Reichstein Nielsen

i have a property on a COM which returns int64:

var Milliseconds=Form1.Player.AbsolutePosition;
however for somereason the typeof(Milliseconds) isn't number but unknown....

I assume you are speaking about a COM object used in Internet
Explorer. Your best chance of getting advice about
IE/JScript-specific programming like this (or just to finde people who
knows what you are talking about) is the newsgroup
Does any one knows how can I transfer it to number?

My, completely unfounded, guess would be to do either
Milliseconds.toDouble()
or
Number(Milliseconds)

Good luck
/L
 
D

Dr John Stockton

JRS: In article <[email protected]>, seen in
Thomas 'PointedEars' Lahn
We are not truthsayers.

You are entitled to describe yourself thusly; but not to so describe the
rest of us, forsooth.

Those who are not British are warned not to emulate Pointy-Head's misuse
of the English language. Others should not need the warning.
 
T

Thomas 'PointedEars' Lahn

Oh my, I just have set up another OS and did not copy my killfile.
And now this again.
JRS: In article <[email protected]>, seen in
Thomas 'PointedEars' Lahn


You are entitled to describe yourself thusly; but not to so describe
the rest of us, forsooth.
^^^^^^^^^^^^^^
And you are entitled to speak for everyone else (but me)?
I am afraid that your arrogance grows (is?) beyond imagination.
Those who are not British

There are other countries on this planet that have the English language
as official and/or native language. The above statement of yours is
only another proof of your arrogant attitude.
are warned not to emulate Pointy-Head's ^^^^^^^^^^^^^
misuse of the English language. Others should not need the warning.

I read the term "truthsayer" in some of the "Dune" novels by Frank
Herbert, a great American science-fiction writer and, as I have recently
found out, I was simply mislead by my linguistic intuition. Of course
I meant a different thing; a person with prescience -- a *soothsayer*.
It sometimes happens that a translation that is inspired by intuition
is not the correct one (in German, "soothsayer" is "Wahrsager" --
"truth-sayer"). But it happens more often to me that my linguistic
intuition leads to an appropriate translation. So far for *my* use of
the English language.

And what about *yours*? There are far better ways than this to tell
people that they have made a mistake (and people /make/ mistakes, that
is how they learn to better themselves). Especially for off-topic
notes, there is private e-mail. Do you really think your *continuing
completely off-topic personal attacks* here will do (you, this
newsgroup, me) anything good? I wonder how and why an university
graduate like you continues to display such a behavior in public.
If I were in your place, I would be very much ashamed of it.


PointedEars, Score adjusted (again)
 
D

Dr John Stockton

JRS: In article <[email protected]>, seen in
Thomas 'PointedEars' Lahn
Oh my, I just have set up another OS and did not copy my killfile.
And now this again.

If you are afraid of personal criticism, you should not post to Usenet.
Sticking your head in the sand by kill-filing your critics is cowardly,
and leaves you exposed as an arse. A better approach would be to
refrain from deserving such criticism - in particular, to terminate your
dictatorial attitude to those whose postings, while compatible with
Usenet custom, are in breach of some irrelevant German document.
^^^^^^^^^^^^^^
And you are entitled to speak for everyone else (but me)?
I am afraid that your arrogance grows (is?) beyond imagination.

You are not entitled to describe us all as liars; there must be here at
least some posters who have never, intentionally or otherwise, written
anything but the perfect truth.

There are other countries on this planet that have the English language
as official and/or native language.

It is true that many call one of their official languages English. In
many of the Commonwealth countries, many inhabitants use English as good
as that used by the English. But in many countries where it is an
official language, it is sadly mistreated by the less well-educated
natives. That is why I wrote what I did; it expressed my meaning.

The above statement of yours is
only another proof of your arrogant attitude.


I read the term "truthsayer" in some of the "Dune" novels by Frank
Herbert, a great American science-fiction writer

Rather long-winded; typically Murrican. In my youth, I thought that he
was moderately entertaining. You, too, should grow out of that,
eventually. But it is never wise to presume that a term used by an SF
writer is a current term in the language.

and, as I have recently
found out, I was simply mislead by my linguistic intuition. Of course
I meant a different thing; a person with prescience -- a *soothsayer*.

That's right. You used a pretentious word in ignorance of its meaning.
It would not be good for others to mis-learn from you.

And what about *yours*? There are far better ways than this to tell
people that they have made a mistake (and people /make/ mistakes, that
is how they learn to better themselves). Especially for off-topic
notes, there is private e-mail.

Irrelevant; I have no interest in educating you, a person of noxious
disposition; only in preventing those (a large majority) who have more
pleasant personalities than yours from being misinformed.

P.S. Also, 'borken' is not an English word. Use, as is proper,
'broken'.
 
R

rh

Dr John Stockton wrote:
P.S. Also, 'borken' is not an English word. Use, as is proper,
'broken'.

Actually, even some of the "less well educated natives" (more often
referred to by the English as those "dumb colonials") know that
"borken" is 'net clique-speak. And, as it is apparently intended to
do, draws response from those suffering the rasp.

However, neither to my knowledge, is "Murrican" an English word. Nor
is (capitalized) "Merkin". Both seem to enjoy a certain amount of
boilerplate exposure in postings under your name. It seems then,
readers should be entitled to draw appropriate conclusions (beyond not
fully trusting this posting) based upon your signature, wouldn't you
say? ;)

../rh
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,430
Messages
2,571,676
Members
48,796
Latest member
Greg L.

Latest Threads

Top