home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 1996 August / VPR9608A.BIN / vpr_data / vb32 / source / piano.frm < prev    next >
Text File  |  1996-05-29  |  10KB  |  363 lines

  1. VERSION 4.00
  2. Begin VB.Form Form1 
  3.    BorderStyle     =   0  'なし
  4.    Caption         =   "Form1"
  5.    ClientHeight    =   3690
  6.    ClientLeft      =   4950
  7.    ClientTop       =   4590
  8.    ClientWidth     =   4815
  9.    ControlBox      =   0   'False
  10.    Height          =   4095
  11.    Icon            =   "Piano.frx":0000
  12.    Left            =   4890
  13.    LinkTopic       =   "Form1"
  14.    MaxButton       =   0   'False
  15.    MinButton       =   0   'False
  16.    Picture         =   "Piano.frx":030A
  17.    ScaleHeight     =   3690
  18.    ScaleWidth      =   4815
  19.    ShowInTaskbar   =   0   'False
  20.    Top             =   4245
  21.    Width           =   4935
  22.    Begin VB.ListBox List1 
  23.       Height          =   60
  24.       Left            =   120
  25.       TabIndex        =   1
  26.       Top             =   240
  27.       Width           =   3135
  28.    End
  29.    Begin VB.CommandButton Command1 
  30.       BackColor       =   &H00FF8080&
  31.       Caption         =   "×"
  32.       BeginProperty Font 
  33.          name            =   "MS Pゴシック"
  34.          charset         =   128
  35.          weight          =   700
  36.          size            =   9
  37.          underline       =   0   'False
  38.          italic          =   0   'False
  39.          strikethrough   =   0   'False
  40.       EndProperty
  41.       Height          =   252
  42.       Left            =   3360
  43.       TabIndex        =   0
  44.       Top             =   240
  45.       Width           =   372
  46.    End
  47.    Begin VB.Image Image2 
  48.       Height          =   852
  49.       Index           =   16
  50.       Left            =   3360
  51.       Stretch         =   -1  'True
  52.       Top             =   1080
  53.       Width           =   372
  54.    End
  55.    Begin VB.Image Image2 
  56.       Height          =   492
  57.       Index           =   15
  58.       Left            =   3120
  59.       Stretch         =   -1  'True
  60.       Top             =   600
  61.       Width           =   372
  62.    End
  63.    Begin VB.Image Image2 
  64.       Height          =   852
  65.       Index           =   14
  66.       Left            =   3000
  67.       Stretch         =   -1  'True
  68.       Top             =   1080
  69.       Width           =   372
  70.    End
  71.    Begin VB.Image Image2 
  72.       Height          =   492
  73.       Index           =   13
  74.       Left            =   2760
  75.       Stretch         =   -1  'True
  76.       Top             =   600
  77.       Width           =   372
  78.    End
  79.    Begin VB.Image Image2 
  80.       Height          =   852
  81.       Index           =   12
  82.       Left            =   2640
  83.       Stretch         =   -1  'True
  84.       Top             =   1080
  85.       Width           =   372
  86.    End
  87.    Begin VB.Image Image2 
  88.       Height          =   852
  89.       Index           =   11
  90.       Left            =   2280
  91.       Stretch         =   -1  'True
  92.       Top             =   1080
  93.       Width           =   372
  94.    End
  95.    Begin VB.Image Image2 
  96.       Height          =   492
  97.       Index           =   10
  98.       Left            =   2040
  99.       Stretch         =   -1  'True
  100.       Top             =   600
  101.       Width           =   372
  102.    End
  103.    Begin VB.Image Image2 
  104.       Height          =   852
  105.       Index           =   9
  106.       Left            =   1920
  107.       Stretch         =   -1  'True
  108.       Top             =   1080
  109.       Width           =   372
  110.    End
  111.    Begin VB.Image Image2 
  112.       Height          =   492
  113.       Index           =   8
  114.       Left            =   1680
  115.       Stretch         =   -1  'True
  116.       Top             =   600
  117.       Width           =   372
  118.    End
  119.    Begin VB.Image Image2 
  120.       Height          =   852
  121.       Index           =   7
  122.       Left            =   1560
  123.       Stretch         =   -1  'True
  124.       Top             =   1080
  125.       Width           =   372
  126.    End
  127.    Begin VB.Image Image2 
  128.       Height          =   492
  129.       Index           =   6
  130.       Left            =   1320
  131.       Stretch         =   -1  'True
  132.       Top             =   600
  133.       Width           =   372
  134.    End
  135.    Begin VB.Image Image2 
  136.       Height          =   852
  137.       Index           =   5
  138.       Left            =   1200
  139.       Stretch         =   -1  'True
  140.       Top             =   1080
  141.       Width           =   372
  142.    End
  143.    Begin VB.Image Image2 
  144.       Height          =   852
  145.       Index           =   4
  146.       Left            =   840
  147.       Stretch         =   -1  'True
  148.       Top             =   1080
  149.       Width           =   372
  150.    End
  151.    Begin VB.Image Image2 
  152.       Height          =   492
  153.       Index           =   3
  154.       Left            =   600
  155.       Stretch         =   -1  'True
  156.       Top             =   600
  157.       Width           =   372
  158.    End
  159.    Begin VB.Image Image2 
  160.       Height          =   852
  161.       Index           =   2
  162.       Left            =   120
  163.       Stretch         =   -1  'True
  164.       Top             =   1080
  165.       Width           =   372
  166.    End
  167.    Begin VB.Image Image2 
  168.       Height          =   492
  169.       Index           =   1
  170.       Left            =   240
  171.       Stretch         =   -1  'True
  172.       Top             =   600
  173.       Width           =   372
  174.    End
  175.    Begin VB.Image Image2 
  176.       Height          =   852
  177.       Index           =   0
  178.       Left            =   480
  179.       Stretch         =   -1  'True
  180.       Top             =   1080
  181.       Width           =   372
  182.    End
  183.    Begin VB.Image Image1 
  184.       Height          =   960
  185.       Index           =   1
  186.       Left            =   840
  187.       Picture         =   "Piano.frx":DBCC
  188.       Top             =   2640
  189.       Width           =   480
  190.    End
  191.    Begin VB.Image Image1 
  192.       Height          =   960
  193.       Index           =   0
  194.       Left            =   120
  195.       Picture         =   "Piano.frx":E80E
  196.       Top             =   2640
  197.       Width           =   480
  198.    End
  199. End
  200. Attribute VB_Name = "Form1"
  201. Attribute VB_Creatable = False
  202. Attribute VB_Exposed = False
  203. Option Explicit
  204. Dim FormMove As Integer
  205. Dim FormX As Integer
  206. Dim FormY As Integer
  207.  
  208.  
  209. Private Sub Command1_Click()
  210.     Unload Form1
  211.     
  212. End Sub
  213.  
  214. Private Sub Form_Load()
  215.     Dim nDevice As Long
  216.     Dim i As Long
  217.     Dim r As Long
  218.     Dim OutCaps As MIDIOUTCAPS
  219.     
  220.     Form1.Height = Form1.Height - Form1.ScaleHeight + 170 * Screen.TwipsPerPixelX
  221.     Form1.Width = Form1.Width - Form1.ScaleWidth + 320 * Screen.TwipsPerPixelY
  222.     
  223.     Move (Screen.Width - Form1.Width) / 2, (Screen.Height - Form1.Height) / 2
  224.  
  225.     List1.Top = 240
  226.     List1.Left = 120
  227.     List1.Height = 228
  228.     List1.Width = 3132
  229.     
  230.     Command1.Top = 240
  231.     Command1.Left = 3360
  232.     Command1.Height = 252
  233.     Command1.Width = 360
  234.     
  235.     For i = 0 To 16
  236.         If i = 1 Or i = 3 Then
  237.             Image2(i).Top = 600
  238.             Image2(i).Left = 240 + (i - 1) / 2 * 360
  239.             Image2(i).Height = 492
  240.         ElseIf i = 6 Or i = 8 Or i = 10 Then
  241.             Image2(i).Top = 600
  242.             Image2(i).Left = 1320 + (i - 6) / 2 * 360
  243.             Image2(i).Height = 492
  244.         ElseIf i = 13 Or i = 15 Then
  245.             Image2(i).Top = 600
  246.             Image2(i).Left = 2760 + (i - 13) / 2 * 360
  247.             Image2(i).Height = 492
  248.         ElseIf i = 0 Or i = 2 Or i = 4 Then
  249.             Image2(i).Top = 1080
  250.             Image2(i).Left = 120 + i / 2 * 360
  251.             Image2(i).Height = 852
  252.         ElseIf i = 5 Or i = 7 Or i = 9 Or i = 11 Then
  253.             Image2(i).Top = 1080
  254.             Image2(i).Left = 1200 + (i - 5) / 2 * 360
  255.             Image2(i).Height = 852
  256.         ElseIf i = 12 Or i = 14 Or i = 16 Then
  257.             Image2(i).Top = 1080
  258.             Image2(i).Left = 2640 + (i - 12) / 2 * 360
  259.             Image2(i).Height = 852
  260.         End If
  261.         Image2(i).Width = 360
  262.     Next i
  263.     
  264.  
  265.         
  266.  
  267.  
  268.     For i = 0 To 16
  269.         Image2(i).Picture = Image1(0).Picture
  270.     Next i
  271.     
  272.     nDevice = midiOutGetNumDevs()
  273.     List1.AddItem "MIDI Mapper", 0
  274.     For i = 0 To nDevice - 1
  275.         r = midiOutGetDevCaps(i, OutCaps, Len(OutCaps))
  276.         List1.AddItem OutCaps.szPname, i + 1
  277.     Next i
  278.     List1.ListIndex = 0
  279. End Sub
  280. Private Sub MidiOpen()
  281.     Dim r As Long
  282.     Dim OutCaps As MIDIOUTCAPS
  283.     Dim OutDev As Long
  284.     Dim ErrMsg As String * 256
  285.     Dim i As Integer
  286.     
  287.     OutDev = List1.ListIndex - 1
  288.         
  289.     r = midiOutOpen(hMidi, OutDev, Form1.hWnd, 0, &H10000)
  290.     If r <> 0 Then
  291.         r = midiOutGetErrorText(r, ErrMsg, Len(ErrMsg))
  292.         MsgBox ErrMsg
  293.         Exit Sub
  294.     End If
  295.     
  296.     
  297. End Sub
  298.  
  299. Private Sub MidiClose()
  300.     Dim r As Long
  301.     
  302.     r = midiOutReset(hMidi)
  303.     r = midiOutClose(hMidi)
  304. End Sub
  305.  
  306.  
  307.  
  308. Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  309.     FormX = Form1.Left + X
  310.     FormY = Form1.Top + Y
  311.     Form1.MousePointer = 5
  312.  
  313. End Sub
  314.  
  315. Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  316.     Dim FormX1, FormY1, FormDX, FormDY As Integer
  317.     
  318.     FormX1 = Form1.Left + X
  319.     FormY1 = Form1.Top + Y
  320.     FormDX = FormX1 - FormX
  321.     FormDY = FormY1 - FormY
  322.     Move Form1.Left + FormDX, Form1.Top + FormDY
  323.     Form1.MousePointer = 0
  324.  
  325. End Sub
  326.  
  327. Private Sub Form_Unload(Cancel As Integer)
  328.     Call MidiClose
  329.     End
  330. End Sub
  331.  
  332.  
  333. Private Sub Image2_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
  334.    Dim r, l As Long
  335.    
  336.    Image2(Index).Picture = Image1(1).Picture
  337.     
  338.    l = &HC0
  339.    r = midiOutShortMsg(hMidi, l)
  340.    l = &H643090 + Index * 256
  341.    r = midiOutShortMsg(hMidi, l)
  342.  
  343. End Sub
  344.  
  345.  
  346. Private Sub Image2_MouseUp(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
  347.    Dim r, l As Long
  348.    
  349.    Image2(Index).Picture = Image1(0).Picture
  350.     
  351.    l = &H643080 + Index * 256
  352.    r = midiOutShortMsg(hMidi, l)
  353.  
  354. End Sub
  355.  
  356.  
  357. Private Sub List1_Click()
  358.     Call MidiClose
  359.     Call MidiOpen
  360. End Sub
  361.  
  362.  
  363.