Hello Guest it is March 28, 2024, 01:00:28 PM

Author Topic: Two state button  (Read 3678 times)

0 Members and 1 Guest are viewing this topic.

Offline zealous

*
  •  489 489
  • HI!
    • View Profile
    • Artsoft Solutions
Two state button
« 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
Re: Two state button
« Reply #1 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
Fixing problems one post at a time ;)

www.newfangledsolutions.com
www.machsupport.com

Offline zealous

*
  •  489 489
  • HI!
    • View Profile
    • Artsoft Solutions
Re: Two state button
« Reply #2 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.