FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Pocket PC Harbour C-Wrapper Help
Posts: 42
Joined: Wed Oct 26, 2005 01:20 PM
Harbour C-Wrapper Help
Posted: Fri Jan 05, 2007 05:40 PM
Might someone help me with the C-wrapper syntax? I have looked at the Harbour website for documentation, but could find none on the c-wrappers.

I have the following code so far. I need to return the second element of the structure "ScanFindInfo". The second element is a string.

#pragma BEGINDUMP

#include <hbapi.h>
#include <windows.h>
#include <scancapi.h>

HB_FUNC( FindScanner )
{
   SCAN_FINDINFO ScanFindInfo;
   HANDLE hFindHandle;
   DWORD dwResult;

   SI_INIT( &ScanFindInfo );
   dwResult = SCAN_FindFirst( &ScanFindInfo, &hFindHandle );
}

#pragma ENDDUMP


Thanks in advance!
Bill Simmeth

Merchant Software Corp

Marshall, Virginia USA
Posts: 126
Joined: Thu Oct 06, 2005 10:18 PM
Harbour C-Wrapper Help
Posted: Fri Jan 05, 2007 06:34 PM
Bill,

try this:

dwResult = SCAN_FindFirst (&ScanFindInfo, &hFindHandle);
hb_retc (WideToAnsi (ScanFindInfo.szPortName)); // conversion for Unicode format



Pawel
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Harbour C-Wrapper Help
Posted: Sat Jan 06, 2007 08:12 AM
Pawel,

Your code will produce memory leak. This is needed:
char * p;

dwResult = SCAN_FindFirst (&ScanFindInfo, &hFindHandle); 
p = WideToAnsi (ScanFindInfo.szPortName);
hb_retc( p );
hb_xfree( p );
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 42
Joined: Wed Oct 26, 2005 01:20 PM
Harbour C-Wrapper Help
Posted: Mon Jan 08, 2007 04:58 PM

Pawel and Antonio thank you for the hints.

Antonio, is there a reference on the wrappers, for help on things like hb_parn--() ?

Bill Simmeth

Merchant Software Corp

Marshall, Virginia USA
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Harbour C-Wrapper Help
Posted: Mon Jan 08, 2007 05:37 PM

Bill,

Harbour "extend system" is fully compatible with Clipper, so you can check a Clipper manual like this one:

http://www.ousob.com/ng/cltech/ng242.php

regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion