Interface Generator - How to use?!

Just starting out? Need help? Post your questions and find answers here.
kawawong
New User
New User
Posts: 3
Joined: Tue Apr 26, 2005 8:38 am

Interface Generator - How to use?!

Post by kawawong »

Hi,

I have used Interface Generator to generate the interface from a dll as follows.

Code: Select all

; Interface generated by Interface Generator 1.0, Date 08/02/2005 

; HbDAO, HB++ Data Access Objects

; Enumerations

Enumeration ; HB_DeleteMode
  #hbRecordDelete = 0
  #hbRecordArchive = 1
  #hbRecordRemove = 2
EndEnumeration

; DispInterfaces

Interface IHB_Recordset Extends IDispatch
  OpenTable(a,b)
  Close()
  AddNew()
  CancelUpdate()
  Delete(a)
  Edit()
  LookupUniqueID(a)
  MoveFirst()
  MoveLast()
  MoveNext()
  MovePrevious()
  Update()
  Blank()
  CreateTable(a,b,c,d,e)
  get_CreateOlePicture(a,b,c,d,e)
  get_CreateHBBitmap(a,b,c,d,e)
  get_AbsolutePosition(a)
  put_AbsolutePosition(a)
  get_BOF(a)
  get_EOF(a)
  get_RecordCount(a)
  get_AppInfoBlock(a)
  put_AppInfoBlock(a,b,c,d)
  get_SortInfoBlock(a)
  put_SortInfoBlock(a,b,c,d)
  get_FieldByIndex(a,b)
  put_FieldByIndex(a,b,c,d,e)
  get_FieldCount(a)
  get_FieldName(a,b)
  get_Field(a,b)
  put_Field(a,b,c,d,e)
EndInterface

Interface IHB_RawDB Extends IDispatch
  OpenTable(a)
  Close()
  AddNew()
  CancelUpdate()
  Delete(a)
  Edit()
  LookupUniqueID(a)
  MoveFirst()
  MoveLast()
  MoveNext()
  MovePrevious()
  Update()
  Blank()
  CreateTable(a,b,c,d)
  Truncate(a)
  get_AbsolutePosition(a)
  put_AbsolutePosition(a)
  get_BOF(a)
  get_EOF(a)
  get_RecordCount(a)
  get_AppInfoBlock(a)
  put_AppInfoBlock(a,b,c,d)
  get_SortInfoBlock(a)
  put_SortInfoBlock(a,b,c,d)
  get_RecordData(a)
  put_RecordData(a,b,c,d)
  get_Int8At(a,b)
  put_Int8At(a,b)
  get_UInt8At(a,b)
  put_UInt8At(a,b)
  get_Int16At(a,b)
  put_Int16At(a,b)
  get_UInt16At(a,b)
  put_UInt16At(a,b)
  get_Int32At(a,b)
  put_Int32At(a,b)
  get_UInt32At(a,b)
  put_UInt32At(a,b)
  get_DoubleAt(a,b)
  put_DoubleAt(a,b)
  get_SingleAt(a,b)
  put_SingleAt(a,b)
  get_DateAt(a,b)
  put_DateAt(a,b,c,d,e)
  get_BooleanAt(a,b)
  put_BooleanAt(a,b)
  get_StringAt(a,b)
  put_StringAt(a,b)
  get_FixedLengthStringAt(a,b,c)
  put_FixedLengthStringAt(a,b,c)
  get_UniqueID(a)
  put_UniqueID(a)
  get_Category(a)
  put_Category(a)
  get_Dirty(a)
  get_Secret(a)
  put_Secret(a)
EndInterface
Now, I want to use IHB_Recordset\OpenTable(a,b) , i.e.

Code: Select all

[VOffset($1C)] HRESULT OpenTable([in] BSTR PdbFile,
     [in] BSTR HbxFile)
and I try

Code: Select all

Global HbDao.IHB_Recordset
result.l = HbDao\OpenTable(PdbFile.s,HbxFile.s)
(PdbFile.s and HbxFile.s are the path and filename I want to pass into it)

and it generates error:

Code: Select all

Bad parameter type, number expected instead of string
Any idea?! :? Thanks a lot.
DarkDragon
Addict
Addict
Posts: 2347
Joined: Mon Jun 02, 2003 9:16 am
Location: Germany
Contact:

Post by DarkDragon »

Code: Select all

result.l = HbDao\OpenTable(@PdbFile.s,@HbxFile.s)
bye,
Daniel
traumatic
PureBasic Expert
PureBasic Expert
Posts: 1661
Joined: Sun Apr 27, 2003 4:41 pm
Location: Germany
Contact:

Post by traumatic »

DarkDragon wrote:

Code: Select all

result.l = HbDao\OpenTable(@PdbFile.s,@HbxFile.s)
Guess that won't work, BSTR is widechar so you'll need to convert
the string using MultiByteToWideChar() beforehand.
Good programmers don't comment their code. It was hard to write, should be hard to read.
DarkDragon
Addict
Addict
Posts: 2347
Joined: Mon Jun 02, 2003 9:16 am
Location: Germany
Contact:

Post by DarkDragon »

traumatic wrote:
DarkDragon wrote:

Code: Select all

result.l = HbDao\OpenTable(@PdbFile.s,@HbxFile.s)
Guess that won't work, BSTR is widechar so you'll need to convert
the string using MultiByteToWideChar() beforehand.
Well, I just combined what's aviable for me:
Bad parameter type, number expected instead of string
And he wants to send a string to the function, so I've choosen that method.
bye,
Daniel
traumatic
PureBasic Expert
PureBasic Expert
Posts: 1661
Joined: Sun Apr 27, 2003 4:41 pm
Location: Germany
Contact:

Post by traumatic »

Yes but he wrote:

Code: Select all

[VOffset($1C)] HRESULT OpenTable([in] BSTR PdbFile,
     [in] BSTR HbxFile) 
;)
Good programmers don't comment their code. It was hard to write, should be hard to read.
kawawong
New User
New User
Posts: 3
Joined: Tue Apr 26, 2005 8:38 am

Post by kawawong »

Hi, thanks all.

I use the following function and there is no error now.

Code: Select all

Procedure BSTR(st$) 
   wst = WCHAR(st$) 
   bstr = SysAllocString_(wst) 
   FreeMemory(wst) 
   ProcedureReturn  bstr    
EndProcedure 
Still some problem, but your help is much useful to me. Thanks in advance.

:D
Post Reply