I was asked to take on a project for a local foodbank. The foodbank has a giant/huge wooden turkey that they set up for donations. There is a 2'x 1' door on the turkey that the donator lifts up to place food inside.
My task was to (on short notice) make the turkey "gobble gobble" when the door was lifted up. So I wrote a program in Visual Basic 6, which I am familiar with. But to come and fnd out that it will never work because the ActiveX Control MSCOMM32.OCX which controls the Serial ports is not included in the "Working Model Edition". So I found the file and installed it. When I went to use it, it said it is not licensed and regestered. I cannot find any way around it except switching to Visual C++ 6.0, because i have the full blown version )standard with the librarys.
I have not used C++ for years and I need help converting VB6 to C++ (if possible). Any help will be greatly appreciated.
Here is the code that I had for VB6:
'Declare the API call
Private Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
'Declare the constants that go along with the sndPlaySound function
Const SND_ASYNC = &H1 'ASYNC allows us to play waves with the ability to interrupt
Const SND_LOOP = &H8 'LOOP causes to sound to be continuously replayed
Const SND_NODEFAULT = &H2 'NODEFAULT causes no sound to be played if the wav can't be found
Const SND_SYNC = &H0 'SYNC plays a wave file without returning control to the calling program until it's finished
Const SND_NOSTOP = &H10 'NOSTOP ensures that we don't stop another wave from playing
Const SND_MEMORY = &H4 'MEMORY plays a wave file stored in memory
Private Sub Form1_Load()
MSComm1.CommPort = 1
MSComm1.PortOpen = True
End Sub
Private Sub MSComm1_OnComm()
If MSComm1.CommEvent = comEvRing Then sndPlaySound App.Path & "\sound.wav", SND_SYNC Or SND_NODEFAULT
End Sub
My task was to (on short notice) make the turkey "gobble gobble" when the door was lifted up. So I wrote a program in Visual Basic 6, which I am familiar with. But to come and fnd out that it will never work because the ActiveX Control MSCOMM32.OCX which controls the Serial ports is not included in the "Working Model Edition". So I found the file and installed it. When I went to use it, it said it is not licensed and regestered. I cannot find any way around it except switching to Visual C++ 6.0, because i have the full blown version )standard with the librarys.
I have not used C++ for years and I need help converting VB6 to C++ (if possible). Any help will be greatly appreciated.
Here is the code that I had for VB6:
'Declare the API call
Private Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
'Declare the constants that go along with the sndPlaySound function
Const SND_ASYNC = &H1 'ASYNC allows us to play waves with the ability to interrupt
Const SND_LOOP = &H8 'LOOP causes to sound to be continuously replayed
Const SND_NODEFAULT = &H2 'NODEFAULT causes no sound to be played if the wav can't be found
Const SND_SYNC = &H0 'SYNC plays a wave file without returning control to the calling program until it's finished
Const SND_NOSTOP = &H10 'NOSTOP ensures that we don't stop another wave from playing
Const SND_MEMORY = &H4 'MEMORY plays a wave file stored in memory
Private Sub Form1_Load()
MSComm1.CommPort = 1
MSComm1.PortOpen = True
End Sub
Private Sub MSComm1_OnComm()
If MSComm1.CommEvent = comEvRing Then sndPlaySound App.Path & "\sound.wav", SND_SYNC Or SND_NODEFAULT
End Sub