首页 | 编程语言 | 网站建设 | 游戏天堂 | 冲浪宝典 | 网络安全 | 操作系统 | 软件时空 | 硬件指南 | 病毒相关 | IT 认证
软讯网络 > 编程语言 > Visual Basic > 在VB5中如何使机箱内的小喇叭发出不同的声音?
【标  题】:在VB5中如何使机箱内的小喇叭发出不同的声音?
【关键字】:VB,VB5,VB5
【来  源】:网络

在VB5中如何使机箱内的小喇叭发出不同的声音?

- chengdx
回答1:
Mmsound.drv 是小喇叭的系统接口 ,很多API的书都有用法介绍
- 219 张晶
回答2:
使用VB中的beep语句,但这只能发出一种声音。如果想发出不同声音,可以
使用API函数。详情如下:(摘自VB-Helper)
Use the Beep API function.

This example demonstrates two interesting things. First, it shows how to make a beep of any frequency and duration rather than using the standard tone you get with the Beep statement.

Second, note that the Beep API function has the same name as VisualBasic's Beep statement. To differentiate them, you can assign a new name to the Beep API function in its Declare statement. It is known as "Beep" in the library (the Alias statement) but it is known as APIBeep to the program.

You can use this technique to differentiate between functions with the same name, or you can use it to give API functions a name that is easier to write (for example, if the API name is very long).

In the declarations section:

Option Explicit
Private Declare Function APIBeep Lib "kernel32" Alias "Beep" (ByVal dwFreq As Long, ByVal dwDuration As Long) As Long
' To make a beep lasting 500 milliseconds with frequency specified in the
' TextBox txtFrequency (try 1000 for starters):

Private Sub Command1_Click()
Dim frequency As Long

frequency = CLng(txtFrequency.Text)
APIBeep frequency, 500
End Sub
- Prisoner
Visual Basic 程序创建闪烁(标语)屏:【上一篇】
利用Visual Basic设计多媒体应用程序:【下一篇】
【相关文章】
  • VB环境下压缩数据流播放技术
  • 用VB制作下雪的特技景象
  • 用VB实现“百叶窗”的图形特效
  • 在VB中实现位图的透明放置
  • 用VB将命令行软件Windows化
  • 一组VB应用技巧
  • VB5.0中基于桌面的屏幕技巧
  • 如何在VB中直接显示无格式256灰度级图像
  • VB图片框在报表设计中屏幕滚动的问题
  • 利用VB捕捉并保存屏幕图象
  • 【随机文章】
  • OSPF 链路-状态应答报文
  • 实现自编辑的Date Picker控件
  • 分层优化网络资源规划方法(3)网络规划和设计方法(4)
  • LSI逻辑宣布MegaRAID适配器支持Sun的操作系统
  • 告别贴
  • 路由器原理及路由协议
  • PostgreSQL 的昨天今天和明天
  • C++实例教学(基础知识-03)
  • Painter 手绘风格漫画-《功夫》海报(2)
  • 3D游戏从入门到精通-26
  • 【相关评论】
    没有相关评论
    【发表评论】
    姓名:
    邮件:
    随机码*
    评论*
          
    |  首 页  |  版权声明  |  联系我们   |  网站地图  |
    CopyRight © 2004-2007 软讯网络 All Rigths Reserved.