65.9K
CodeProject 正在变化。 阅读更多。
Home

使用 Internet Explorer 窗口显示 VB 脚本中的信息

starIconstarIconstarIconstarIcon
emptyStarIcon
starIcon

4.10/5 (4投票s)

2007年8月17日

CPOL

1分钟阅读

viewsIcon

40282

downloadIcon

480

这个类允许您使用 Internet Explorer 窗口显示在 VB 脚本中收集的所有类型静态和动态信息。

引言

为了我的工作,我一次又一次地需要能够显示有关我们 PACS 系统的动态/更新信息。使用 VB 脚本和这个类,我能够创建下面的示例。这个示例每 15 秒从我们的数据库收集信息,然后更新窗口。从那时起,我发现这个类还有很多其他的用途。所以我决定与大家分享它。

Screenshot - Sample.jpg

背景

本文解释了如何使用 IEDisplay 类,并且不涉及类代码本身的功能。

使用代码

首先,您需要将位于文件 IEDisplay_Class_Only.txt 中的类内容复制并粘贴到您的 VB 脚本中。

接下来,需要在您的 VB 脚本中创建类的实例

// 'Create our IE window to output info from our script to

Dim ScriptUpdateWindow
Set ScriptUpdateWindow = new IEDisplay

然后在调用 .Show 方法之前设置四个属性

ScriptUpdateWindow.WindowTitle = "Jake's IE Display Class" 'Default is blank

ScriptUpdateWindow.InitialText = "Loading Please wait..." 'Default is blank

ScriptUpdateWindow.NumberOfLabels = 2 'default of 1, max of 5

ScriptUpdateWindow.Horizontal_Vertical_Labels = _
                            "vertical" 'default of "horizontal"

现在调用 .Show 方法,窗口就可以用来显示信息了

'Call the .show method to make the IE window appear

ScriptUpdateWindow.Show()

有两种方法可以将数据添加到 IE 窗口。使用 .SetText .AppendText 方法。

ScriptUpdateWindow.SetText "StringText Set To Display In Label",_
                                1 '(The label Number)

ScriptUpdateWindow.AppendText "StringText Set To Append In Label" + _
                                IP,1 '(The label Number)

关注点

请参阅与 zip 文件一起提供的 VBScript 示例。这些示例显示了类的所有可用方法以及如何使用所有功能。代码中的注释应该可以解答有关如何正确使用此类的任何问题。

历史

  • 版本 1.0:提交于 2007-08-17
© . All rights reserved.