C para Sr. Antonio

C para Sr. Antonio

Postby MGA » Tue Dec 15, 2009 1:18 pm

Sr. Antonio como declarar esta função em FIVEWIN:

short int (STDCALL *SWEDA_CapturarDispositivo) (short int Dispositivo, short int Opcoes, char *Arquivo, short int Extensao, long Timeout, TCallBackCD CallBack, void *Instancia);

tentei assim:

#include <hbapi.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <time.h>
#include <string.h>
#include "loadlib.h"

typedef int (*fSWEDA_CapturarDispositivo) (short int Dispositivo, short int Opcoes, char *Arquivo, short int Extensao, long Timeout, void *CallBack, void *Instancia);

static void *pLib = NULL;
static fSWEDA_CapturarDispositivo SWEDA_CapturarDispositivo = NULL;

/******************************************************************************/

HB_FUNC(INICIASWD)
{
char cErrMsg[1024] = {0};
// char cLibPrinc[] = "libswmfd.so.0";
char cLibPrinc[] = "libswmfd.so";
int iRet = FALSE;

if (pLib == NULL)
{
if ((pLib = LoadLib(cLibPrinc, TRUE, cErrMsg)) == NULL);
else if ((SWEDA_CapturarDispositivo = (fSWEDA_CapturarDispositivo) GetFunc(pLib, "SWEDA_CapturarDispositivo" , cLibPrinc, cErrMsg)) == NULL);
else iRet = TRUE;
}

if (!iRet)
{
hb_storc(cErrMsg, 1);
hb_retl(iRet);
}
else
{
hb_retl(iRet);
}
}

HB_FUNC(_SWEDATES)
{
short int a = hb_parni(1);
short int b = hb_parni(2);
char c[150] = {0} ;
short int d = hb_parnl(4);
long e = hb_parnl(5);
char f[150] = {0} ;
char g[150] = {0} ;

strcpy(c, hb_parc(3));
strcpy(f, hb_parc(6));
strcpy(g, hb_parc(7));

ErroFunc(SWEDA_CapturarDispositivo,"SWEDA_CapturarDispositivo");
hb_retni(SWEDA_CapturarDispositivo(a, b, c, d, e, f, g));
}

Chamo ela assim:

_SWEDATES(1,0,'',0,15000)

Mais o sistema encerra sem dar nenhuma mensagem de erro.
ubiratanmga@gmail.com

FWH24.04
BCC7.3
HARBOUR3.2
xMate
Pelles´C
TDolphin
MGA
 
Posts: 1254
Joined: Mon Feb 25, 2008 2:54 pm
Location: Brasil/PR/Maringá

Re: C para Sr. Antonio

Postby Antonio Linares » Tue Dec 15, 2009 2:08 pm

SGS,

These lines are wrongly declared:

char c[150] = {0} ;
char f[150] = {0} ;
char g[150] = {0} ;

Please change them this way:

char c[150];
char f[150];
char g[150];
regards, saludos

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

Re: C para Sr. Antonio

Postby MGA » Tue Dec 15, 2009 3:59 pm

Obrigado Sr. Antonio.
ubiratanmga@gmail.com

FWH24.04
BCC7.3
HARBOUR3.2
xMate
Pelles´C
TDolphin
MGA
 
Posts: 1254
Joined: Mon Feb 25, 2008 2:54 pm
Location: Brasil/PR/Maringá


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 112 guests