GETRESOURCE                                                    Function

GETRESOURCE (Name[, [filename, register]])

Description

GetResource allows you to do a number of things to resources contained in your app. The resources must already exist in your app: they must first be added in the IDE as Resources of type 'File' in the Project Explorer of the IDE.

Use this function to:

- Read the contents of a resource into a string in your program.

- Copy the contents of a resource into a file.

- Register and unregister controls.

- Install an ActiveX control and register it.

Name is the name the resource was given in the IDE. It is required to read the contents of a resource or copy into a file.

Filename is the name of the file to copy to or the name of the file to register. If this parameter is not supplied, the content of the resource is returned as a string. If no pathname is supplied, the file is assumed to be in the same directory as your app. If the file already exists, it is not overwritten, and an error message is returned.

Register is True or False. If this parameter is supplied, Filename will be registered or unregistered, depending on whether this is true or false.

Example

'Extract a string resource

Data = GetResource("MyData")

 

'Create a data file with data from the resource

Data = GetResource("MyData", "MyData.txt")

 

'Create and register an ActiveX control

err = GetResource("Finance", "Finance.dll", True)

 

'Unregister an existing control

err = GetResource("", "Finance.dll", False)

Output

 

Related Items