如何声明指针 [英] how to declare a pointer

查看:103
本文介绍了如何声明指针的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新手试图使用一些非常简单的j来调用ActiveX

对象的方法。

我需要使用一个指针来调用一个嵌入式ActiveX对象的方法来获得一个数字。

据我所知,js是无类型的,所以我怎样才能得到一个变量为

指针类型?

传递var i作为参数得到一个未定义的值作为回报。


感谢IA,Simon

I''m a js newbie trying to use some very simple js to call an ActiveX
object''s methods.
I need to use a pointer to call an embedded ActiveX object''s method to
receive a number.
As I understand it, js is typeless so how can I get a variable to be a
pointer type?
Passing var i as the parameter gets an undefined value in return.

Thanks IA, Simon

推荐答案

2004年4月4日星期日19:35:24 +0000(UTC),Simon

< si ***** ***********@btinternet.please.com>写道:
On Sun, 4 Apr 2004 19:35:24 +0000 (UTC), Simon
<si****************@btinternet.please.com> wrote:
我是新手尝试使用一些非常简单的j来调用ActiveX
对象的方法。
我需要使用一个指向调用嵌入式ActiveX对象的方法来接收一个数字。
根据我的理解,js是无类型的,那么如何才能使变量成为指针类型?<传递var i作为参数得到一个未定义的值作为回报。
I''m a js newbie trying to use some very simple js to call an ActiveX
object''s methods.
I need to use a pointer to call an embedded ActiveX object''s method to
receive a number.
As I understand it, js is typeless so how can I get a variable to be a
pointer type?
Passing var i as the parameter gets an undefined value in return.




JavaScript没有指针[1]。最接近的是引用,但

它们仅用于将对象和数组作为函数参数传递。

原始类型(布尔值,字符串,数字)总是按值传递。


如果不指向此ActiveX对象的文档,或者更详细地描述它的
,那么任何人都无法提供帮助。 />

Mike

[1]微软的DHTML参考文档讲述了所有

时间,但有很多这些页面中的错误,并使用单词

" pointer"就是其中之一。


-

Michael Winter
M。****** @ blueyonder.co.inva 盖子(将.invalid替换为.uk以回复)



JavaScript doesn''t have pointers[1]. The closest thing is references, but
they only exist for passing objects and arrays as function parameters.
Primitive types (booleans, string, numbers) are always passed by value.

Without pointing to the documentation for this ActiveX object, or
describing it in more detail, there isn''t much help anyone can provide.

Mike
[1] Microsoft''s DHTML Reference documentation talks about them all the
time, but there''s a lot of mistakes in those pages, and using the word
"pointer" is one of them.

--
Michael Winter
M.******@blueyonder.co.invalid (replace ".invalid" with ".uk" to reply)

< br>

>
JavaScript没有指针[1]。最接近的是引用,但它们只存在于将对象和数组作为函数参数传递。
原始类型(布尔值,字符串,数字)总是按值传递。

如果没有指向此ActiveX对象的文档,或者更详细地描述它,那么任何人都无法提供帮助。
JavaScript doesn''t have pointers[1]. The closest thing is references, but
they only exist for passing objects and arrays as function parameters.
Primitive types (booleans, string, numbers) are always passed by value.

Without pointing to the documentation for this ActiveX object, or
describing it in more detail, there isn''t much help anyone can provide.




Mike,


ActiveX对象是我自己的对象之一,所以我可以将参数改为

。目前它有一个函数需要2个参数,一个是

WideString(in),另一个是Variant指针(out)。它被写成

纯粹作为练习,看看我是否可以在javascript中获得返回的变量。

ActiveX限制是''out''类型参数必须是指针。

如果我可以通过引用传递一个变量作为参考,那么它可能有用吗?变量的变量很像一个指针?有没有办法在js中引用一个

变量,或者当变量传递给函数时是否会自动发生




谢谢,Simon



Mike,

The ActiveX object is one of my own so I can change the parameters as
necessary. Currently it has a function that takes 2 paramters, one in is a
WideString (in) and the other is a Variant pointer (out). It was written
purely as an exercise to see if I can get a returned variable in javascript.
The ActiveX limitation is that ''out'' type parameters must be pointers.
It may work if I can pass a variable by reference as a reference is an
address of the variable much like a pointer? Is there a way to reference a
variable in js or does it happen automatically when the variable is passed
to a function?

Thanks, Simon


2004年4月5日星期一08:11:04 +0000(UTC),Simon

< si * ***************@btinternet.please.com>写道:


[snip]
On Mon, 5 Apr 2004 08:11:04 +0000 (UTC), Simon
<si****************@btinternet.please.com> wrote:

[snip]
ActiveX对象是我自己的对象之一,因此我可以根据需要更改参数。目前它有一个带2个参数的函数,其中一个是WideString(in),另一个是Variant指针(out)。它纯粹是作为练习编写的,看看我是否可以在
javascript中获得返回的变量。


最好使用返回值,而不是试图通过引用传递
.

ActiveX限制是''out''类型参数必须是指针。
如果我可以通过引用传递一个变量作为引用是一个变量的
地址就像一个指针?


没有地址的概念在JavaScript中。

有没有办法在js中引用变量,或者当变量传递给函数时是否会自动发生?
The ActiveX object is one of my own so I can change the parameters as
necessary. Currently it has a function that takes 2 paramters, one in is
a WideString (in) and the other is a Variant pointer (out). It was
written purely as an exercise to see if I can get a returned variable in
javascript.
It would probably be best to use a return value, rather than attempting to
pass by reference.
The ActiveX limitation is that ''out'' type parameters must be pointers.
It may work if I can pass a variable by reference as a reference is an
address of the variable much like a pointer?
There is no concept of "addresses" in JavaScript.
Is there a way to reference a variable in js or does it happen
automatically when the variable is passed to a function?



引用始终与对象和数组一起使用,无论是否涉及函数
调用。但是,它们仅用于对象和

数组。您无法指定在通话期间如何传递变量。


Mike


-

Michael Winter
M.******@blueyonder.co.inva 盖子(更换" .invalid" with.ukto to reply)



References are always used with objects and arrays, whether a function
call is involved or not. However, they are only used with objects and
arrays. You can''t specify how a variable is passed during a call.

Mike

--
Michael Winter
M.******@blueyonder.co.invalid (replace ".invalid" with ".uk" to reply)


这篇关于如何声明指针的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆