PDA

View Full Version : VB Programming...


zesti
05-02-2004, 10:18 PM
Yes I am a "new" programmer and was wondering if someone could write me a line of code in VB in which I could incorperate midi files. I use the following code for .wav files...

*General*
Private Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long

Private Sub cmdSound1_Click()
sndPlay = sndPlaySound("c:\xFiles\VBasic\a_Sounds\wrong.wav" , 1)
End Sub

Could someone inform me of how to use .midi files?

Greg
05-02-2004, 11:07 PM
Try this link http://www.geocities.com/alpha_productions2/vb_dxmusic.htm

zesti
05-03-2004, 02:41 PM
Seems very detailed. I gave it a try and I got an error on this line of code:

Private DX As New DirectX7

Error:

Compile Error:

User-defined type not defined

Mabye i'm doing something wrong :)

Greg
05-03-2004, 03:42 PM
I've never used DirectX as a lib., but I bet the newest is not 7.

zesti
05-03-2004, 04:29 PM
So I need to change something? If so, could you tell me what? If not I fully understand :)

Greg
05-03-2004, 05:07 PM
I'm not experienced with vb in these functions. I pulled that link off google. Sorry I can't help first handed.

zesti
05-03-2004, 05:41 PM
I'm not experienced with vb in these functions. I pulled that link off google. Sorry I can't help first handed.

Thx very much :)

Bond
05-04-2004, 09:00 AM
Use this link:

http://support.microsoft.com/default.aspx?scid=kb;en-us;171980

zesti
05-05-2004, 03:53 PM
Use this link:

http://support.microsoft.com/default.aspx?scid=kb;en-us;171980

Thx a lot Bond... I tried it out and it worked :)

The only prob is that i can't stop the song in the middle of it...i have to wait till its finished be4 you can continue running the program :rolleyes:

Bond
05-06-2004, 08:31 AM
Yeah, I don't know if there's an asynchronous method to play MIDI's using the API's provided, and since you can't multithread in VB, you may be out of luck!

zesti
05-06-2004, 07:47 PM
Yeah, I don't know if there's an asynchronous method to play MIDI's using the API's provided, and since you can't multithread in VB, you may be out of luck!

--snip--


EDIT:
Don't ever post wares links again!