Skip to content

IDEAS - Library future #1

@sancarn

Description

@sancarn

Saw this library on vbforums - great stuff and something I always wanted also. It may be worthwhile instead making these objects with predeclared IDs:

VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
END
Attribute VB_Name = "resIconHouse"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private pData(476) as Byte()
Private pInitialised as boolean

Attibute Data.VB_UserMemId = 0
Public Property Get Data() as Byte()
   if !pInitialised then Call init
   Data = pData
End Property

Public Property Get Name() as string
   Name = "IconHouse"
End Property 

Public Property Get AsFile() as string
  static sPath as string
  if sPath = "" then
    'if not save as temporary file if file doesn't already exist...
  end if
  AsFile = sPath
End Property

Public Property Get AsPicture() as IPictureDisp
  static pic as IPictureDisp: if pic is nothing then set pic = LoadPicture(AsFile) 'perhaps there is a better way
  set AsPicture = pic
End Property

Public Function CallFunction(ByVal sFuncName as string, aParamTypes as vbVarType(), aParamValues as vbVarType(), RetType as vbVarType) as variant
   'use DispCallFunc ...
End Function

Private sub init()
  pData(1) = ...
  pData(2) = ...
  '...
End Sub

or better still exporting specific functions directly, which calls CallFunction internally.

This would highly abstract usage of the binary:

set image1.Picture = resIconHouse.asPicture()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions