Subject Howto pass an pointer to an array of structure objects
From Jannik Renseler
Date Wed, 01 Jul 2009 02:50:07 -0700
Newsgroups ot4xb.public
Attachment(s) Unnamed File 1

Hello,

thank you Pablo for these nice tools.  They are very helpful.

But I have a big problem accessing an dll function.
I have to pass an pointer to an array of structure objects to the function
and don't know how I can do that.

/* original strukturdefinition in c++
typedef struct __CMENTRYDATA {
  CMULONG mflCtrl;
  CMULONG mflDependency;
  CMULONG mulReserve;
  CMUINT mcbData;
  CMBYTE mabData[2 * CM_MAX_STRING_LEN];
} CMENTRYDATA;
*/

* my Xbasedefinition
BEGIN STRUCTURE _CMENTRYDATA
  MEMBER ULONG mflCtrl
  MEMBER ULONG mflDependency
  MEMBER ULONG mulReserve
  MEMBER U_INT32 mcbData
  MEMBER BINSTR mabData SIZE 512
END STRUCTURE


/* original function deklaration in C++
   int CMAPIENTRY CmGetInfo(HCMSysEntry hcmse, CMULONG flCtrl, void *pvDest
, CMUINT cbDest)
*/

* my Xbasedekleration
* CmGetInfo
DLL "WibuCm32.DLL" IMPORT CmGetInfo AS INT ;
                                    PARAM hcmse   AS POINTER32 , ;
                                    PARAM flCtrl  AS ULONG     , ;
                                    PARAM pvDest  AS POINTER32 , ;
                                    PARAM cbDest  AS UINT

*** example Call in C++  *****************************************
*** in pCmBoxEntry (third parameter) they pass an pointer to an array of the
structure
*** _CMENTRYDATA

        CMENTRYDATA *pCmBoxEntry;

        pCmBoxEntry = (CMENTRYDATA *)malloc(size);

        res = CmGetInfo(hcmEntry, CM_GEI_ENTRYDATA, pCmBoxEntry, size);
**********************************************************************

How can I do these in Xbase ?


*** my try in Xbase
***************************************************************

   * build Instance of structure
  scCMEntryData := _CMENTRYDATA():new()

  * getting Entrys (  hcmEntry is an handle that I requested further)
  nRes := CmGetInfo( hcmEntry, CM_GEI_ENTRYDATA, @scCMEntryData, nSize)

***************************************************************************************

Thank you for your help.

Best regards ,
Jannik Renseler



Hello,

thank you Pablo for these nice tools.  They are very helpful.

But I have a big problem accessing an dll function.
I have to pass an pointer to an array of structure objects to the function and don't know how I can do that.

/* original strukturdefinition in c++
typedef struct __CMENTRYDATA {
  CMULONG mflCtrl;
  CMULONG mflDependency;
  CMULONG mulReserve;
  CMUINT mcbData;
  CMBYTE mabData[2 * CM_MAX_STRING_LEN];
} CMENTRYDATA;
*/

* my Xbasedefinition
BEGIN STRUCTURE _CMENTRYDATA
  MEMBER ULONG mflCtrl
  MEMBER ULONG mflDependency
  MEMBER ULONG mulReserve
  MEMBER U_INT32 mcbData
  MEMBER BINSTR mabData SIZE 512
END STRUCTURE


/* original function deklaration in C++
   int CMAPIENTRY CmGetInfo(HCMSysEntry hcmse, CMULONG flCtrl, void *pvDest, CMUINT cbDest)
*/

* my Xbasedekleration
* CmGetInfo
DLL "WibuCm32.DLL" IMPORT CmGetInfo AS INT ;
                                    PARAM hcmse   AS POINTER32 , ;
                                    PARAM flCtrl  AS ULONG     , ;
                                    PARAM pvDest  AS POINTER32 , ;
                                    PARAM cbDest  AS UINT

*** example Call in C++  *****************************************
*** in pCmBoxEntry (third parameter) they pass an pointer to an array of the structure
*** _CMENTRYDATA

CMENTRYDATA *pCmBoxEntry;

pCmBoxEntry = (CMENTRYDATA *)malloc(size);

res = CmGetInfo(hcmEntry, CM_GEI_ENTRYDATA, pCmBoxEntry, size);

**********************************************************************

How can I do these in Xbase ?


*** my try in Xbase ***************************************************************

   * build Instance of structure
  scCMEntryData := _CMENTRYDATA():new()

  * getting Entrys (  hcmEntry is an handle that I requested further)
  nRes := CmGetInfo( hcmEntry, CM_GEI_ENTRYDATA, @scCMEntryData, nSize)
***************************************************************************************

Thank you for your help.

Best regards ,
Jannik Renseler


Recent messages in this thread
 
-# Howto pass an pointer to an array of structure objects (Current message) Jannik Renseler 01-Jul-2009 11:50 am
.-# Re: Howto pass an pointer to an array of structure objects Pablo Botella 04-Jul-2009 06:00 pm
..\# Re: Howto pass an pointer to an array of structure objects Jannik Renseler 06-Jul-2009 01:59 pm