Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




.MP3 In Resource File


Can you store an MP3 in a resource file, and then call it up? (Using the Windows Media Player Control.)




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Resource Files : How To Import From A Text File Into A Resource String Table
Hi every one,

I am using a resource string file. I need to fill my string table with data from a text file, but the "paste" menu item is disabled. How to copy from a text file into a string tabel(resource file) without typing all the data?

Thanks

Copy File From Resource File To Hard Drive As VbHidden
Is it possible to copy a file from the resource to the hard drive as vbHidden ?

I've made a Graphical User Interface for several commandline tools.
I want to include the commandline tools in a resource file and then
when the user starts the GUI, the commandline tools get extracted
to the hard drive as vbHidden.

Most people don't have "Show hidden files and folders" enabled.
This way it looks like there is only one app, instead of a GUI with
all kinds of extra apps, because that looks ugly (in my opinion).

This is the code I'm using now for one commandline tool.


VB Code:
Private Sub Form_Load()    Dim sBuffer As String    sBuffer = StrConv(LoadResData(101, "CUSTOM"), vbUnicode)    Open App.Path & "WhoLockMe.exe" For Output As #1    Print #1, sBuffer    Close #1End Sub

Play Midi File From Resource File Using MciSendString
Is it easy to call a midi file from a resource file?
I have made a resource file with a down.mid song,
I was hoping to be able to play sound with out having to include it with my exe?

I have tried dozens of different ways with no luck, there was an example code in the bank, but it had so many options and different modules,

the code I have now is;


Code:
Private Sub Form_Load()
Temp = mciSendString("play " & "down.mid", 0&, 0, 0)
End Sub


how can I adapt this to use the resource file?

These are just a few of failed attempts;


Code:
Private Sub Form_Load()
Temp = mciSendString("play " & "101", 0&, 0, 0)
End Sub



Code:
Private Sub Form_Load()
Temp = mciSendString("play " & 101, 0, 0)
End Sub



Code:
Private Sub Form_Load()
Dim b As String
b = StrConv(LoadResData(101, "custom"), vbUnicode)
Temp = mciSendString("play " & b, 0&, 0, 0)
End Sub



Code:
Private Sub Form_Load()
Dim b As String
b = StrConv(LoadResData(101, "custom"), vbUnicode)
Temp = mciSendString("play " & "b", 0&, 0, 0)
End Sub



Code:
Private Sub Form_Load()
Temp = mciSendString("play " & 101, 0&, 0, 0)
End Sub


Thanx

couple of the threads I read
http://www.vbforums.com/showthread.php?t=297909
http://www.vbforums.com/showthread.php?t=429148
http://www.vbforums.com/showthread.php?t=417117

Loading A Word.doc From A Resource File To A Temp File.
The code below is what I use to load a Bitmap from a directory on the C drive to a Bookmark in a Word doc.

Code:
.ActiveDocument.Shapes.AddPicture FileName:="C:SKM SoftwaregraphicsX.gif", linktofile:=True, savewithdocument:=True, Left:=425, Top:=218.5

This code has worked just fine, but now I am putting all the bitmaps into a Resource file in my application.
The code I use to load a Bitmap from a resource file to an Image box is shown below.

Code:
frmReportPg2!ImgCarPn.Picture = LoadResPicture(101, vbResBitmap)

The bit I can't work out is how to load a Bitmap from the Resource file to the Word Bookmark.

Help would be much appreciated.

Thanks
Steve.

Resource File Problem - Extracting File To Path
Hello.

Could you please tell me how to extract file from the *.res file into a selected path? I already loaded all files into resource but r unable to process them from inside it so need to extract them. Coudn't find anywhere. Please help me with a line of code.

Thanks and best regards

How To Save RTF File In A Resource File And Load It To RichTextBox
Hi,
Does anyone know how to save RTF file in a resource file and then load it to RichTextBox?

Thanks.

Setting Up A Data Input File As A Resource File
Hi,

Is this possible what I am trying to do. I have a file which my app reads from at initialisation to find the paths for certain directories. I have copied it below. Is the easiest way to make sure that the app can always find this file to read, so no matter where the app is installed the file will always be with it to have the file as a resource file.
I tried opening the resource editor and creating a custom resource file using my inout file. The problem is that if this is correct I have no idea how to read in the data from the resource file. Loadresdata only reads in bytes, I am looking for some way to read in lines at a time, as I would do if I was reading in normally from a file.

Is any of the above correct? If not what would be the best way of doing what i want to do?

Cheers,

John

Here is the inout file I was talking about:

#This file contains all the settings paths for the Database and Upload and Download
#directories. Any additional comments added in should be preceded by a # symbol.
#It would be wise to keep a copy of this file under a different name in case this version gets
#corrupted or changes somehow. When editing only edit the paths after the equals sign.
#Do not leave a gap between the path name and the equals sign and keep all data in the
#same order as it is here now.

#Database path + filename
Database-Directory=C:PiperTrack.mdb

#upload directory
Upload-Directory=C:Dan Stuffupload

#Download Directory
Download-Directory=C:Dan StuffDownload


To Write .ico File From Resource File To A Folder
How can I extract icon files (.ico) and a cursor files (.cur) from my application's resource file and write them to the app.path in runtime ?

Thank you

Comparing A Resource File With Actual File
How would i compare a resource file in my project, with an actual file on the computer? heres my code, but it doesn't work. Anyone got any ideas or fixes?


Code:
Private Sub CheckBinary()
Dim byteRes() as Byte, byteFile() as Byte
Dim xFile as Integer

'Load the resource data to byteRes
byteRes() = LoadResData(101,"CUSTOM")

'Load the computer file onto byteFile
xFile = FreeFile
Open "C:Program.exe" For Binary Access Read As #xFile
Get #xFile, ,byteFile()
Close #xFile

'Compare both bytes together
If byteRes() = byteFile() Then
Msgbox "They are the same!"
Else
Msgbox "They are NOT the same!"
End If
End Sub


That code doesn't really work for me. Any help?

NOTE THAT BOTH THE RES FILE AND THE ACTUAL FILE ON THE COMPUTER ARE THE SAME FILES

How To Include A Font File (*.ttf) Into A Resource File (*.res)
How to include a font file (*.ttf) into a resource file (*.res)

Please Help.

Animated GIF From Resource File To Disk File?
Stored the data from an animated GIF to a resource (.rc) file. The stored data in the resource matches a dump of the original file in a hex editor. When getting the data from the resource I am unable to write it to disk and re-create the file.

    Dim C() As Byte
    C() = GetResourceCustom(ResourceIndex)

    Dim sFileName As String
    Dim nFile As Integer
    sFileName = "C:TEMP.GIF"
    nFile = FreeFile
    Open sFileName For Binary Access Write As #nFile
    Put #nFile, , C
    Close #nFile
    Erase C

The file does not contain the same data as the resource (or the original).

Any ideas? - Ron

Loading An Html File From A Resource File
Hi Guru, I try to load an html file into my resource file and borrow wizbang codes to load from the resource file to webbrowser via newly created html file but the new html file is not exactly the same as the original html file, new characters were added into the new htm file. How can I get the new html to be exactly the same as the original html file? Thank's.


Private Sub Form_Load()
Dim B() As Byte
Dim s As String
Dim i As Long

Dim Temp As String
Dim StartPosition As Long
Dim mHandle As Integer

s = ""
B = LoadResData(101, "CUSTOM")
For i = 0 To UBound(B())
s = s & Chr(B(i))
Next i
Erase B

mHandle = FreeFile
Open "C: emp.htm" For Binary As #mHandle
StartPosition = LOF(mHandle)
Temp = s
Put #mHandle, , Temp
Put #mHandle, , StartPosition
Close #mHandle

webbrowser1.Navigate "C: emp.htm"
End Sub

Resource (.res) File
Hi,
Is there a way to edit the content of resource (.res) file by code? or delete and create .res file by code?

Resource File
Does a resource file to be included in the package or is it compiled in the exe ?

Resource File
Is it posible to have a file in the resource and then it copies and pastes it to a location you set?

Resource File
I want to add a .wav file or a .jpg file to a res file, but i have no idea how to do this. I searched the forum quickly for some info but i couldnt find any helping steps for this. How can i make a res file and how can i include it, and drop the .wav or .jpg in a folder. Can anyone help me with this. Thanks

Resource File
how to create a resource file with the name MyFile.res?

.wav In Resource File
Have successfully added a .bmp to my resource file and used it on my forms through LoadResPicture.

However, I'm not having much luck adding a .wav to my resource file and using it in my application. Unfortunately, MS' help files aren't very clear either.

Anyone know how to accomplish this?

Resource File
How can I load data into a resource file ?
I know that I can load data from it with LoadResString

Resource File
Hi,

The following code will display an AVI in a resource file.

[code]

Option Explicit
Private Sub Command1_Click()
Dim hRsrc As Long
Dim hGlobal As Long
Dim lpString As String
Dim strCmd As String, strReturnVal As String
Dim nbuf As Long

lpString = "#101"

hInst = LoadLibrary("<Path resource dll file name>")
hRsrc = FindResource(hInst, lpString, "AVI")
hGlobal = LoadResource(hInst, hRsrc)
lpData = LockResource(hGlobal)
fileSize = SizeofResource(hInst, hRsrc)

Call mmioInstallIOProc(MEY, AddressOf IOProc, _
MMIO_INSTALLPROC + MMIO_GLOBALPROC)
nbuf = 256

strCmd = "open test.MEY+ type avivideo alias test"
strReturnVal = mciSendString(strCmd, 0&, 0&, 0&)
strCmd = "play test wait"
strReturnVal = mciSendString(strCmd, 0&, 0&, 0&)
strCmd = "close test"
strReturnVal = mciSendString(strCmd, 0&, 0&, 0&)

Call mmioInstallIOProc(MEY, vbNull, MMIO_REMOVEPROC)
FreeLibrary hInst
End Sub

Option Explicit
Public lpData As Long
Public fileSize As Long
Public hInst As Long

Public Const MMIO_INSTALLPROC = &H10000

Public Const MMIO_GLOBALPROC = &H10000000


Public Const MMIO_READ = &H0
Public Const MMIOM_CLOSE = 4
Public Const MMIOM_OPEN = 3
Public Const MMIOM_READ = MMIO_READ
Public Const MMIO_REMOVEPROC = &H20000
Public Const MMIOM_SEEK = 2
Public Const SEEK_CUR = 1
Public Const SEEK_END = 2
Public Const SEEK_SET = 0
Public Const MEY = &H2059454D


Public Type MMIOINFO
dwFlags As Long
fccIOProc As Long
pIOProc As Long
wErrorRet As Long
htask As Long
cchBuffer As Long
pchBuffer As String
pchNext As String
pchEndRead As String
pchEndWrite As String
lBufOffset As Long
lDiskOffset As Long
adwInfo(4) As Long
dwReserved1 As Long
dwReserved2 As Long
hmmio As Long
End Type


Public Declare Function FindResource Lib "kernel32" _
Alias "FindResourceA" _
(ByVal hInstance As Long, _
ByVal lpName As String, _
ByVal lpType As String) _
As Long


Public Declare Function LoadResource Lib "kernel32" _
(ByVal hInstance As Long, _
ByVal hResInfo As Long) _
As Long


Public Declare Function LockResource Lib "kernel32" _
(ByVal hResData As Long) As Long


Public Declare Function LoadLibrary Lib "kernel32" _
Alias "LoadLibraryA" (ByVal lpLibFileName As String) As Long


Public Declare Function FreeLibrary Lib "kernel32" _
(ByVal hLibModule As Long) As Long


Public Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" _
(hpvDest As Any, _
hpvSource As Any, _
ByVal cbCopy As Long)


Public Declare Function mmioInstallIOProc Lib "winmm" _
Alias "mmioInstallIOProcA" _
(ByVal fccIOProc As Long, _
ByVal pIOProc As Long, _
ByVal dwFlags As Long) _
As Long

Public Declare Function mciSendString Lib "winmm.dll" _
Alias "mciSendStringA" _
(ByVal lpstrCommand As String, _
ByVal lpstrReturnString As Long, _
ByVal uReturnLength As Long, _
ByVal hwndCallback As Long) _
As Long

Public Declare Function SizeofResource Lib "kernel32" _
(ByVal hInstance As Long, _
ByVal hResInfo As Long) As Long


Public Function IOProc _
(ByRef lpMMIOInfo As MMIOINFO, _
ByVal uMessage As Long, _
ByVal lParam1 As Long, _
ByVal lParam2 As Long) _
As Long

Static alreadyOpened As Boolean

Select Case uMessage
Case MMIOM_OPEN
If Not alreadyOpened Then
alreadyOpened = True
lpMMIOInfo.lDiskOffset = 0
End If
IOProc = 0

Case MMIOM_CLOSE
IOProc = 0

Case MMIOM_READ:
Call CopyMemory(ByVal lParam1, ByVal _
lpData + lpMMIOInfo.lDiskOffset, lParam2)
lpMMIOInfo.lDiskOffset = lpMMIOInfo.lDiskOffset + lParam2
IOProc = lParam2

Case MMIOM_SEEK

Select Case lParam2
Case SEEK_SET
lpMMIOInfo.lDiskOffset = lParam1

Case SEEK_CUR
lpMMIOInfo.lDiskOffset = lpMMIOInfo.lDiskOffset + lParam1
lpMMIOInfo.lDiskOffset = fileSize - 1 - lParam1

Case SEEK_END
lpMMIOInfo.lDiskOffset = fileSize - 1 - lParam1
End Select

IOProc = lpMMIOInfo.lDiskOffset

Case Else
IOProc = -1

End Select

End Function

============

** This code was obtained from Microsofts help site.

Can anyone advise what needs to be done to open the avi window at certain size, and how to enable the close button [x] to work?

Many Thanks for your assistance.

Rgds,
Dan

Resource File. Please Help Me!!!
How do i use my resource file.

I have maked a menu at my form.

The Menu:

101
...102
...103
...104
...105
106
...107
...108
......109
......110
.........111

And my resource file.

ID | Danish | English (USA)
101 T1 Test1
102 T2 Test2
103 T3 Test3
104 T4 Test4
105 T5 Test5
106 T6 Test6
107 T7 Test7
108 T8 Test8
109 T9 Test9
110 T10 Test10
111 T11 Test11


How do i set the language "Danish" to the menu, and how do i set the language "English (USA)" to the menu?

Resource File
hey,

I want to have a resource file where i can make a table of Dutch and English,

I read that the string retrieved is based on the current system language, is it possible that it is not based on the current system
language but that the user choose with language and write that in a ini file

thankz in advance

Alex

Resource File
I have a .rcf creator (Resource File Editor). I know how I can place the .rcf once I am done adding files to it into VB6. In the project explorer, a new folder will show up called modules and the file "songs.rcf" shows up.

What I would like to do with that resource file, is for my program to go get a song that is on it and play it. Any ideas? If you need more details I can provide them.

Resource File
A friend of mine wrote a button ocx and has a button up and button down picture properties. He wants to use a resoruce file and load the button as follows:

Button1.PictureUp = LoadResPicture("ButtonUp", vbResBitmap)

but when the form containing the control loads up, but an error is returned advising 'invalid use of property'.

As I don't know anything about resource files could someone help.
As for me:
What is the advantage of using resource files. I figured it just added extra overhead to the exe file.

Thanks,
Wayne

Mp3/Resource File/ Is It Possible?
Hi all,

I just wonder, is there a way to play mp3 files from a resource file directly?

I mean not writing to a temp folder from resource file and then playing and killing it but directly from the resource file, like we do wav files with soundplay function.

Is there a way you guys can think of? maybe combination of some APIs..

Thanks All,
EpcH

Resource File
Hi

I'm a newbie to VB and especially resource file.

I roughly know how to load a text file from resource. After saving the resource into file, is it also possible to make changes to the text file and put the amended text file back into the resource?

Just wondering, besides using database or text file to store information, is it also possible that an application (exe) stores information too?

Thanks

Resource File
i have tried doing a .txt resource file with the help of tutors corner but i am having problems loading it into the textbox, it is loading but its jumbled letters the first half then it goes ok.

what i really wanted to do was open it with notepad really so how would you put the text into a string then send it to notepad ?


thanks a lot.
14yrsgirl.

Resource File, How When && What :x
Well, im not sure if this has been asked before...or not, but whenever i use the 'search' function vb always brings back irrelevant stuff :<
Well, basically..I'm not that clued up on Resource files (well, tbh im not even sure what one is )
So, firstly, is a resource file what i think it is (a file...which has been encrypted into the actual application e.g. a swf is encrypted into a swf player, instead of the actual swf file in a directory, i hope that makes sense ><)

Like, im just experimenting on a splash screen (Kinda like the Creative one)
(if you have a creative sound card, you'll know what i mean )
But instead of having the swf in the program directory - is there anyway it can be hidden/encryted/whatever'd into the application

Danke

Why We Use Resource File
I am wondering why we use resource files for some string data and images
instead using directly on the controls!

Please any body help me?

Using More Than 1 Resource File!
I am using more than 1 Resource file in my project - one for bitmaps named ResBMP.res & the other for custom files named ResCustom.res. Assume that the ID of one of the bitmaps in ResBMP.res is Back1.

Before creating ResCustom.res, the following code was working fine:
VB Code:
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)    picBack.Picture = LoadResPicture("Back1", vbResBitmap)End Sub
but after I created ResCustom.res, the above code generated the Resource with identifier "Back1" not found error pointing to the above line.

How do I resolve this issue?

What Is A Resource File?
help pls
what is a resource file? and how can i use it?
can you give me a example of code in using that


thanks!!!!

About Resource File(*.res)
Hi there,

Is it possible to put a .swf in a resource file (*.res)?
If it's possible, how to do it in VB6?

Thanks~

Resource File
Hello

Please tell me how can i create Resource File and how to use it in my project

Farooq

Resource File
I want to make a vb resource file during runtime. Can i do this and there is a reason for me wanting to make it at runtime but i can not disclose it. If i can not do this is there any other ways that would work similar to a resource file.

Resource File
Hey guys,

Lets say I have a multilanguage application using resource files.

So I have a string table like this for eg:-

ID English German
101 Yes Ja

now lets say the OS is English. But the regional settings is for Germany. What would happen? Would it be shown in english or german?

.wav In Resource File
Have successfully added a .bmp to my resource file and used it on my forms through LoadResPicture.

However, I'm not having much luck adding a .wav to my resource file and using it in my application. Unfortunately, MS' help files aren't very clear either.

Anyone know how to accomplish this?

Help: Resource File In Vb
Hi,

I just want to ask you guys to send me a simple project with resource file in it. I have never use resource file before in VB and I want to try it.

One thing more... Can I use Visual C++ to build the resource script? I think C++ will do but I just wanna make sure.

Thanks in advance for your help...

Resource File
I am using Vb6 SP5 .

Resource Editor does not recognize the True color icons ( 24 bit ) , any possible ways to use these icons in resource file ?

Thanks.

Resource File
i have some set of bitmap files that my app links to at runtime ,now i want to transfer the bitmap files into a resource file. how will i write codes for my app to link to it at runtime.
then anything again about resource file?

Resource File
Hi Everyone,

I have quite a few .Tif image files that I would like to place inside of a Resource File. Is there anyway to place these images files in the Resource File dynamically through code, and is there a file size limit? Some of the .Tif files are about 900kb in size. Thanks for your help.

Resource File
I have a resource file (.RES) with more than one string tables.
Does anybody know how to access a specific table?
I have LoadResString(string_id), but nothing about the table from which I want the result to be returned.

How about it?

Resource File
Hi All,

Is there a wizard I can use to add a resource file to my current vb project I know you can use a wizard to add a resourse file to a new project and it would be linked to all my captions on my labels.
I would not like to code all my captions seeing I've got more than 600 labels,buttons and frames in my project. Please Help

wernerH

Using Resource File
hi,

Does anybody have any idea how to use resource file in VB.

Thanks.

Another Resource File(AVI)?
OS Win2000 VB6.0, Newbie

I am using the following code to play an .avi file in a bordeless window on top of the MainForm using the MM API(No MM Control), and it works great, but when I store this file in a resource file I am unable to get it to play.

Private Sub cmdVideo_Click()
Dim returnstring As String
Dim FileName As String
Dim i As String
Dim CommandString As String
returnstring = Space(127)

'AVIfile to play
FileName = "Warmup.avi"
i = mciSendString("open " & Chr$(34) & FileName & _
Chr$(34) & " type avivideo alias u4l12", returnstring, _
127, 0)
i = mciSendString("set video time format ms", _
returnstring, 127, 0)
i = mciSendString("play u4l12 from 0", returnstring, _
127, 0)
i = mciSendString("play u4l12", 0&, 0, 0)
End Sub

Can anyone tell me how to play this video from a resource file?

Resource File And .AVI's
I want to add a .avi file to my Resource File and then load this into an Animation control in order to do the standard windows type animations for searching etc.

The MSDN actually mentions .avi files as an example of what can be included in a Resource File and then loaded into the project using "LoadResData".

Can anyone tell me how you get the .avi file into the Animation control, as the way I would normally do it in code would be to use the Open method with the path to the file.

i.e. Animation1.Open App.Path

LoadResData returns a byte array and I don't know how to use this to load the .avi file in to the control.

Resource File
I learned how to add source files to the excutable file (sound files in my project)
The question is: can I make that resources in a single seperated file so I can reach my resources from a files outside the exeutable?

EXE In A Resource File
I'm making a simple installer program for a little program a group of us made, I placed the EXE in a resource file, put it in the installer project, but when extracting it to an EXE file there are 12 extra bytes added to the front of the program, causing it to not work.

this is the code I'm using to try and write it from the res file to an EXE.

kioskexe = LoadResData("KIOSK.EXE", "CUSTOM")
KioskICO = LoadResData("KIOSK.ICO", "CUSTOM")


'Extracts Kiosk.exe from Kiosk Install.exe

Open frm_install4.InstallDir & "kiosk.exe" For Binary As #1
Put #1, , kioskexe
Close #1

Anyone got an idea why it isn't working

Resource File
Doesanybodyknowhowtoputafilelikeatextfileasaresourcefileinsideyourprojectandlikekindapullitfromtheappandsaveittothecoputerlikeasetupprogram

Resource File?
Hi again!

If I use a resource file to have different languages in my app I can have different languages in e.g. CommandButtons, but will this also work with messages like [MsgBox "Help me!"]?

(If someone understands my question, please let me know )

Copyright © 2005-08 www.BigResource.com, All rights reserved