1 / 7

第十八章 其他高级应用

第十八章 其他高级应用. 本章要求 : 1. 掌握 ActiveX 控件的制作过程。 2. 了解常用的 ActiveX 控件的用途。 3. 学会在工程中使用外部 DLL 文件中提供的函数,并了解 ActiveX DLL 的制作过程。. ActiveX 控件是外部控件,因此其存在形式不同于和 Visual Basic 融合在一起的内部控件。它们是以扩展名为 .ocx 的文件形式存在于 Visual Basic 系统之外,只在需要时才将其添加到工具箱中。

price-bates
Télécharger la présentation

第十八章 其他高级应用

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 第十八章 其他高级应用 本章要求: 1. 掌握ActiveX控件的制作过程。 2. 了解常用的 ActiveX控件的用途。 3. 学会在工程中使用外部DLL文件中提供的函数,并了解ActiveX DLL的制作过程。

  2. ActiveX 控件是外部控件,因此其存在形式不同于和Visual Basic融合在一起的内部控件。它们是以扩展名为 .ocx 的文件形式存在于Visual Basic系统之外,只在需要时才将其添加到工具箱中。 ActiveX 控件是对 Visual Basic 内部控件集合的扩充。例如:ADO Data控件,它是Data控件的功能扩充,可使Visual Basic具有更强的数据访问能力。应该讲,Visual Basic的诸多强大功能正是依靠ActiveX 控件获得的。 经常使用的ActiveX 控件有:ADO Data 、数据组合 、数据列表 、DataGrid、公共对话框 、 RichTextBox等。

  3. 18-1 ActiveX控件 一、ActiveX控件的使用方法 在一个标准EXE工程使用ActiveX控件。 二、常用ActiveX控件: 见书P272表18-1 常用ActiveX控件及其功能 三、如何制作ActiveX控件: 创建一个数字时钟控件。

  4. 1、新建“ActiveX控件”工程 2、为控件添加属性 3、为控件添加事件 4、为控件添加属性页 5、编译并测试控件 18-2 Windows API和DLL 一、为什么会用Windows API Windows API是以二进制形式提供的,它们存放在.DLL文件中。其中最主要的三个DLL文件是: u User32.dll u Gdi32.dll u Kernel32.dll

  5. 二、如何调用Windows API 1、  声明Windows API函数 使用Declare语句来声明应用程序中要用到的Windows API函数。Declare语句放在窗体或标准模块的通用声明段,语句包含函数名称、函数所在库名、别名、函数参数列表和返回值类型。 例:Privater Declare Function GetCursorPos Lib “user32”(lpPoint As POINTAPI) As Long 2、  调用Windows API函数 ‘定义参数类型POINTAPI Private Type POINTAPI x As Long y As Long End Type

  6. 3、 使用API文本浏览器 查看一个API文件,按以下步骤执行: 执行“外接程序”->“外接程序管理器”菜单,打开“外接程序管理器”对话框,加载“API Viewer”。 从“外接程序”菜单中单击“API浏览器”,打开“API浏览器”程序. 执行菜单命令打开想查看的API文本文件或数据库文件。 从“可用项”列表中选择需要的过程,单击“添加”按钮,该过程的声明自动加入到“选定项”列表中,单击“复制”按钮,就能将“选定项”列出的过程声明复制到剪贴板中,然后在VB的窗体代码或标准模块中粘贴过来。

  7. 三、如何使用其他的DLL 四、如何制作ActiveX DLL 例:制作一个公用的函数来确认医疗保险卡是否具有合法的卡号。 1、创建“ActiveX DLL”工程 2、编译并测试ActiveX DLL

More Related