Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IDEAS - Library future #1

Open
sancarn opened this issue Mar 25, 2022 · 2 comments
Open

IDEAS - Library future #1

sancarn opened this issue Mar 25, 2022 · 2 comments

Comments

@sancarn
Copy link

sancarn commented Mar 25, 2022

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()
@Gagniuc
Copy link
Owner

Gagniuc commented Mar 25, 2022 via email

@Gagniuc
Copy link
Owner

Gagniuc commented Mar 25, 2022

The line:

set image1.Picture = resIconHouse.asPicture()

is an interesting approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants