Date: 02-16-2022
Return to Index
created by gbSnippets
'See this link: http://gbl_00329 for background information on creating
'a basic resource file. More information can be found at MSDN,
'at http://msdn.microsoft.com/en-us/library/aa381042%28VS.85%29.aspx
'This snippet builds on the earlier snippet, providing information on building a
'resource script file with a wider variety of content, including these resources:
Bitmap HTML StringTable
CURSOR Icon User-Defined
Font RCData VersionInfo
'Most of these resource types can be read directly within a PowerBASIC
'application. However, the VersionInfo are read using these API found at
'MSDN ( http://msdn.microsoft.com/en-us/library/ms646981%28VS.85%29.aspx )
GetFileVersionInfo VerFindFile
GetFileVersionInfoEx VerInstallFile
GetFileVersionInfoSize VerLanguageName
GetFileVersionInfoSizeEx VerQueryValue
'Finally, the "#Include" directive allows inclusion of the script from an external file.
'Primary Code:
'This resource script contains examples of all of the resource types described above.
'The text/binary files mentioned in this example are NOT distributed with gbSnippets.
'See the http://gbl_00331 snippet for examples of accessing most of this information.
//resource script Comment Line (Optional)
#Include "more_info.rc" // compiler adds this external resource script file
// icons, Bitmap, wave, Font, cursor, html resources
rocket Icon "c:\myimages\rocket.ico"
mark Icon "c:\myimages\check.ico"
500 Icon "c:\myimages\x.ico"
600 Icon "y.ico"
girl Bitmap "girl.bmp"
boy Bitmap "boy.bmp"
comicms Font "c:\windows\fonts\comic.ttf"
eyeball cursor "c:\windows\cursors\pepsi_ball.cur"
net1 html "c:\data\mypage.html"
// RCDATA Resource: lets you include integers AND strings in the resource file.
// each rcdata resource can contain multiple items AND span multiple Lines.
intro rcdata {5L, 72L, "A string", "Another string"} // Single Line version
alternate rcdata // Multi-Line version
{
472L,
128L,
"An end note"
"Another end note"
}
// String Table: Let you include multiple strings, each with its own identifier
// Strings in a String table also may Not use names, but instead must use numeric identifiers
StringTable
[ optional comments ]
BEGIN
100, "Gary Beene"
200, "Gary Beene's Information Center"
300, "gbeene@airmail.net"
400, "Dallas\012Texas"
End
// User-Defined Resource: a User can define a Type of their naming, as long as the resource itself can be
// found in a file. In the Next 2 Lines, "wave" is a custom resource Type Name, associated with a file.
alarm wave "alarm.wav"
Beep wave "beep.wav"
//VERSION INFO
VS_VERSION_INFO VERSIONINFO
FileVersion 1,6,0,0
ProductVersion 1,6,0,0
FileOS VOS__WINDOWS32
FileType VFT_APP
FileSubType VFT2_UNKNOWN
BEGIN
Block "StringFileInfo"
BEGIN
Block "040904E4"
BEGIN
Value "Owner Name", "Gary Beene"
Value "ProductName", "gbSnippets"
Value "ProductVersion", "1.6"
Value "LegalCopyright", "Copyright 2009 ©, Gary L. Beene"
End
End
End
//resource script file
'Note: VersionInfo is a standard section of a resource file. Several API
'are available to extract VersionInfo data.
'Compilable Example: (Jose Includes)
'This example shows how to use the "#Resource" metastatement to direct the
'compiler to include a *.pbr file within the EXE - in this case the gbsnippets.pbr
'resource file that ships with gbSnippets.
#Compiler PBWin 9, PBWin 10
#Compile EXE
#Resource "gbsnippets.pbr"
Function PBMain
MsgBox "I have a resource file in me!"
End Function
'gbs_00330
'Date: 03-10-2012
http://www.garybeene.com/sw/gbsnippets.htm