RT,在WIN98,或者95下,用Beep或者APIBeep只能发一种声音,还很小,求大佬们帮帮忙了。谢谢

解决方案 »

  1.   

    beep可以带参数,发出不同频率的声音的。
      

  2.   

    东方热讯里面有个这方面的源码,你自己去找
    http://www.easthot.net
    你看看是不是你要的?
      

  3.   

    API 函数 Beep 也不行吗?
      

  4.   

    记得当初在dos下用basic编过曲子的小程序,不过内容一点也记不住了
      

  5.   

    Private Declare Function APIBeep Lib "kernel32" Alias "Beep" (ByVal dwFreq As Long, ByVal dwDuration As Long) As Long注意:
    THIS ONLY WORKS IN NT/2000/XP. IN 95/98/ME, the freqeuncy and duration parameters are ignored.
      

  6.   

    98或以下的系统好久没用了,不过XP和2003我倒是常用,
    Beep可以在2000以上的系统正常用,没问题,我都试了。
      

  7.   

    同感,以前也发现95,98下Beep无效。
    手头没有95,98了,看到人家用循环让Beep运行N遍,不知是否针对此问题的。
      

  8.   

    可以利用声卡的midi合成器发出声音,调用以下api底层函数:midiOutOpen/midiOutClose/midiOutShortMsg就可以!
    例如: midiOutShortMsg(hMidiOut, (&H90 + (60 * 256) + &H7F0000))
    就是发出中音C,也就是do。
      

  9.   

    可以利用声卡的midi合成器发出声音,调用以下api底层函数:midiOutOpen/midiOutClose/midiOutShortMsg就可以!
    例如: midiOutShortMsg(hMidiOut, (&H90 + (60 * 256) + &H7F0000))
    就是发出中音C,也就是do。
      

  10.   

    '打开MIDI输出设备
    Public Declare Function midiOutOpen Lib "winmm.dll" Alias "midiOutOpen" (lphMidiOut As Long, ByVal uDeviceID As Long, ByVal dwCallback As Long, ByVal dwInstance As Long, ByVal dwFlags As Long) As Long  '关闭MIDI输出设备
    Public Declare Function midiOutClose Lib "winmm.dll" Alias "midiOutClose" (ByVal hMidiOut As Long) As Long  '向MIDI输出设备发送短消息
    Public Declare Function midiOutShortMsg Lib "winmm.dll" Alias "midiOutShortMsg" (ByVal hMidiOut As Long, ByVal dwMsg As Long) As Long
      

  11.   

    98下这样:
    Public Sub SetFreq(hertz As Integer)
        If hertz Then
            Dim divisor As Long
            divisor = 1193180 / hertz
            
            Outport &H43, &HB6
            
            Outport &H42, divisor Mod 256
            Outport &H42, divisor \ 256
            
            Speaker True
        Else
            Speaker False
        End If
    End SubPublic Sub Speaker(bOn As Boolean)
        Dim portVal As Integer
        
        portVal = Inport(&H61)
        If bOn Then
            portVal = portVal Or 3
            portVal = &H2F
        Else
            portVal = portVal And (Not 3)
        End If
        Outport &H61, portVal
    End Sub
      

  12.   

    楼上,那里有Outport这个函数呀?
      

  13.   

    Outport如何定义这个函数?
      

  14.   

    我记得网上有一个vb里使用汇编的程序范例,很多网站都有的,
    这两个函数好像就是那个范例带的第三方DLL的函数。
      

  15.   

    bdxzq(思考) : 我用VC做了一个Dll.如下:
    #include <conio.h>int _stdcall outport(unsigned short a, int b)
    {
    return _outp(a, b);
    }int _stdcall inport(unsigned short a)
    {
    return _inp(a);
    }但是在VB种调用会出错!你的那些函数是那里来的。是下载的ntport.dll吗?
      

  16.   

    我的MSN是[email protected],希望可以交个朋友。共同探讨,共同进步
      

  17.   

    楼上,我没有收到呀,[email protected]
      

  18.   

    非常感谢你。你的MSN是多少,希望交个朋友呀