

Set IPicture.Picture = LoadPicture("c:abcgraphicspd.wmf") Set IPicture.Picture = LoadPicture("c:abcgraphicspc.wmf") Set IPicture.Picture = LoadPicture("c:abcgraphicspb.wmf") Set IPicture.Picture = LoadPicture("c:abcgraphicspa.wmf") Private Declare Function sndplaysound32 Lib "winmm.dll" Alias "sndplaysounda" (ByVal pszsoundname As Long) As LongĬall sndPlaySound32("c:abcintro.wav&quo" t, 0) 'Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long I am not using Win2010 instead I have winXP and yes I have volume on sound, not so daft it happens. I am in the process of checking your solution now. Hopefully this will work for you once you get your errors and other issues resolved. The paths are now very easy to use (PlaySound SFD & "Cheat.wav", 0, &H1) and your sounds should all play properly. With a disc running in drive E, my previous example of Left(App.Path,3) & "SpellingSound" would assign the path E:SpellingSound to the SFD string variable. All other files must have relative paths to play properly but have always worked for me using PlaySound. wav extension since the file exists in the WindowsMedia folder. This example (PlaySound "Tada", 0, &H1) will work perfectly and does not even need the. Sounds without a relative path are assumed to be in the WindowsMedia folder.

Using the PlaySound function has always worked as well but the relative path is critical for sounds to work correctly. The file paths were the biggest problem at first until I started using the App.Path method to get the drive letter. I had spent a lot of time using a virtual drive to mount disc images and test without burning a disc each time. I have been using Autorun to deploy content on CD/DVD and USB for several years now. This would need to be different for network drives but the concept is the same. Sounds are now located as SFD & "SpellingSoundCheat.wav" or SFD & "Cheat.wav" SFD = Left(App.Path,3) or even SFD = Left(App.Path,3) & "SpellingSound" This even works on network drives with the at the beginning of the path. You can use App.Path to show ONLY the drive letter, regardless of the drive type.
IPICTURE MSDN .EXE
exe file is running from a HDD/DVD or USB location via Autorun, the path to your files should exist on the same drive. Result = G:ProgramCheat.wav or G:ProgramSpellingSoundCheat.wav This would also fail if the app was not located on the drive root and was in a folder. If the App is in the root like G:ABC.exe, the result may be G:Cheat.wav but would need the additional path to "SpellingSound" to work correctly. Some problems with App.Path & "SoundName.wav" would be. I think Martin is on track with the App.Path option but this may only work sometimes using this method.

The Drive Type may not always be a CD ROM drive and GetFirstCdRomDriveLetter would not work if they have two drives and the disk was running from drive number two. My vb6 memory is rusty - but you may need to file.IO as VB6 namespaces are somewhat different to visual fred's. 'Check for drives that are Read Only with case-sensitive file names andĬall GetDriveInformation(cmbDrives.SelectedItem) 'Just to ensure coreect info shown for default driveĬmbDrives.Enabled = True 'Ok we'll allow user to initially select the driveītnOpen.Enabled = True 'Ok we'll allow the open button If drive.DriveType = DriveType.CDRom Then 'to do this test for validity to stop users trying to accidently play such devices as CDROMs
IPICTURE MSDN WINDOWS
'USB devices that 'appear' to most Windows apps as 'CDROMs'(even though they aren't) I have 'Populate the drive combobox with a list of *VALID* CDROM drives - note: because I have some
IPICTURE MSDN PC
Since I don't have VB6 on my PC nowadays - I can give you a vb.net example:īelow is a partial listing from one of my VB.Net 2010 projects:Ĭall disableButtons() 'Start with everything disabled You have to enumerate the drives and test for their type (and state of readiness etc.)
