Harbour C-Wrapper Help

Harbour C-Wrapper Help

Postby Bill Simmeth » Fri Jan 05, 2007 5: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.

Code: Select all  Expand view
#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
Bill Simmeth
 
Posts: 42
Joined: Wed Oct 26, 2005 1:20 pm
Location: Marshall, Virginia, USA

Postby pawelu » Fri Jan 05, 2007 6:34 pm

Bill,

try this:

Code: Select all  Expand view
dwResult = SCAN_FindFirst (&ScanFindInfo, &hFindHandle);
hb_retc (WideToAnsi (ScanFindInfo.szPortName)); // conversion for Unicode format



Pawel
pawelu
 
Posts: 126
Joined: Thu Oct 06, 2005 10:18 pm
Location: Poland

Postby Antonio Linares » Sat Jan 06, 2007 8:12 am

Pawel,

Your code will produce memory leak. This is needed:
Code: Select all  Expand view
char * p;

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

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41872
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Bill Simmeth » Mon Jan 08, 2007 4: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
Bill Simmeth
 
Posts: 42
Joined: Wed Oct 26, 2005 1:20 pm
Location: Marshall, Virginia, USA

Postby Antonio Linares » Mon Jan 08, 2007 5: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
User avatar
Antonio Linares
Site Admin
 
Posts: 41872
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Pocket PC

Who is online

Users browsing this forum: No registered users and 13 guests