AntoninoP wrote:Anyway I mus say that do hb_retptr and hb_retni/hb_retnl/hb_retnll is not the same
.............
so we can not substute hb_parn*/hb_retn* with hb_parptr/hb_retptr because they are 2 different things
Antonio Linares wrote:Kim,
Please email me (or post here) KTOpenAPI.h
thanks
kim yong woo wrote:Borland C++ 5.82 for Win32 Copyright (c) 1993, 2005 Borland
#include <ole2.h>
Antonio Linares wrote:Kim,
Could you please add #include <ole2.h> under #include "rpcndr.h" in KTOpenAPI.h ?
#include <fiveWin.ch>
proc main()
LOCAL IKTPCBizX
CoInitialize(0)
IKTPCBizX := IKTPCBizX_New()
IKTPCBizX
if( IKTPCBizX<>0 )
IKTPCBizX_LogIn(IKTPCBizX, ;
/*nServer*/666, ;
/*sAuthKey*/"Example", ;
/*sLoginID*/"Antonino", ;
/*sLoginPwd*/"FiveWinForum")
IKTPCBizX_Release(IKTPCBizX)
endif
return
#pragma BEGINDUMP
#define CINTERFACE
#define COBJMACROS
#define _COM_Outptr_
#define _Out_opt_
#define _In_
#include "windows.h"
#include "hbapi.h"
#include "KTOpenAPI.h"
#include "KTOpenAPI_i.c"
HRESULT __stdcall MyCoCreateInstance(
LPCTSTR szDllName,
IN REFCLSID rclsid,
IUnknown* pUnkOuter,
IN REFIID riid,
OUT LPVOID FAR* ppv)
{
HRESULT hr = REGDB_E_KEYMISSING;
typedef HRESULT (__stdcall *pDllGetClassObject)(IN REFCLSID rclsid,
IN REFIID riid, OUT LPVOID FAR* ppv);
pDllGetClassObject GetClassObject;
IClassFactory *pIFactory;
HMODULE hDll = LoadLibrary(szDllName);
if (hDll == 0)
return hr;
GetClassObject = (pDllGetClassObject)GetProcAddress(hDll, "DllGetClassObject");
if (GetClassObject == 0)
{
FreeLibrary(hDll);
return hr;
}
hr = GetClassObject(rclsid, &IID_IClassFactory, (LPVOID *)&pIFactory);
if (!SUCCEEDED(hr))
return hr;
hr = IClassFactory_CreateInstance(pIFactory, pUnkOuter, riid, ppv);
IClassFactory_Release(pIFactory);
return hr;
}
HB_FUNC( IKTPCBIZX_NEW )
{
IKTPCBizX* pKTPCBiz;
//HRESULT hr;
MyCoCreateInstance("KTOpenAPI.dll", &CLSID_KTPCBizX, 0, &IID_IKTPCBizX, (void**)&pKTPCBiz);
#ifndef _WIN64
hb_retnl( (long)pKTPCBiz );
#else
hb_retnll( (long long)pKTPCBiz );
#endif
}
LPWSTR UTF8toUTF16( LPCSTR utf8 );
/*
LPWSTR UTF8toUTF16( LPCSTR utf8 )
{
int wLen = MultiByteToWideChar( CP_UTF8, 0, utf8, -1, 0, 0 );
LPWSTR pString = ( LPWSTR ) hb_xgrab( wLen * 2 );
MultiByteToWideChar( CP_UTF8, 0, utf8, -1, pString, wLen );
return pString;
}
*/
HB_FUNC( IKTPCBIZX_LOGIN )
{
#ifndef _WIN64
IKTPCBizX *pKTPCBiz = ( IKTPCBizX* ) hb_parnl( 1 );
#else
IKTPCBizX *pKTPCBiz = ( IKTPCBizX* ) hb_parnll( 1 );
#endif
BSTR sAuthKey = SysAllocString(UTF8toUTF16(hb_parc(3)));
BSTR sLoginID = SysAllocString(UTF8toUTF16(hb_parc(4)));
BSTR sLoginPwd = SysAllocString(UTF8toUTF16(hb_parc(5)));
long nResult = 0;
if( pKTPCBiz )
{
//IKTPCBizX_Login(pKTPCBiz, hb_parnl(2), sAuthKey, sLoginID, sLoginPwd, &nResult );
pKTPCBiz->lpVtbl -> Login(pKTPCBiz,hb_parnl(2), sAuthKey, sLoginID, sLoginPwd, &nResult );
}
SysFreeString(sAuthKey);
SysFreeString(sLoginID);
SysFreeString(sLoginPwd);
hb_retnl(nResult);
}
HB_FUNC( IKTPCBIZX_RELEASE )
{
#ifndef _WIN64
IKTPCBizX *pKTPCBiz = ( IKTPCBizX* ) hb_parnl( 1 );
#else
IKTPCBizX *pKTPCBiz = ( IKTPCBizX* ) hb_parnll( 1 );
#endif
if( pKTPCBiz )
{
IKTPCBizX_Release(pKTPCBiz);
}
hb_ret();
}
#pragma ENDDUMP
#Borland make sample, (c) FiveTech Software 2005-2009
HBDIR=c:\harbour
BCDIR=c:\bcc582
FWDIR=y:\git\fwh
#change these paths as needed
.path.OBJ = .\obj
.path.PRG = .\
.path.CH = $(FWDIR)\include;$(HBDIR)\include
.path.C = .\
.path.rc = .\
#important: Use Uppercase for filenames extensions, in the next two rules!
PRG = \
opensdk.PRG
PROJECT : OpenSDK.exe
OpenSDK.exe : $(PRG:.PRG=.OBJ) $(C:.C=.OBJ) #OpenSDK.res
echo off
echo $(BCDIR)\lib\c0w32.obj + > b32.bc
echo obj\opensdk.obj, + >> b32.bc
echo opensdk.exe, + >> b32.bc
echo opensdk.map, + >> b32.bc
echo $(FWDIR)\lib\FiveH.lib $(FWDIR)\lib\FiveHC.lib + >> b32.bc
echo $(HBDIR)\lib\win\bcc\hbrtl.lib + >> b32.bc
echo $(HBDIR)\lib\win\bcc\hbvm.lib + >> b32.bc
echo $(HBDIR)\lib\win\bcc\gtgui.lib + >> b32.bc
echo $(HBDIR)\lib\win\bcc\hblang.lib + >> b32.bc
echo $(HBDIR)\lib\win\bcc\hbmacro.lib + >> b32.bc
echo $(HBDIR)\lib\win\bcc\hbrdd.lib + >> b32.bc
echo $(HBDIR)\lib\win\bcc\rddntx.lib + >> b32.bc
echo $(HBDIR)\lib\win\bcc\rddcdx.lib + >> b32.bc
echo $(HBDIR)\lib\win\bcc\rddfpt.lib + >> b32.bc
echo $(HBDIR)\lib\win\bcc\hbsix.lib + >> b32.bc
echo $(HBDIR)\lib\win\bcc\hbdebug.lib + >> b32.bc
echo $(HBDIR)\lib\win\bcc\hbcommon.lib + >> b32.bc
echo $(HBDIR)\lib\win\bcc\hbpp.lib + >> b32.bc
echo $(HBDIR)\lib\win\bcc\hbwin.lib + >> b32.bc
echo $(HBDIR)\lib\win\bcc\hbcpage.lib + >> b32.bc
echo $(HBDIR)\lib\win\bcc\hbct.lib + >> b32.bc
rem by advice
echo $(HBDIR)\lib\win\bcc\hbwin.lib + >> b32.bc
echo $(HBDIR)\lib\win\bcc\gtgui.lib + >> b32.bc
echo $(HBDIR)\lib\win\bcc\hbrtl.lib + >> b32.bc
echo $(HBDIR)\lib\win\bcc\hbvm.lib + >> b32.bc
echo $(HBDIR)\lib\win\bcc\hblang.lib + >> b32.bc
echo $(HBDIR)\lib\win\bcc\hbmacro.lib + >> b32.bc
echo $(HBDIR)\lib\win\bcc\hbrdd.lib + >> b32.bc
echo $(HBDIR)\lib\win\bcc\rddntx.lib + >> b32.bc
echo $(HBDIR)\lib\win\bcc\rddcdx.lib + >> b32.bc
echo $(HBDIR)\lib\win\bcc\rddfpt.lib + >> b32.bc
echo $(HBDIR)\lib\win\bcc\hbsix.lib + >> b32.bc
echo $(HBDIR)\lib\win\bcc\hbdebug.lib + >> b32.bc
echo $(HBDIR)\lib\win\bcc\hbcommon.lib + >> b32.bc
echo $(HBDIR)\lib\win\bcc\hbpp.lib + >> b32.bc
echo $(HBDIR)\lib\win\bcc\hbcpage.lib + >> b32.bc
echo $(HBDIR)\lib\win\bcc\hbcplr.lib + >> b32.bc
echo $(HBDIR)\lib\win\bcc\hbct.lib + >> b32.bc
echo $(HBDIR)\lib\win\bcc\hbpcre.lib + >> b32.bc
echo $(HBDIR)\lib\win\bcc\xhb.lib + >> b32.bc
echo $(HBDIR)\lib\win\bcc\hbziparc.lib + >> b32.bc
echo $(HBDIR)\lib\win\bcc\hbmzip.lib + >> b32.bc
echo $(HBDIR)\lib\win\bcc\hbzlib.lib + >> b32.bc
echo $(HBDIR)\lib\win\bcc\minizip.lib + >> b32.bc
echo $(HBDIR)\lib\win\bcc\png.lib + >> b32.bc
echo $(HBDIR)\lib\win\bcc\hbusrrdd.lib + >> b32.bc
rem Uncomment these two lines to use Advantage RDD
rem echo $(HBDIR)\lib\win\bcc\rddads.lib + >> b32.bc
rem echo $(HBDIR)\lib\win\bcc\Ace32.lib + >> b32.bc
echo $(BCDIR)\lib\cw32.lib + >> b32.bc
echo $(BCDIR)\lib\import32.lib + >> b32.bc
rem add by advice
echo $(BCDIR)\lib\cw32.lib + >> b32.bc
echo $(BCDIR)\lib\uuid.lib + >> b32.bc
echo $(BCDIR)\lib\import32.lib + >> b32.bc
echo $(BCDIR)\lib\ws2_32.lib + >> b32.bc
echo $(BCDIR)\lib\psdk\odbc32.lib + >> b32.bc
echo $(BCDIR)\lib\psdk\nddeapi.lib + >> b32.bc
echo $(BCDIR)\lib\psdk\iphlpapi.lib + >> b32.bc
echo $(BCDIR)\lib\psdk\msimg32.lib + >> b32.bc
echo $(BCDIR)\lib\psdk\psapi.lib + >> b32.bc
echo $(BCDIR)\lib\psdk\rasapi32.lib + >> b32.bc
echo $(BCDIR)\lib\psdk\gdiplus.lib + >> b32.bc
echo $(BCDIR)\lib\psdk\shell32.lib, >> b32.bc
IF EXIST Alert.res echo Alert.res >> b32.bc
$(BCDIR)\bin\ilink32 -Gn -aa -Tpe -s @b32.bc
del b32.bc
.PRG.OBJ:
$(HBDIR)\bin\harbour $< /L /N /W /Oobj\ /I$(FWDIR)\include;$(HBDIR)\include
$(BCDIR)\bin\bcc32 -c -tWM -I$(HBDIR)\include -oobj\$& obj\$&.c
.C.OBJ:
echo -c -tWM -D__HARBOUR__ -DHB_API_MACROS > tmp
echo -I$(HBDIR)\include;$(FWDIR)\include >> tmp
$(BCDIR)\bin\bcc32 -oobj\$& @tmp $&.c
del tmp
#OpenSDK.res : OpenSDK.rc
# $(BCDIR)\bin\brc32.exe -r OpenSDK.rc
Procedure main()
LOCAL IKTPCBizX
Local nTest
CoInitialize(0)
IKTPCBizX := IKTPCBizX_New()
? 1
if( IKTPCBizX<>0 )
? 2
nTest:=IKTPCBizX_LogIn(IKTPCBizX, 0, "Example", "Antonino", "FiveWinForum")
? 3
? 111, nTest
IKTPCBizX_Release(IKTPCBizX)
endif
return
declaration
int Login( int nServer, string sAuthKey, string sLoginID, string sLoginPwd)
parameters
nServer :
0 : test status
sAuthKey : Authentification key, less than 40 bytes
sLoginID : ID in email format pharmabase@natel.com
sLoginPwd : password
return value
success
200
error
301 : site error
401~408 : error situation 1~8
500 : error type c
1000, 1001,
1502~1507
1700, 1701
#include <fiveWin.ch>
Procedure main()
LOCAL IKTPCBizX
Local cTest
CoInitialize(0)
IKTPCBizX := IKTPCBizX_New()
? 1, IKTPCBizX
if( IKTPCBizX<>0 )
? 2
cTest:=IKTPCBizX_LogIn(IKTPCBizX, 0, "Example", "Antonino", "FiveWinForum")
? 3
? 111, cTest
IKTPCBizX_Release(IKTPCBizX)
endif
return
#pragma BEGINDUMP
#define CINTERFACE
#define COBJMACROS
#define _COM_Outptr_
#define _Out_opt_
#define _In_
#include "windows.h"
#include "hbapi.h"
#include "KTOpenAPI.h"
#include "KTOpenAPI_i.c"
HRESULT __stdcall MyCoCreateInstance(
LPCTSTR szDllName,
IN REFCLSID rclsid,
IUnknown* pUnkOuter,
IN REFIID riid,
OUT LPVOID FAR* ppv)
{
HRESULT hr = REGDB_E_KEYMISSING;
typedef HRESULT (__stdcall *pDllGetClassObject)(IN REFCLSID rclsid,
IN REFIID riid, OUT LPVOID FAR* ppv);
pDllGetClassObject GetClassObject;
IClassFactory *pIFactory;
HMODULE hDll = LoadLibrary(szDllName);
if (hDll == 0)
return hr;
GetClassObject = (pDllGetClassObject)GetProcAddress(hDll, "DllGetClassObject");
if (GetClassObject == 0)
{
FreeLibrary(hDll);
return hr;
}
hr = GetClassObject(rclsid, &IID_IClassFactory, (LPVOID *)&pIFactory);
if (!SUCCEEDED(hr))
return hr;
hr = IClassFactory_CreateInstance(pIFactory, pUnkOuter, riid, ppv);
IClassFactory_Release(pIFactory);
return hr;
}
HB_FUNC( IKTPCBIZX_NEW )
{
IKTPCBizX* pKTPCBiz;
//HRESULT hr;
MyCoCreateInstance("KTOpenAPI.dll", &CLSID_KTPCBizX, 0, &IID_IKTPCBizX, (void**)&pKTPCBiz);
#ifndef _WIN64
hb_retnl( (long)pKTPCBiz );
#else
hb_retnll( (long long)pKTPCBiz );
#endif
}
LPWSTR UTF8toUTF16( LPCSTR utf8 );
/*
LPWSTR UTF8toUTF16( LPCSTR utf8 )
{
int wLen = MultiByteToWideChar( CP_UTF8, 0, utf8, -1, 0, 0 );
LPWSTR pString = ( LPWSTR ) hb_xgrab( wLen * 2 );
MultiByteToWideChar( CP_UTF8, 0, utf8, -1, pString, wLen );
return pString;
}
*/
HB_FUNC( IKTPCBIZX_LOGIN )
{
#ifndef _WIN64
IKTPCBizX *pKTPCBiz = ( IKTPCBizX* ) hb_parnl( 1 );
#else
IKTPCBizX *pKTPCBiz = ( IKTPCBizX* ) hb_parnll( 1 );
#endif
BSTR sAuthKey = SysAllocString(UTF8toUTF16(hb_parc(3)));
BSTR sLoginID = SysAllocString(UTF8toUTF16(hb_parc(4)));
BSTR sLoginPwd = SysAllocString(UTF8toUTF16(hb_parc(5)));
long nResult = 0;
if( pKTPCBiz )
{
//IKTPCBizX_Login(pKTPCBiz, hb_parnl(2), sAuthKey, sLoginID, sLoginPwd, &nResult );
pKTPCBiz->lpVtbl -> Login(pKTPCBiz,hb_parnl(2), sAuthKey, sLoginID, sLoginPwd, &nResult );
}
SysFreeString(sAuthKey);
SysFreeString(sLoginID);
SysFreeString(sLoginPwd);
hb_retnl(nResult);
}
HB_FUNC( IKTPCBIZX_RELEASE )
{
#ifndef _WIN64
IKTPCBizX *pKTPCBiz = ( IKTPCBizX* ) hb_parnl( 1 );
#else
IKTPCBizX *pKTPCBiz = ( IKTPCBizX* ) hb_parnll( 1 );
#endif
if( pKTPCBiz )
{
IKTPCBizX_Release(pKTPCBiz);
}
hb_ret();
}
#pragma ENDDUMP
#Borland make sample, (c) FiveTech Software 2005-2009
HBDIR=d:\harbour
BCDIR=d:\bc5
FWDIR=d:\fwh
#change these paths as needed
.path.OBJ = .\obj
.path.PRG = .\
.path.CH = $(FWDIR)\include;$(HBDIR)\include
.path.C = .\
.path.rc = .\
#important: Use Uppercase for filenames extensions, in the next two rules!
PRG = \
open1.PRG
PROJECT : Open1.exe
Open1.exe : $(PRG:.PRG=.OBJ) $(C:.C=.OBJ) #Open1.res
echo off
echo $(BCDIR)\lib\c0w32.obj + > b32.bc
echo obj\open1.obj, + >> b32.bc
echo open1.exe, + >> b32.bc
echo open1.map, + >> b32.bc
echo $(FWDIR)\lib\FiveH.lib $(FWDIR)\lib\FiveHC.lib + >> b32.bc
echo $(HBDIR)\lib\hbrtl.lib + >> b32.bc
echo $(HBDIR)\lib\hbvm.lib + >> b32.bc
echo $(HBDIR)\lib\gtgui.lib + >> b32.bc
echo $(HBDIR)\lib\hblang.lib + >> b32.bc
echo $(HBDIR)\lib\hbmacro.lib + >> b32.bc
echo $(HBDIR)\lib\hbrdd.lib + >> b32.bc
echo $(HBDIR)\lib\rddntx.lib + >> b32.bc
echo $(HBDIR)\lib\rddcdx.lib + >> b32.bc
echo $(HBDIR)\lib\rddfpt.lib + >> b32.bc
echo $(HBDIR)\lib\hbsix.lib + >> b32.bc
echo $(HBDIR)\lib\hbdebug.lib + >> b32.bc
echo $(HBDIR)\lib\hbcommon.lib + >> b32.bc
echo $(HBDIR)\lib\hbpp.lib + >> b32.bc
echo $(HBDIR)\lib\hbwin.lib + >> b32.bc
echo $(HBDIR)\lib\hbcpage.lib + >> b32.bc
echo $(HBDIR)\lib\hbct.lib + >> b32.bc
rem by advice
echo $(HBDIR)\lib\hbwin.lib + >> b32.bc
echo $(HBDIR)\lib\gtgui.lib + >> b32.bc
echo $(HBDIR)\lib\hbrtl.lib + >> b32.bc
echo $(HBDIR)\lib\hbvm.lib + >> b32.bc
echo $(HBDIR)\lib\hblang.lib + >> b32.bc
echo $(HBDIR)\lib\hbmacro.lib + >> b32.bc
echo $(HBDIR)\lib\hbrdd.lib + >> b32.bc
echo $(HBDIR)\lib\rddntx.lib + >> b32.bc
echo $(HBDIR)\lib\rddcdx.lib + >> b32.bc
echo $(HBDIR)\lib\rddfpt.lib + >> b32.bc
echo $(HBDIR)\lib\hbsix.lib + >> b32.bc
echo $(HBDIR)\lib\hbdebug.lib + >> b32.bc
echo $(HBDIR)\lib\hbcommon.lib + >> b32.bc
echo $(HBDIR)\lib\hbpp.lib + >> b32.bc
echo $(HBDIR)\lib\hbcpage.lib + >> b32.bc
echo $(HBDIR)\lib\hbcplr.lib + >> b32.bc
echo $(HBDIR)\lib\hbct.lib + >> b32.bc
echo $(HBDIR)\lib\hbpcre.lib + >> b32.bc
echo $(HBDIR)\lib\xhb.lib + >> b32.bc
echo $(HBDIR)\lib\hbziparc.lib + >> b32.bc
echo $(HBDIR)\lib\hbmzip.lib + >> b32.bc
echo $(HBDIR)\lib\hbzlib.lib + >> b32.bc
echo $(HBDIR)\lib\minizip.lib + >> b32.bc
echo $(HBDIR)\lib\png.lib + >> b32.bc
echo $(HBDIR)\lib\hbusrrdd.lib + >> b32.bc
rem Uncomment these two lines to use Advantage RDD
rem echo $(HBDIR)\lib\win\bcc\rddads.lib + >> b32.bc
rem echo $(HBDIR)\lib\win\bcc\Ace32.lib + >> b32.bc
echo $(BCDIR)\lib\cw32.lib + >> b32.bc
echo $(BCDIR)\lib\import32.lib + >> b32.bc
rem add by advice
echo $(BCDIR)\lib\cw32.lib + >> b32.bc
echo $(BCDIR)\lib\uuid.lib + >> b32.bc
echo $(BCDIR)\lib\import32.lib + >> b32.bc
echo $(BCDIR)\lib\ws2_32.lib + >> b32.bc
echo $(BCDIR)\lib\psdk\odbc32.lib + >> b32.bc
echo $(BCDIR)\lib\psdk\nddeapi.lib + >> b32.bc
echo $(BCDIR)\lib\psdk\iphlpapi.lib + >> b32.bc
echo $(BCDIR)\lib\psdk\msimg32.lib + >> b32.bc
echo $(BCDIR)\lib\psdk\psapi.lib + >> b32.bc
echo $(BCDIR)\lib\psdk\rasapi32.lib + >> b32.bc
echo $(BCDIR)\lib\psdk\gdiplus.lib + >> b32.bc
echo $(BCDIR)\lib\psdk\shell32.lib, >> b32.bc
IF EXIST Open1.res echo Open1.res >> b32.bc
$(BCDIR)\bin\ilink32 -Gn -aa -Tpe -s @b32.bc
del b32.bc
.PRG.OBJ:
$(HBDIR)\bin\harbour $< /L /N /W /Oobj\ /I$(FWDIR)\include;$(HBDIR)\include
$(BCDIR)\bin\bcc32 -c -tWM -I$(HBDIR)\include -oobj\$& obj\$&.c
.C.OBJ:
echo -c -tWM -D__HARBOUR__ -DHB_API_MACROS > tmp
echo -I$(HBDIR)\include;$(FWDIR)\include >> tmp
$(BCDIR)\bin\bcc32 -oobj\$& @tmp $&.c
del tmp
#Open1.res : Open1.rc
# $(BCDIR)\bin\brc32.exe -r Open1.rc
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 34 guests