设为首页  
联系我们  
加入收藏  
网页制作 冲浪宝典 图形图像 操作系统 软件教学 编程开发 认证考试 安全技术 站长专区 文学驿站 娱乐天地 游戏天地 办公软件
文章搜索
您的位置: 首页 >> 文章首页 >> 编程开发 >> Visual Basic >> DirectX 7 编程初步
精品推荐
Visual Basic点击TOP10
·VB中使用EXCEL输出
·用vb实现DES加解密算法(三)--解密
·vsprint打印实例
·VB实现SQL Server数据库备份/恢复
·DirectX 7 编程初步
·用vb实现DES加解密算法(二)--加密
·VB 贪吃蛇 单人版游戏 (原作)
·如何在IE右键菜单中添加菜单项以及如何添加IE任务栏按钮
·VB6.0中通过MSChart控件调用数据库
·让VB应用程序支持鼠标滚轮
编程开发点击TOP10
·数字小键盘指法练习
·用C语言编通讯录程序(初学者级别的)
·ASP.NET 程序中常用的三十三种代码
·我写的Java学生成绩管理系统源代码
·CHK文件恢复工具
·java笔试题
·Modem 常用AT指令集
·异常java.sql.SQLException: Io exception:The Network Adapter could not establish connection
·单片机模拟I2C总线及24C02(I2C EEPROM)读写实例(源代码)
·C++经典电子书下载
精选专题

DirectX 7 编程初步

作者: 来源:网络文章 时间:2005-12-13 18:10:24

DirectX 7 编程初步(2)
Dim DirectX As New DirectX7
Dim DDEnum As DirectDrawEnum
Dim DDSound As DirectSoundEnum

Private Sub Command1_Click()
Dim Count, I As Integer

Set DDEnum = DirectX.GetDDEnum
Count = DDEnum.GetCount
List1.Clear
For I = 1 To Count
List1.AddItem DDEnum.GetDescription(I)
Next I

Set DDEnum = Nothing
End Sub

Private Sub Command2_Click()
Dim Count, I As Integer

Set DDEnum = DirectX.GetDDEnum
Count = DDEnum.GetCount
List1.Clear
For I = 1 To Count
List1.AddItem DDEnum.GetName(I)
Next I
Set DDEnum = Nothing
End Sub

Private Sub Command3_Click()
Dim Count, I As Integer

Set DDSound = DirectX.GetDSEnum
Count = DDSound.GetCount
List1.Clear
For I = 1 To Count
List1.AddItem DDSound.GetDescription(I)
Next I
End Sub

Private Sub Command4_Click()
Dim Count, I As Integer

Set DDSound = DirectX.GetDSEnum
Count = DDSound.GetCount
List1.Clear
For I = 1 To Count
List1.AddItem DDSound.GetName(I)
Next I
End Sub

Private Sub Form_Load()
Command1.Caption = "DirectDraw驱动描述"
Command2.Caption = "DirectDraw驱动名称"
Command3.Caption = "DirectSound驱动描述"
Command4.Caption = "DirectSound驱动名称"
End Sub

Private Sub Form_Unload(Cancel As Integer)
Set DirectX = Nothing
End Sub
运行程序,分别点击不同的按钮,在列表框中就会出现相应的设备驱动名和描述。

2,DirectDraw7对象

DirectDraw是一个与Windows 图形系统接口(GDI)相兼容的直接操作显示设备的软件接口。DirectDraw提供与硬件无关性的同时允许直接操作显存。程序只要使用一些基本的标准硬件约定,如:RGB及YUV色彩格式及解析度。你无须调用特殊的过程来使用显存块移动(Blitter)及调色板。使用DirectDraw,你可简单操作显存,完全使用各种硬件特性而不必理会各种不同硬件之间的差异。

2.1 建立DirectDraw对象
DirectDraw7对象是DirectX7中的DirectDraw对象,你需要首先建立一个DirectX7对象,然后使用该对象的DirectDrawCreate方法来建立DirectDraw7对象。例如:
Dim DX As New DirectX7
Dim Ddraw As DirectDraw7
Set Ddraw = DX.DirectDrawCreate("")

2.2 建立协作层
当建立了一个DirectDraw对象之后,首先要设定DirectDraw的协作层。实现的方法是调用DirectDraw对象的SetCooperativeLevel函数。该函数的定义是:
object.SetCooperativeLevel( hdl As Long, flags As CONST_DDSCLFLAGS)

共9页 9 7 [1] [2] [3] [4] [5] [6] [7] [8] [98 :>

DirectX 7 编程初步 相关文章:
DirectX 7 编程初步 相关软件:
特别声明:本站除部分特别声明禁止转载的专稿外的其他文章可以自由转载,但请务必注明出处和原始作者。文章版权归文章原始作者所有。对于被本站转载文章的个人和网站,我们表示深深的谢意。如果本站转载的文章有版权问题请联系编辑人员,我们尽快予以更正。
转载请注明来源:http://www.xgdown.com