Click or drag to resize

ResourceFile Class

X#
Identify a file containing resource information.
Inheritance Hierarchy
Object
  VObject
    ResourceFile

Namespace:  VO
Assembly:  VOGUIClasses (in VOGUIClasses.dll) Version: 2.21
Syntax
 CLASS ResourceFile INHERIT VObject
Request Example View Source

The ResourceFile type exposes the following members.

Constructors
  NameDescription
Public methodResourceFile
Construct a resource file object.
Top
Methods
  NameDescription
Public methodDestroy
Provide a method to de-instantiate a ResourceFile object.
(Overrides Destroy.)
Top
Fields
  NameDescription
Public fieldoCargo
Cargo slot.
(Inherited from VObject.)
Top
Remarks
This class is used to create objects that can be used to identify resource entities.
Examples
The following example uses various methods of the ResourceFile, ResourceID, and the ResourceString classes to display resource strings embedded in an .EXE file:
X#
 1CLASS MyMenu INHERIT Menu
 2CLASS MyResFile INHERIT ResourceFile
 3CLASS MyTopAppWin INHERIT TopAppWindow
 4DEFINE IDM_MYMENU := "MyMenu"
 5DEFINE IDM_MYMENU_GETSTR1_ID := 1001
 6DEFINE IDM_MYMENU_GETSTR2_ID := 1002
 7DEFINE IDM_MYMENU_QUIT_ID := 1003
 8DEFINE IDT_STR1 := 2001
 9DEFINE IDT_STR2 := 2002
10RESOURCE IDM_MYMENU MENU
11BEGIN
12POPUP "&Menu1"
13BEGIN
14MENUITEM "Get String &1",     ;
15IDM_MYMENU_GETSTR1_ID
16MENUITEM "Get String &2", ;
17IDM_MYMENU_GETSTR2_ID
18MENUITEM SEPARATOR
19MENUITEM "&QUIT", IDM_MYMENU_QUIT_ID
20END
21END
22RESOURCE STRINGTABLE
23BEGIN
24IDT_STR1 "The 1st String"
25IDT_STR2 "The second string is 35 chars long."
26END
27METHOD Start() CLASS App
28LOCAL oWin AS Window
29oWin := MyTopAppWin{SELF}
30oWin:Show()
31SELF:Exec()
32METHOD Init(oOwnerApp) CLASS MyTopAppWin
33LOCAL lRetVal AS LONG
34SUPER:Init(oOwnerApp)
35SELF:Menu := MyMenu{SELF}
36SELF:Caption := "Resource File Demo Application"
37METHOD Init(oOwner) CLASS MyMenu
38SUPER:Init(ResourceID{IDM_MYMENU})
39SELF:RegisterItem(IDM_MYMENU_GETSTR1_ID,;
40HyperLabel{#GetStr1,,,})
41SELF:RegisterItem(IDM_MYMENU_GETSTR2_ID,;
42HyperLabel{#GetStr2,,,})
43SELF:RegisterItem(IDM_MYMENU_QUIT_ID,;
44HyperLabel{#GoQuit,,,})
45METHOD Init(fName) CLASS MyResFile
46IF fName == NIL
47SUPER:Init()
48ELSE
49SUPER:Init(fName)
50ENDIF
51METHOD GetStr1() CLASS MyTopAppWin
52SELF:GetStrX(IDT_STR1, 0)
53METHOD GetStr2() CLASS MyTopAppWin
54SELF:GetStrX(IDT_STR2, 100)
55METHOD GetStrX(nStrX,dy) CLASS MyTopAppWin
56LOCAL oResFile, oResID, oResString AS OBJECT
57oResFile := MyResFile{"c:\cavo\mytstprg.exe"}
58oResID := ResourceID{nStrX ,oResFile}
59oResString := ResourceString{oResID}
60SELF:TextPrint(AsString(nStrX),Point{10, 10+dy})
61SELF:TextPrint(AsString(oResString:Length),;
62Point{10, 30 + dy})
63SELF:TextPrint(AsString(oResString:Value),;
64Point{10, 50 + dy})
65SELF:TextPrint(AsString(oResString:AsString()),;
66Point{10, 70 + dy})
67METHOD GoQuit() CLASS MyTopAppWin
68SELF:Owner:Quit()
See Also

Reference