2012年9月11日 星期二

摘要:談談 hbnetio 這玩意(讓你的程式透過 TCP/IP 存取 DBF檔案

引用自廖皮的文章:
談談 hbnetio 這玩意(讓你的程式透過 TCP/IP 存取 DBF檔案


***harbour內建。與RDD無關

server side執行 hbnetio.exe
[-rpc] 可在server side執行habour支援的函數(自己寫store procedure....)
[-rootdir=<path>] 省略時為程式所在位置
[-port=n] 省略時為2491
[-password=ccc] 省略時為空白

client side
step 1:

if .not. hbnetio_connect( '192.168.1.100', 2941)
    alert('Can not connect to server!!')
    quit
 else
    alert('Connect success!!')
 endif

step:2
重要:在以前我們可能習慣用 File() 來檢查,在此要修改為 dbExists(),

其他的就只有檔名加路徑的格式為 “net:server:path\file” 而己。
執行server端函數:NETIO_FUNCEXEC( <cFuncName> [, <params,...>] ) -> <xFuncRetVal>
例如:cPath := netio_funcexec( 'hb_argv', 0 ) // 取得主機端 hbnetio.exe 執行檔路徑

其它
NETIO_PROCEXISTS( <cProcName> ) -> <lExists>

NETIO_PROCEXEC( <cProcName> [, <params,...>] ) -> <lSent>
NETIO_PROCEXECW( <cProcName> [, <params,...>] ) -> <lExecuted>
這兩個函數的差異向在於是否等待主機端回應.

server端壓縮備份。
cCmpStr := 'WinRAR.EXE -a -y test.rar *.dbf'
netio_funcexec( 'hb_run', cCmpStr )

小心也可用於server side del *.*

xHarbour to Harbour 移植到Harbour的問題2012.09.11

xHarbour to Harbour 移植到Harbour的問題2012.09.11


Error: Unresolved external 'AlphaBlend' referenced from
link  %bcdir%\lib\psdk\msimg32.lib


Error: Unresolved external 'GetModuleFileNameExA' referenced from
link psapi.lib

Error: Unresolved external '_HB_FUN_HB_GT_GUI_DEFAULT' referenced from
link harbour-30-bcc.lib

dbskipper() -> __dbskipper()

_hb_vmProcessSymbolsEx
版本不一致,fiveh.lib要重做,(詳見最後)



libs


@set libs=
@If exist app.lib set libs=app
@set libs=%libs% ..\_fwutl\utl
@set libs=%libs% fiveh fivehc

@set libs=%libs% xhb  hbwin harbour-32-bcc hbnetio
@set libs=%libs% hbrdd rddntx rddfpt rddcdx hbsix hbzlib
@set libs=%libs% hbpcre  hbrtl hbvm hblang gtwin hbmacro hbcommon
@set libs=%libs% ws2_32 cw32 import32 msimg32 psapi















jc_c.prg


#pragma BEGINDUMP
#include <hbapi.h>
#include <Windows.h>
//----------------------------------------------------------------------------//
HB_FUNC( LOADLIBRARY )
{
  hb_retnl( ( HB_LONG ) LoadLibrary( ( char * ) hb_parc( 1 ) ) );
}
//----------------------------------------------------------------------------//
HB_FUNC( FREELIBRARY )
{
  hb_retl( FreeLibrary( ( HMODULE ) hb_parnl( 1 ) ) );
}
//----------------------------------------------------------------------------//
wchar_t * hb_oleAnsiToWide( char * szString )
{
  int       iLen;
  wchar_t*  szWide;

  iLen = MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, szString, -1, NULL, 0 );
  szWide = ( wchar_t* ) hb_xgrab( iLen * sizeof( wchar_t ) );
  MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, szString, -1, szWide, iLen );
  return szWide;
}
//----------------------------------------------------------------------------//
#pragma ENDDUMP

Func dbSkipper(n); Retu __dbSkipper(n)
function ChmHelpPopup() ; return nil
function ChmHelpIndex() ; return nil
function ChmHelpTopic() ; return nil





重新另製一個新的fiveh.lib -> fiveh2.lib
1. copyfw.bat
2. make5h2.mak
3. make5h2.bat
folder:
fiveh2\
fiveh2\c
fiveh2\prg
fiveh2\obj


copyfw.bat


COPY %fw%\SOURCE\CLASSES\*.prg prg
COPY %fw%\SOURCE\FUNCTION\*.prg prg
COPY %fw%\SOURCE\WINAPI\*.prg prg
DEL prg\expbuild.prg
DEL prg\db10.prg
DEL prg\odbc32.prg
DEL prg\dbm.prg
DEL prg\vbxctrl.prg
DEL prg\_index.prg
DEL prg\dbms.prg
DEL prg\ddeserv.prg
DEL prg\field.prg
DEL prg\tnewsins.prg




make5h2.bat
<set your c & harbour enviromnet before>


@ECHO On
del c\*.c
del obj\*.obj
MAKE -f FiveH2.mak

del fiveH2.bak




make5h2.mak


.path.obj = obj
.path.res = obj
.path.c   = c
.path.prg = prg


BCC_OPT =  -d $(CFLAGS)
.SUFFIXES: .exe .obj .c

FiveH2_LIB_OBJS = \
ALERT.obj \
BAR.obj \
BITMAP.obj \
BLOCK.obj \
BROWSE.obj \
BRUSH.obj \
BTNBMP.obj \
BUTTON.obj \
CHECKBOX.obj \
CLIPBRD.obj \
CLIPMORE.obj \
COMBOBOX.obj \
CONTROL.obj \
CURSOR.obj \
DATABASE.obj \
DBTOOLS.obj \
DDE.obj \
DDECLIEN.obj \
DIALOG.obj \
DLGFIND.obj \
DLGS32.obj \
DbCombo.obj \
EDITCELL.obj \
ERRSYSW.obj \
FILENAME.obj \
FLINE.obj \
FONT.obj \
FWERROR.obj \
GETSYSIN.obj \
GETTASKS.obj \
GROUP.obj \
GTF.obj \
HARBOUR.obj \
HELP32.obj \
HELPCHM.obj \
ICON.obj \
IGET.obj \
IGROUP.obj \
IMAGE.obj \
INI.obj \
Internet.obj \
KEYS.obj \
LINKLIST.obj \
LOADVAL.obj \
LONGNAM2.obj \
MDICHILD.obj \
MDICLIEN.obj \
MDIFRAME.obj \
MDIREC.obj \
MEMSTAT.obj \
MENU.obj \
MENUITEM.obj \
METER.obj \
MGET.obj \
MIMECLIP.obj \
MRU.obj \
MSGBAR.obj \
MSGCALC.obj \
MSGGET.obj \
MSGLIST.obj \
MSGLOGO.obj \
MSGMETER.obj \
MSGRUN.obj \
MSGTBAR.obj \
MemoEdit.obj \
OBJECTS.obj \
OBJFILE.obj \
ODATA.obj \
OUTLOOK.obj \
PDMENU.obj \
PDREPORT.obj \
PEN.obj \
PRINTER.obj \
RADIO.obj \
RADMENU.obj \
RANDOM.obj \
RCOLUMN.obj \
REBAR.obj \
RECT.obj \
REG32.obj \
REPORT.obj \
RFILE.obj \
RGROUP.obj \
RLINE.obj \
RPREVIEW.obj \
RTFFILE.obj \
SAY.obj \
SCRLLBAR.obj \
SELECTOR.obj \
SHELLAPI.obj \
SLIDER.obj \
SPLITTER.obj \
SQLERROR.obj \
STATUSBA.obj \
TABS.obj \
TACCTBL.obj \
TCBROWSE.obj \
TCCOLUMN.obj \
TCLIPGET.obj \
TComObj.obj \
TCompone.obj \
TDBFComp.obj \
TDDEMLCl.obj \
TDICT.obj \
TDbase.obj \
TEXSTRUC.obj \
TFILEGTF.obj \
TFTP.obj \
TField.obj \
TFile.obj \
TForm.obj \
TFtpCli.obj \
TFtpFile.obj \
TFtpSess.obj \
THTMLPAG.obj \
TIMAGLST.obj \
TIME.obj \
TIMER.obj \
TIndex.obj \
TLOCKS.obj \
TLex.obj \
TLib.obj \
TMAIL.obj \
TMCI.obj \
TMETAFIL.obj \
TMNUCOMP.obj \
TMSGITEM.obj \
toolbar.obj \
TORDINFO.obj \
TPROXY.obj \
TPages.obj \
TPanel.obj \
TParser.obj \
TPop3.obj \
TProgres.obj \
TRAS.obj \
TRDD.obj \
TREEITEM.obj \
TREES.obj \
TRICHEDI.obj \
TSMTP.obj \
TSOCKET.obj \
TStruct.obj \
TTVItem.obj \
TTabCtrl.obj \
TTray.obj \
TTreeVie.obj \
TTxtEdit.obj \
TTxtFile.obj \
TWebClie.obj \
TWebServ.obj \
VALBLANK.obj \
VIDEO.obj \
WBROWSE.obj \
WINDOW.obj \
WININET.obj \
WQOUT.obj \
XPAD.obj \
folder.obj \
listbox.obj \

#EXPBUILD.obj \
# DbgItem.obj \
# DbgStack.obj \
# DbgVar.obj

.prg.c:
 harbour.exe $< /a/n/v/w/m  /i$(INCLUDE) /o$@  >> FiveH2.log

.c.obj:
 bcc32.exe $(BCC_OPT) -P- -c -tW -o$@ -I$(INCLUDE) -DHARBOUR_USE_WIN_GTAPI-DHB_COMPAT_C53 $<   >> FiveH2.log
 tlib.exe FiveH2.lib /P32 + $@ >>FiveH2.log

FiveH2.lib : $(FiveH2_LIB_OBJS)
  echo Harbour dir: $(HB_PATH) >> FiveH2.log



連結檔由fiveh.lib 改成自製的fiveh2.l,ib
如果有發生函數找不到時,用tlib fiveh.lib,fiveh.lst
到fiveh.lst裡找原 程式為何,再加到fiveh2.mak的.obj群中。(End at 2012.09.11 14:53)

copy
D:\harbour\contrib\xhb\hbcompat.ch
to
D:\harbour\include

後記:重bulid fiveh.lib 一直不成功 (錯誤一堆)。

試了很多版本都一樣。
最後放棄自建版後,竟然就link成功,不再出現_hb_vmProcessSymbolsEx 找不到....
超怪的它(或者我?) 2012.09.11 18:13