Machsupport Forum

Mach Discussion => VB and the development of wizards => Topic started by: zealous on June 08, 2006, 05:48:49 AM

Title: Two state button
Post by: zealous on June 08, 2006, 05:48:49 AM
Try to figure out how to call on two states of a button to call on two diffrent wave files.

I got creative and used some of the Display button code, it works but also effects the state of the display screen.
Was wondering how a programer would do this ??? Tried a few diffrent ways to go about it, but I'm still learning coding.
I tried changing "Boundry" but the code skips over and only plays one of the sound waves for each button state.

Here is the code if you have any idea.

value = GetParam("Boundry")

Public Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" _
    (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long

 If value= 1 Then
 SetParam "Boundry" , 0
 DoOEMButton(103)
 sndPlaySound "C:\WINDOWS\MEDIA\ding.wav", &H1
 
 Else
 SetParam "Boundry" , 1
 DoOEMButton(103)
 sndPlaySound "C:\WINDOWS\MEDIA\tada.wav", &H1
 End If
Title: Re: Two state button
Post by: Brian Barker on June 08, 2006, 06:37:25 AM
Try this :)




value = GetVar(1)

Public Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" _
    (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long

If value= 1 Then
Call SetVar(1, 0)
DoOEMButton(103)
sndPlaySound "C:\WINDOWS\MEDIA\ding.wav", &H1
 
Else
Call SetVar(1, 1)
DoOEMButton(103)
sndPlaySound "C:\WINDOWS\MEDIA\tada.wav", &H1
End If
Title: Re: Two state button
Post by: zealous on June 08, 2006, 11:13:10 PM
Thank you Mr.Baker that works great ;D

While reading the PDF I had come across "GetVar" .
I thought I might be able to  declare a value and give it an on/off statement.
Your codes sweet!!! and a little sexy :D
I'm putting together some pretty cool sound sets for Mach. I'll post them when there ready.