Console.Beep(음높이,크기?)를 보구서
전에 하던 게임중에 연주하는 기능이 생각나 한번 만들어봣습니다.
Public Class Form1 Public int1(20) As Long Private Declare Function GetTickCount Lib "kernel32" () As Long Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim text As Integer For i = 0 To TextBox1.Text.Length - 1 text = dec(TextBox1.Text.Substring(i, 1)) Try beep(int1(text)) Catch ex As ArgumentException Wait(200) End Try Next End Sub Private Sub beep(ByVal v1 As Integer) Console.Beep(v1, 400) End Sub Sub Wait(ByVal cTime As Long) Dim sTime As Long sTime = GetTickCount + cTime Do While sTime >= GetTickCount Application.DoEvents() Loop End Sub Private Function dec(hexa As String) As Long dec = Val("&H" & hexa) End Function Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load int1(1) = (262) int1(2) = (294) int1(3) = (330) int1(4) = (349) int1(5) = (392) int1(6) = (440) int1(7) = (494) int1(8) = (523) int1(9) = (555) int1(10) = (591) int1(11) = (610) int1(12) = (653) int1(13) = (701) int1(14) = (755) int1(15) = (784) End Sub End Class |
'프로그래밍언어 > VB.NET' 카테고리의 다른 글
VB2010부터는 _(언더바)를 쓸필요는 없습니다. (0) | 2013.02.28 |
---|---|
utf8 형변환 (0) | 2013.02.27 |
쿨타임,시간지연,딜레이 (0) | 2013.02.27 |
VB.NET에서 Beep음 재생! (0) | 2013.02.27 |
VB.NET에서 DLL만들어 사용하기 (0) | 2013.02.25 |