469,336 Members | 5,156 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,336 developers. It's quick & easy.

int64 method from COM into javascript

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.
Jul 23 '05 #1
11 2021
Guy Jacubovs wrote:
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
Jul 23 '05 #2
Guy Jacubovs wrote:
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
Jul 23 '05 #3
Thomas 'PointedEars' Lahn wrote:
Guy Jacubovs wrote:
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".


<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.
Jul 23 '05 #4
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.
Jul 23 '05 #5
Guy Jacubovs wrote:
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 <gw*****@agricoreunited.com>

* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/...ce/frames.html

* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/a...ence_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-deve...upgrade_2.html
Jul 23 '05 #6
Guy Jacubovs wrote:
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):

<http://www.minet.uni-jena.de/~sack/SS04/download/IEEE-754.html>
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
Jul 23 '05 #7
ja******@yahoo.com (Guy Jacubovs) writes:
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
<URL: news:microsoft.public.scripting.jscript >
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
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 23 '05 #8
JRS: In article <40**************@PointedEars.de>, seen in
news:comp.lang.javascript, Thomas 'PointedEars' Lahn
<Po*********@nurfuerspam.de> posted at Fri, 18 Jun 2004 19:27:23 :

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.

--
John Stockton, Surrey, UK. ??*@merlyn.demon.co.uk Turnpike v4.00 MIME.
Web <URL:http://www.merlyn.demon.co.uk/> - FAQish topics, acronyms, & links.
Check boilerplate spelling -- error is a public sign of incompetence.
Never fully trust an article from a poster who gives no full real name.
Jul 23 '05 #9
Oh my, I just have set up another OS and did not copy my killfile.
And now this again.

Dr John Stockton wrote:
JRS: In article <40**************@PointedEars.de>, seen in
news:comp.lang.javascript, Thomas 'PointedEars' Lahn
<Po*********@nurfuerspam.de> posted at Fri, 18 Jun 2004 19:27:23 :
We are not truthsayers.
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)
Jul 23 '05 #10
JRS: In article <40**************@PointedEars.de>, seen in
news:comp.lang.javascript, Thomas 'PointedEars' Lahn
<Po*********@nurfuerspam.de> posted at Sun, 20 Jun 2004 00:32:16 :
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.
Dr John Stockton wrote:
JRS: In article <40**************@PointedEars.de>, seen in
news:comp.lang.javascript, Thomas 'PointedEars' Lahn
<Po*********@nurfuerspam.de> posted at Fri, 18 Jun 2004 19:27:23 :
We are not truthsayers.
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.


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.

Those who are not British


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.
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


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'.

--
John Stockton, Surrey, UK. ??*@merlyn.demon.co.uk Turnpike v4.00 MIME.
Web <URL:http://www.merlyn.demon.co.uk/> - FAQish topics, acronyms, & links.
Check boilerplate spelling -- error is a public sign of incompetence.
Never fully trust an article from a poster who gives no full real name.
Jul 23 '05 #11
rh
Dr John Stockton wrote:
<snip>
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
Jul 23 '05 #12

This discussion thread is closed

Replies have been disabled for this discussion.

By using this site, you agree to our Privacy Policy and Terms of Use.