Olá,
Eu particularmente nao gosto de usar a calldll, tem algumas limitações, não me lembro quais, que me levaram a usar rotinas em C diretamente. Segue um exemplo do que eu tenho usado, vc verá que é bem simples:
Código: Selecionar todos
#if defined(_WIN32) || defined(WIN32) || defined(__MINGW32__)
#include "hbapi.h"
#include "windows.h"
typedef INT (WINAPI *_FASTREPORTDBF) ( HWND hwnd, LPSTR lpFileName, LPSTR lpReportName );
typedef INT (WINAPI *_FASTREPORTSQL) ( HWND hwnd, LPSTR lpQuery, LPSTR lpReportName, LPSTR lpHost, LPSTR lpDatabase, LPSTR lpUser, LPSTR lpPass, LPSTR lpProtocol );
typedef LPSTR (WINAPI *_FASTREPORTDESIGN)( HWND hwnd, LPSTR lpQuery, LPSTR lpReportName, LPSTR lpHost, LPSTR lpDatabase, LPSTR lpUser, LPSTR lpPass, LPSTR lpProtocol );
typedef INT (WINAPI *_SHOWPREVIEW) ( HWND hwnd, LPSTR lpText, INT bMatrix );
typedef LPSTR (WINAPI *_REPORTVERSION) ( void );
HB_FUNC( FASTREPORTDBF )
{
HINSTANCE handle = LoadLibrary("report.dll");
if (handle)
{
_FASTREPORTDBF pFunc;
pFunc = (_FASTREPORTDBF) GetProcAddress(handle, "FastReportDBF");
hb_retni(pFunc( ( HWND ) hb_parnl(1), ( LPSTR ) hb_parcx(2), ( LPSTR ) hb_parcx(3) ));
FreeLibrary( handle );
}
}
HB_FUNC( FASTREPORTSQL )
{
HINSTANCE handle = LoadLibrary("report.dll");
if (handle)
{
_FASTREPORTSQL pFunc;
pFunc = (_FASTREPORTSQL) GetProcAddress(handle, "FastReportSQL");
hb_retni(pFunc( ( HWND ) hb_parnl(1), ( LPSTR ) hb_parcx(2), ( LPSTR ) hb_parcx(3), ( LPSTR ) hb_parcx(4), ( LPSTR ) hb_parcx(5), ( LPSTR ) hb_parcx(6), ( LPSTR ) hb_parcx(7), ( LPSTR ) hb_parcx(8) ));
FreeLibrary( handle );
}
}
HB_FUNC( FASTREPORTDESIGN )
{
HINSTANCE handle = LoadLibrary("report.dll");
if (handle)
{
_FASTREPORTDESIGN pFunc;
pFunc = (_FASTREPORTDESIGN) GetProcAddress(handle, "FastReportDesign");
hb_retc( ( LPSTR ) pFunc( ( HWND ) hb_parnl(1), ( LPSTR ) hb_parcx(2), ( LPSTR ) hb_parcx(3), ( LPSTR ) hb_parcx(4), ( LPSTR ) hb_parcx(5), ( LPSTR ) hb_parcx(6), ( LPSTR ) hb_parcx(7), ( LPSTR ) hb_parcx(8) ));
FreeLibrary( handle );
}
}
HB_FUNC( SHOWPREVIEW )
{
HINSTANCE handle = LoadLibrary("report.dll");
if (handle)
{
_SHOWPREVIEW pFunc;
pFunc = (_SHOWPREVIEW) GetProcAddress(handle, "ShowPreview");
hb_retni(pFunc( ( HWND ) hb_parnl(1), ( LPSTR ) hb_parcx(2), hb_parni(3) ));
FreeLibrary( handle );
}
}
HB_FUNC( REPORTVERSION )
{
HINSTANCE handle = LoadLibrary("report.dll");
if (handle)
{
_REPORTVERSION pFunc;
pFunc = (_REPORTVERSION) GetProcAddress(handle, "ReportVersion");
hb_retc( ( LPSTR ) pFunc() );
FreeLibrary( handle );
}
}
#endif
[]'s
Rodrigo