Answer the question
In order to leave comments, you need to log in
Visual Basic 6.0. How to play *.Wav file by its pointer in memory?
There is a resource file “MMM.wav”. Shown in the figure
Private Declare Function FindResource Lib "kernel32" Alias "FindResourceA" (ByVal hInstance As Long, ByVal lpName As String, ByVal lpType As Long) As Long
Private Declare Function LoadResource Lib "kernel32" (ByVal hModule As Long, ByVal hResInfo As Long) As Long
Const RT_RCDATA = 10&
Dim F As Long, L As Long
F = FindResource(0, "MMM", RT_RCDATA) – find the resource file “MMM.wav” and find out some digital address of this file
L = LoadResource( 0, F) – find some digital address resource file “MMM.wav”
Hex(F) – possible pointer in memory resource file “MMM.wav”
Hex(L) – possible pointer in memory resource file “MMM.wav”
WindowsMediaPlayer1.URL = "C:\MMM.wav" - will play the file “MMM.wav” if it is on the “C” drive
Question:
How to make WindowsMediaPlayer1.URL play the file “MMM.wav” at its pointer in memory
For example: WindowsMediaPlayer1.URL = Hex(F) or Hex(L) - broken code
Answer the question
In order to leave comments, you need to log in
Buy specialized forums. I don't even know if anyone else is using VB6.
As far as I remember, what you want is done through WinApi. See more C++ forums.
1. Save the resource to a temporary file.
2. Play temporary file.
3. Delete temporary file.
You are trying to pass a reference to an Inproc resource to an Outproc object. It doesn't work like that...
The issue was resolved with the help of third-party functions, and therefore there is no point in posting the code. Without these third-party functions, the code is broken.
Thanks to everyone and especially to BeerChaser.
The question is closed.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question