Welcome, Guest. Please login or register.
Did you miss your activation email?
May 28, 2012, 02:05:54 PM

Login with username, password and session length
Search:     Advanced search
* Home Help Search Calendar Links Login Register
+  Machsupport Forum
|-+  Mach Discussion
| |-+  VB and the development of wizards
| | |-+  Two state button
Pages: 1   Go Down
Print
Author Topic: Two state button  (Read 1301 times)
0 Members and 2 Guests are viewing this topic.
zealous
Active Member

Offline Offline

Posts: 486



View Profile WWW
« on: June 08, 2006, 04: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 Huh 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
Logged

Regards, Jason Blake

www.Fusioncnc.com
Brian Barker
Administrator
*
Offline Offline

Posts: 3,383



View Profile
« Reply #1 on: June 08, 2006, 05:37:25 AM »

Try this Smiley




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
Logged

Fixing problems one post at a time Wink

www.newfangledsolutions.com
www.machsupport.com
zealous
Active Member

Offline Offline

Posts: 486



View Profile WWW
« Reply #2 on: June 08, 2006, 10:13:10 PM »

Thank you Mr.Baker that works great Grin

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 Cheesy
I'm putting together some pretty cool sound sets for Mach. I'll post them when there ready.

Logged

Regards, Jason Blake

www.Fusioncnc.com
Pages: 1   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!