不知大家有没有用过xmlhttp 在此组件中有一个onreadystatechange事件(用来反映当前状态的)是可以用javascript脚本来掉用的.
例如:xmlhttp=new ActiveXObject("MSXML2.XmlHttp");
..............................
xmlhttp.onreadystatechange=function (){
//............................
}
我现在在VB做的DLL中想实现类示的事件不知怎么做, 我用下面普通的事件定义方法在网页(javascript)中调用不到的 下面是我的代码:Private myState As Variant
Dim WithEvents XInet As Inet '定义Microsoft Internet Transfer 控件
Public Event onreadystatechange() '定义的事件Public Sub uploadFile(dataStr As Variant)
Set XInet = New Inet
XInet.URL = "http://10.17.45.148:8080/acxml.jsp?guid=123456"
XInet.Execute , , dataStr
End SubPrivate Sub XInet_StateChanged(ByVal State As Integer)
myState = State
RaiseEvent onreadystatechange
End SubPublic Property Get State() As Variant
State = myState
End Property
我在javascript中调用onreadystatechange是调用不到的,不知xmlhttp组件的onreadystatechange事件是怎么做的? 他可以在脚本中调用.我找了一些关于回调事件的资料,但还是不知怎么做!
例如:xmlhttp=new ActiveXObject("MSXML2.XmlHttp");
..............................
xmlhttp.onreadystatechange=function (){
//............................
}
我现在在VB做的DLL中想实现类示的事件不知怎么做, 我用下面普通的事件定义方法在网页(javascript)中调用不到的 下面是我的代码:Private myState As Variant
Dim WithEvents XInet As Inet '定义Microsoft Internet Transfer 控件
Public Event onreadystatechange() '定义的事件Public Sub uploadFile(dataStr As Variant)
Set XInet = New Inet
XInet.URL = "http://10.17.45.148:8080/acxml.jsp?guid=123456"
XInet.Execute , , dataStr
End SubPrivate Sub XInet_StateChanged(ByVal State As Integer)
myState = State
RaiseEvent onreadystatechange
End SubPublic Property Get State() As Variant
State = myState
End Property
我在javascript中调用onreadystatechange是调用不到的,不知xmlhttp组件的onreadystatechange事件是怎么做的? 他可以在脚本中调用.我找了一些关于回调事件的资料,但还是不知怎么做!
帮你顶一下,等待高手的到来。
Creating an HTC
Exposing Properties
Using the INTERNALNAME Attribute
Exposing Methods
Exposing Custom Events
Receiving Notifications
Scope Rules
Timing Considerations
Behavior-Related Enhancements to the DHTML Object Model
Related Topics
Prerequisites and Dependencies
How It's Done: Creating the C++ Behavior Project in Visual C++ 5.0
Implementing the IElementBehavior Interface
Implementing the IElementBehaviorFactory Interface
Exposing Events, Properties, and Methods
Implementing Object Security with the IObjectSafety Interface
Putting it Together: Creating a Mouseover Binary Behavior Sample
Related Topics
Options for Implementing Behaviors: ATL/COM vs. HTML Components
While HTML Component (HTC) can be used to provide a generic way of creating reusable components using scripting languages, binary behaviors can be used to better protect intellectual property. This is because, unlike an HTC, a binary behavior is compiled and, thus, cannot be read using the View Source command in a browser. In addition, binary behaviors do not work through scripting engine interfaces like HTCs do; instead, they directly call the underlying operating system, and this allows binary behaviors to have superior performance relative to HTCs.Microsoft Internet Explorer provides C++ interfaces as a means of implementing binary behaviors. With C++ behavior interfaces, a Component Object Model (COM) object can receive notifications, expose custom events, and access the containing page's DHTML Object Model.A Web developer can create binary behaviors using C++ behavior interfaces and ATL/COM techniques. Doing this extends the functionality of HTML pages without sacrificing the security of intellectual property. Intranet administrators also can take advantage of the performance of binary behaviors. For example, they can create binary behaviors to implement corporate-wide mandates, unique business rules, and flexible user management techniques for their intranets.Prerequisites and Dependencies
This article assumes that the reader:Has a good understanding of C++ programming.
Is familiar with Visual C++ 5.0 and ATL.
Has a general understanding of DHTML Behaviors.
在这个module中加上
Implements MSXML2.XMLHTTP就会有Private Property Let XMLHTTP_onreadystatechange(ByVal RHS As Object)End Property
1.先用HTC试一下
2.去微软新闻组问一下,最好是英文的--有了方法别忘了告诉大家一下
C:\WINNT\system32\mshtml.tlb
Microsoft HTML Object Library
实现IElementBehavior Interface 与IElementBehaviorFactory Interface等接口关于IElementBehavior Interface 与IElementBehaviorFactory Interface等接口,在msdn.net中详细讲解