Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.lang.visual.basic    |    MS Visual Basic discussions, NOT dot-net    |    10,840 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 9,839 of 10,840    |
|    Jay Taplin to All    |
|    Re: Adding a WAV file as a resource in V    |
|    15 Jan 06 21:00:25    |
      From: jtaplin@integraware.com              The code below should do it for you. To do this, open up the resource file       editor; if you don't see it, go to "Addins...Add-in Manager" on the menu.       Check that the "VB 6 Resource Editor" has the words Startup (and maybe       Loaded too) under the column labeled "Load Behavior". After exiting out of       this window, you can access the resource editor either by the green icon on       the toolbar, or "Tools...Resource Editor".              After this, I just drag/dropped a .WAV file into the resource file window       (if you don't see the resource file window in VB 6. Then I ran the code       below:              Option Explicit              'API Declarations        Private Declare Function sndPlaySound Lib "winmm.dll" Alias       "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As       Long              'Module Level Constant Declarations        Private Const SND_ASYNC As Long = &H1        Private Const SND_MEMORY As Long = &H4        Private Const SND_NODEFAULT = &H2        Private Const Flags& = SND_ASYNC Or SND_NODEFAULT Or SND_MEMORY              'Control-related Events        Private Sub Command1_Click()        Dim b As String               b = StrConv(LoadResData(101, "WAVE"), vbUnicode)               sndPlaySound b, Flags&        End Sub              This code was copied and very minimally changed (to document) from code I       found at http://www.vbforums.com/showthread.php?s=&threadid=297909              Jay Taplin, MCP              --- SoupGate-Win32 v1.05        * Origin: you cannot sedate... all the things you hate (1:229/2)    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca