API RESOURCE LIB by Eberhard Funck and John Findlay

A GB32 Library - 'APIResourcesLib' for loading resources created with a Resource Editor such as Borland's Resource WorkShop.

GB32 functions undertaking API functions for loading resources from a resource file included in the main listing of a GB32 programme - The resource file must be loaded as *.res file in the GB32 source code and stored as a :File

Please Note: This library is for use with Version 2.1 of GB32.


FOR RESOURCES:

The resource index's are always a string.

If the first character of the string is a pound sign (#), the remaining characters represent a decimal number that specifies the integer identifier of the resource's name or type.

For example, the string #258 represents the integer ID 258. However the LoadStringResEx() function need an decimal number as index only!!!


FOR FILES:

GB32 functions undertaking API functions for loading various file formats. Bitmap, Icon and Cursor Created by John Findlay and Eberhard Funck, an English/German co-operation.

This Library is freeware.

Last revision June/2000 -- Converted to Library format Jan/2001

Eberhard Funck e-mail - funck@hildesheim.sgh-net.de

John Findlay e-mail - John.Findlay1@BTInternet.com


RESOURCE FUNCTIONS

CreateDialogRes() To create a modeless dialog box.

Function CreateDialogRes(hInst As Handle, FName As String, index As String, hwnd As Handle, lpProc As Long, lParam As Long) As Handle

 

DialogBoxRes() To create a modal dialog box.

Function DialogBoxRes(hInst As Handle, FName As String, index As String, hwnd As Handle, lpProc As Long, lParam As Long) As Bool

 

LoadBitmapRes() To load a bitmap from a res.

Function LoadBitmapRes(FName As String, index As String) As Handle

 

LoadMappedBitmapRes() To load bitmap from res and map colours.

Function LoadMappedBitmapRes(FName As String, index As String, ByRef cMap() As COLORMAP, numCols As Long) As Handle

 

LoadMenuRes() Load Menu from res.

Function LoadMenuRes(FName As String, index As String) As Handle

 

LoadStringRes() Load a string from res.

Function LoadStringRes(FName As String, index As Long, lpStrBuff As Long) As Long

 

LoadIconRes() Load an Icon from res.

Function LoadIconRes(FName As String, index As String) As Handle

 

LoadCursorRes() Load a Cursor form res.

Function LoadCursorRes(FName As String, index As String) As Handle

 

LoadAcceleratorsRes() Load keyboard accelerator from res.

Function LoadAcceleratorsRes(FName As String, index As String) As Handle

 

FindResourceRes() Finds a specified resource.

Function FindResourceRes(FName As String, index As String, ResType As Long) As Long

 

LoadResourceRes() Loads specified resourse.

Function LoadResourceRes(FName As String, hFindRes As Long) As Long

 

FreeResourceRes() Frees a specified resource.

Function FreeResourceRes(lpRes As Long) As Bool

 

SizeofResourceRes() Returns the size of a resource.

Function SizeOfResourceRes(lpRes As Long) As Long

 


FILE FUNCTIONS (from disk file or :File)

LoadBitmapFile() To Load a bitmap from a file

Function LoadBitmapFile(FName As String) As Handle

 

LoadBitmapMappedFile() Load bitmap from file and map colours

Function LoadMappedBitmapFile(FName As String, ByRef cMap() As COLORMAP, numCols As Long) As Handle

 

LoadIconFile() Load an Icon from file

Function LoadIconFile(FName As String) As Handle

 

LoadCusorFile() Load a Cursor from file

Function LoadCursorFile(FName As String) As Handle


MISC FUNCTIONS

DrawBitMap Draws a bitmap onto a DC

Function DrawBitMap(hBmp As Handle, hDc As Handle, x As Long, y As Long, dwRop As Long) As Int

 

nCmdShow Returns Window startup flag

Function nCmdShow() As Int


Use the Type COLORMAP which is exported from the library for converting colours of bitmaps when using LoadBitmapMappedFile() or LoadMappedBitmapRes().

Dimension an array of COLORMAP's when converting multiple colours.

Example when using LoadMappedBitmapFile():

Type COLORMAP

colFm As Long

colTo As Long

EndType

Local colmap(2) As COLORMAP

Fill in the array like so;

colmap(0).colFm = RGB(192, 192, 192)

colmap(0).colTo = GetSysColor(COLOR_3DFACE)

colmap(1).colFm = RGB(128, 128, 128)

colmap(1).colTo = GetSysColor(COLOR_3DSHADOW))

colmap(2).colFm = RGB(233, 233, 233)

colmap(2).colTo = GetSysColor(COLOR_3DLIGHT)

And send the var numCols as 3 in this case.

hBmp = LoadMappedBitmapFile(":Image", colmap(), 3)