DVX_GUI/sdk/include/basic/resource.bas

50 lines
2.1 KiB
QBasic

' resource.bas -- DVX Resource File Library for DVX BASIC
'
' Provides access to DVX resource blocks appended to DXE3
' files (.app, .wgt, .lib). Resources are named data entries
' of type icon, text, or binary.
'
' Usage: Add this file to your project.
CONST RES_TYPE_ICON = 1
CONST RES_TYPE_TEXT = 2
CONST RES_TYPE_BINARY = 3
DECLARE LIBRARY "basrt"
' Open a resource file for reading. Returns a handle (> 0)
' or 0 on failure. Close with ResClose when done.
DECLARE FUNCTION ResOpen(BYVAL path AS STRING) AS LONG
' Close a resource handle.
DECLARE SUB ResClose(BYVAL handle AS LONG)
' Return the number of resources in an open handle.
DECLARE FUNCTION ResCount(BYVAL handle AS LONG) AS LONG
' Return the name of a resource by zero-based index.
DECLARE FUNCTION ResName$(BYVAL handle AS LONG, BYVAL idx AS LONG)
' Return the type of a resource by zero-based index.
' Returns RES_TYPE_ICON (1), RES_TYPE_TEXT (2), or RES_TYPE_BINARY (3).
DECLARE FUNCTION ResType(BYVAL handle AS LONG, BYVAL idx AS LONG) AS LONG
' Return the size in bytes of a resource by zero-based index.
DECLARE FUNCTION ResSize(BYVAL handle AS LONG, BYVAL idx AS LONG) AS LONG
' Read a text resource by name. Opens and closes the file
' internally. Returns "" if not found.
DECLARE FUNCTION ResGetText$(BYVAL path AS STRING, BYVAL resName AS STRING)
' Add or replace a text resource. Returns True on success.
DECLARE FUNCTION ResAddText(BYVAL path AS STRING, BYVAL resName AS STRING, BYVAL text AS STRING) AS LONG
' Add or replace a resource from a file. Type should be
' RES_TYPE_ICON or RES_TYPE_BINARY. Returns True on success.
DECLARE FUNCTION ResAddFile(BYVAL path AS STRING, BYVAL resName AS STRING, BYVAL resType AS LONG, BYVAL srcFile AS STRING) AS LONG
' Remove a resource by name. Returns True on success.
DECLARE FUNCTION ResRemove(BYVAL path AS STRING, BYVAL resName AS STRING) AS LONG
' Extract a resource to a file. Returns True on success.
DECLARE FUNCTION ResExtract(BYVAL path AS STRING, BYVAL resName AS STRING, BYVAL outFile AS STRING) AS LONG
END DECLARE