topic
stringlengths
1
63
text
stringlengths
1
577k
create a function with Tdatabase
Silvio, Class TDataBase has a destructor method, so when the object gets out of scope then it gets called change local oDbf into static oDbf (or keep it in an array) so the object is not destroyed
create a function with Tdatabase
[quote:28verw0u] oDbf := TDatabase():Open(,cAlias) [/quote:28verw0u] This syntax is wrong. The DBF is already open. Correct: [code=fw:28verw0u]<div class="fw" id="{CB}" style="font-family: monospace;">oDbf := TDatabase<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">&#40;</span> <span style="color: #0000ff;">SELECT</span><span style="color: #000000;">&#40;</span> cAlias <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span></div>[/code:28verw0u]
create a function with Tdatabase
[code=fw:3vm8saqt]<div class="fw" id="{CB}" style="font-family: monospace;"> &nbsp; oDbf := TDatabase<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>:<span style="color: #000000;">Open</span><span style="color: #000000;">&#40;</span>,cArchivio<span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp;<span style="color: #00C800;">IF</span> VALTYPE<span style="color: #000000;">&#40;</span> aIdx <span style="color: #000000;">&#41;</span> == <span style="color: #ff0000;">"A"</span><br />&nbsp; &nbsp; &nbsp; <span style="color: #00C800;">FOR</span> i := <span style="color: #000000;">1</span> <span style="color: #0000ff;">TO</span> LEN<span style="color: #000000;">&#40;</span> aIdx <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;DBSETINDEX<span style="color: #000000;">&#40;</span> aIdx<span style="color: #000000;">&#91;</span> i <span style="color: #000000;">&#93;</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; <span style="color: #00C800;">NEXT</span><br />&nbsp; &nbsp;<span style="color: #00C800;">ENDIF</span><br />&nbsp;</div>[/code:3vm8saqt] Change this as: [code=fw:3vm8saqt]<div class="fw" id="{CB}" style="font-family: monospace;"> &nbsp; oDbf := TDatabase<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>:<span style="color: #000000;">Open</span><span style="color: #000000;">&#40;</span>,cArchivio<span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp;<span style="color: #00C800;">IF</span> VALTYPE<span style="color: #000000;">&#40;</span> aIdx <span style="color: #000000;">&#41;</span> == <span style="color: #ff0000;">"A"</span><br />&nbsp; &nbsp; &nbsp; oDbf:<span style="color: #000000;">Exec</span><span style="color: #000000;">&#40;</span> <||<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #00C800;">local</span> i<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #00C800;">FOR</span> i := <span style="color: #000000;">1</span> <span style="color: #0000ff;">TO</span> LEN<span style="color: #000000;">&#40;</span> aIdx <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DBSETINDEX<span style="color: #000000;">&#40;</span> aIdx<span style="color: #000000;">&#91;</span> i <span style="color: #000000;">&#93;</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #00C800;">NEXT</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;<span style="color: #00C800;">ENDIF</span><br />&nbsp;</div>[/code:3vm8saqt]
create a function with Tdatabase
thanks
create a function with Tdatabase
Sivio, Maybe you didn't know that CDXs have always had the option to open all the indexes automatically when the DBF is opened. And as I understand it, NTXs can now do that also. REQUEST DBFCDX rddsetdefault( "DBFCDX" ) SET EXCLUSIVE OFF SET(_SET_AUTOPEN, .T. )
create a function with Tdatabase
[quote="James Bott":1jrvbyc6]Sivio, Maybe you didn't know that CDXs have always had the option to open all the indexes automatically when the DBF is opened. And as I understand it, NTXs can now do that also. REQUEST DBFCDX rddsetdefault( "DBFCDX" ) SET EXCLUSIVE OFF SET(_SET_AUTOPEN, .T. )[/quote:1jrvbyc6] yes I knew it but it happens that in my application there is a function that does not have to load the indexes or in one of the functions that I have seen that does not load them all As you well know in my old applications made for my school I had problems because sometimes the indexes were missing, so not checking them first when opening the application seems to me a stretch because I am always afraid of not finding them in that folder
create a function with Tdatabase
[quote:3k47mno6]yes I knew it but it happens that in my application there is a function that does not have to load the indexes or in one of the functions that I have seen that does not load them all[/quote:3k47mno6] Hmm, I always open the indexes whether they are used or not. This simplifies coding doesn't have a downside that I can think of. If you are using database objects, in order to not open the indexes sometimes, it would mean you would have to pass a parameter and when looking at the code you could never tell if the indexes were open or not. Is there a reason you need them to NOT have the indexes open?
create a harbour dll containing functions to be executed
I am trying to run the sample harbour dll - testdll and tutor01. I am able to create the sample testdll.exe and tutor01.dll, however when executed a message is thrown - error code 0 loading tutor01.dll. Why does this simple sample not work?
create a harbour dll containing functions to be executed
Friends, [b:2wgjq4il]Perry Nichols[/b:2wgjq4il] See my test in my [url=http&#58;//www&#46;4shared&#46;com/rar/8rhxQAtFba/RochaDLL&#46;html:2wgjq4il]4Shared.com[/url:2wgjq4il] [url=http&#58;//pctoledo&#46;com&#46;br/forum/viewtopic&#46;php?f=2&t=15428&p=90988#p90988:2wgjq4il]Original thread[/url:2wgjq4il]
create a harbour dll containing functions to be executed
Perry, Please modify tutor01.prg this way: [code=fw:3mlk7qsz]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"FiveWin.ch"</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><span style="color: #00C800;">function</span> Main<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp;<span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"Hello world from Harbour and FWH!"</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;<br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><span style="color: #00D7D7;">#pragma</span> BEGINDUMP<br /><br /><span style="color: #00D7D7;">#include</span> <windows.h><br /><span style="color: #00D7D7;">#include</span> <hbvm.h><br /><span style="color: #00D7D7;">#include</span> <hbapiitm.h><br /><br />BOOL WINAPI DllEntryPoint<span style="color: #000000;">&#40;</span> HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved <span style="color: #000000;">&#41;</span><br /><span style="color: #000000;">&#123;</span><br />&nbsp; &nbsp;HB_SYMBOL_UNUSED<span style="color: #000000;">&#40;</span> hinstDLL <span style="color: #000000;">&#41;</span>;<br />&nbsp; &nbsp;HB_SYMBOL_UNUSED<span style="color: #000000;">&#40;</span> fdwReason <span style="color: #000000;">&#41;</span>;<br />&nbsp; &nbsp;HB_SYMBOL_UNUSED<span style="color: #000000;">&#40;</span> lpvReserved <span style="color: #000000;">&#41;</span>;<br /><br />&nbsp; &nbsp;<span style="color: #00C800;">switch</span><span style="color: #000000;">&#40;</span> fdwReason <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;<span style="color: #000000;">&#123;</span><br />&nbsp; &nbsp; &nbsp; <span style="color: #00C800;">case</span> DLL_PROCESS_ATTACH:<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000;">MessageBox</span><span style="color: #000000;">&#40;</span> <span style="color: #000000;">0</span>, <span style="color: #ff0000;">"DLL properly loaded"</span>, <span style="color: #ff0000;">"DLL entry"</span>, <span style="color: #000000;">0</span> <span style="color: #000000;">&#41;</span>;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;hb_vmInit<span style="color: #000000;">&#40;</span> <span style="color: #000000;">0</span> <span style="color: #000000;">&#41;</span>;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #00C800;">break</span>;<br /><br />&nbsp; &nbsp; &nbsp; <span style="color: #00C800;">case</span> DLL_PROCESS_DETACH:<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000;">MessageBox</span><span style="color: #000000;">&#40;</span> <span style="color: #000000;">0</span>, <span style="color: #ff0000;">"DLL unloaded"</span>, <span style="color: #ff0000;">"DLL exit"</span>, <span style="color: #000000;">0</span> <span style="color: #000000;">&#41;</span>;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #00C800;">break</span>;<br />&nbsp; &nbsp;<span style="color: #000000;">&#125;</span><br /><br />&nbsp; &nbsp;<span style="color: #00C800;">return</span> <span style="color: #00C800;">TRUE</span>;<br /><span style="color: #000000;">&#125;</span><br /><br />void pascal __export HBDLLENTRY<span style="color: #000000;">&#40;</span> char * cProcName <span style="color: #000000;">&#41;</span><br /><span style="color: #000000;">&#123;</span><br />&nbsp; &nbsp;hb_itemDoC<span style="color: #000000;">&#40;</span> cProcName, <span style="color: #000000;">0</span> <span style="color: #000000;">&#41;</span>;<br /><span style="color: #000000;">&#125;</span><br /><br /><span style="color: #00D7D7;">#pragma</span> ENDDUMP</div>[/code:3mlk7qsz]
create a harbour dll containing functions to be executed
Thank you Antonio, This now works, However now I am trying the sample testmydl and mydll which passes parameters to the dll. When I execute this test the following error is thrown: Error code 0 loading MYDLL.dll. Thank you in advance for your help in resolving this issue.
create a harbour dll containing functions to be executed
Perry, Try adding this code to mydll.prg [code=fw:1aqw9zw1]<div class="fw" id="{CB}" style="font-family: monospace;">BOOL WINAPI DllEntryPoint<span style="color: #000000;">&#40;</span> HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved <span style="color: #000000;">&#41;</span><br /><span style="color: #000000;">&#123;</span><br />&nbsp; &nbsp;HB_SYMBOL_UNUSED<span style="color: #000000;">&#40;</span> hinstDLL <span style="color: #000000;">&#41;</span>;<br />&nbsp; &nbsp;HB_SYMBOL_UNUSED<span style="color: #000000;">&#40;</span> fdwReason <span style="color: #000000;">&#41;</span>;<br />&nbsp; &nbsp;HB_SYMBOL_UNUSED<span style="color: #000000;">&#40;</span> lpvReserved <span style="color: #000000;">&#41;</span>;<br /><br />&nbsp; &nbsp;<span style="color: #00C800;">switch</span><span style="color: #000000;">&#40;</span> fdwReason <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;<span style="color: #000000;">&#123;</span><br />&nbsp; &nbsp; &nbsp; <span style="color: #00C800;">case</span> DLL_PROCESS_ATTACH:<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000;">MessageBox</span><span style="color: #000000;">&#40;</span> <span style="color: #000000;">0</span>, <span style="color: #ff0000;">"DLL properly loaded"</span>, <span style="color: #ff0000;">"DLL entry"</span>, <span style="color: #000000;">0</span> <span style="color: #000000;">&#41;</span>;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;hb_vmInit<span style="color: #000000;">&#40;</span> <span style="color: #000000;">0</span> <span style="color: #000000;">&#41;</span>;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #00C800;">break</span>;<br /><br />&nbsp; &nbsp; &nbsp; <span style="color: #00C800;">case</span> DLL_PROCESS_DETACH:<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000;">MessageBox</span><span style="color: #000000;">&#40;</span> <span style="color: #000000;">0</span>, <span style="color: #ff0000;">"DLL unloaded"</span>, <span style="color: #ff0000;">"DLL exit"</span>, <span style="color: #000000;">0</span> <span style="color: #000000;">&#41;</span>;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #00C800;">break</span>;<br />&nbsp; &nbsp;<span style="color: #000000;">&#125;</span><br /><br />&nbsp; &nbsp;<span style="color: #00C800;">return</span> <span style="color: #00C800;">TRUE</span>;<br /><span style="color: #000000;">&#125;</span></div>[/code:1aqw9zw1]
create a harbour dll containing functions to be executed
That works fine, Thank you Antonio. One more item - we have the need to pass values back from the DLL to the calling EXE. Is this possible? Is pass by reference "@" a way to modify the value in the DLL and return to the EXE? Do you have to have the same number of parms for each function in the DLL?
create a harbour dll containing functions to be executed
Perry, > we have the need to pass values back from the DLL to the calling EXE. Is this possible ? Yes. What types of values do you need to pass back ? character, number, etc ? We need to know their types in advance. > Is pass by reference "@" a way to modify the value in the DLL and return to the EXE ? We can implement it in the function HBDLLENTRY() itself > Do you have to have the same number of parms for each function in the DLL? You can implement several functions for each number of params to pass: void pascal __export HBDLLENTRY1( char * cProcName, PHB_ITEM pParam1 ) { hb_itemDoC( cProcName, 1, pParam1 ); } void pascal __export HBDLLENTRY2( char * cProcName, PHB_ITEM pParam1, PHB_ITEM pParam2 ) { hb_itemDoC( cProcName, 2, pParam1, pParam2 ); } etc.
create a harbour dll containing functions to be executed
> We can implement it in the function HBDLLENTRY() itself void pascal __export HBDLLENTRY1( char * cProcName, PHB_ITEM pParam1 ) { hb_itemDoC( cProcName, 1, pParam1 ); if( HB_ISBYREF( pParam1 ) ) hb_itemPutC( pParam1, hb_retc( -1 ) ); // -1 mean the value returned from cProcName }
create a harbour dll containing functions to be executed
Antonio, Thank you for the info - much appreciated. Regarding passing parameters - > You can implement several functions for each number of params to pass: does each parm have to be the same data type in all functions? Also, I am looking at the samples in FWH64 v1605 and the buildhd.bat looks like a 32 bit build for borland - is there a bat to build a 64bit dll?
create a harbour dll containing functions to be executed
Perry, > does each parm have to be the same data type in all functions? They have to be Harbour "items", thats why you need to use the function ItemNew(): <!-- l --><a class="postlink-local" href="http://forums.fivetechsupport.com/viewtopic.php?f=3&t=22835&start=15">viewtopic.php?f=3&t=22835&start=15</a><!-- l --> > Also, I am looking at the samples in FWH64 v1605 and the buildhd.bat looks like a 32 bit build for borland - is there a bat to build a 64bit dll? We have not created it yet. I am going to try to create it Please keep in mind that if you use a 64 bits DLL then you must use a 64 bits EXE to call it
create a harbour dll containing functions to be executed
can we execute a 32 bit dll from a 64 bit exe?
create a harbour dll containing functions to be executed
Perry, > can we execute a 32 bit dll from a 64 bit exe? No, as far as I know
create a harbour dll containing functions to be executed
I have FWH 16.02 & Harbour 3.2.0dev I tried my original MYDLL.PRG with BUILDHD,bat, but i got many errors : Turbo Incremental Link 6.70 Copyright (c) 1997-2014 Embarcadero Technologies, Inc. Error: Unresolved external '_HB_FUN_CTOT' referenced from C:\FWH7\LIB\FIVEH.LIB|VALBLANK Error: Unresolved external '_HB_FUN_HB_COMPILEFROMBUF' referenced from C:\FWH7\LIB\FIVEH.LIB|HARBOUR Error: Unresolved external '_HB_FUN_TOLEAUTO' referenced from C:\FWH7\LIB\FIVEH.LIB|HARBOUR Error: Unresolved external '_HB_FUN_HHASKEY' referenced from C:\FWH7\LIB\FIVEH.LIB|FWDECODE Error: Unresolved external '_HB_FUN_OS_ISWTSCLIENT' referenced from C:\FWH7\LIB\FIVEH.LIB|MENU Error: Unresolved external '_HB_FUN_NUMAT' referenced from C:\FWH7\LIB\FIVEH.LIB|MENUITEM . . and many other ************ I inserted in MYDLL.PRG the: BOOL WINAPI DllEntryPoint( HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved ) { HB_SYMBOL_UNUSED( hinstDLL ); HB_SYMBOL_UNUSED( fdwReason ); HB_SYMBOL_UNUSED( lpvReserved ); switch( fdwReason ) { case DLL_PROCESS_ATTACH: MessageBox( 0, "DLL properly loaded", "DLL entry", 0 ); hb_vmInit( 0 ); break; case DLL_PROCESS_DETACH: MessageBox( 0, "DLL unloaded", "DLL exit", 0 ); break; } return TRUE; BUT I GOT THIS ERROR: mydll.prg(22) Error E0030 Syntax error "syntax error at 'WINAPI'" mydll.prg(24) Error E0020 Incomplete statement or unbalanced delimiters mydll.prg(28) Error E0030 Syntax error "syntax error at '('" mydll.prg(30) Error E0020 Incomplete statement or unbalanced delimiters mydll.prg(31) Error E0020 Incomplete statement or unbalanced delimiters mydll.prg(35) Error E0030 Syntax error "syntax error at 'HB_VMINIT'" mydll.prg(36) Error E0030 Syntax error "syntax error at 'CASE'" mydll.prg(39) Error E0030 Syntax error "syntax error at 'BREAK'" mydll.prg(42) Warning W0001 Ambiguous reference 'TRUE' mydll.prg(43) Error E0030 Syntax error "syntax error at '}'" mydll.prg(44) Error E0017 Unclosed control structure 'SWITCH' Any help ?
create a harbour dll containing functions to be executed
Please use this buildhd.bat file: [code=fw:168pp8j8]<div class="fw" id="{CB}" style="font-family: monospace;">@ECHO OFF<br />CLS<br />ECHO ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿<br />ECHO ³ FiveWin <span style="color: #00C800;">for</span> Harbour <span style="color: #000000;">16.06</span> - Jun. <span style="color: #000000;">2016</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Harbour development <span style="color: #0000ff;">power</span> ³Ü<br />ECHO ³ <span style="color: #000000;">&#40;</span>c<span style="color: #000000;">&#41;</span> FiveTech, <span style="color: #000000;">1993</span><span style="color: #000000;">-2016</span> &nbsp; <span style="color: #00C800;">for</span> Microsoft Windows 9x/NT/<span style="color: #000000;">2000</span>/ME/XP/Vista/<span style="color: #000000;">7</span>/<span style="color: #000000;">8</span> ³Û<br />ECHO ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙÛ<br />ECHO ÿ ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß<br /><br /><span style="color: #00C800;">if</span> A%<span style="color: #000000;">1</span> == A GOTO :<span style="color: #000000;">SINTAX</span><br /><span style="color: #00C800;">if</span> NOT EXIST %<span style="color: #000000;">1</span>.prg GOTO :<span style="color: #000000;">NOEXIST</span><br /><br /><span style="color: #00C800;">if</span> <span style="color: #ff0000;">"%FWDIR%"</span> == <span style="color: #ff0000;">""</span> set FWDIR=.\..<br /><span style="color: #00C800;">if</span> <span style="color: #ff0000;">"%HBDIR%"</span> == <span style="color: #ff0000;">""</span> set HBDIR=c:\harbour<br />rem <span style="color: #00C800;">if</span> <span style="color: #ff0000;">"%2"</span> == <span style="color: #ff0000;">"/b"</span> set GT=gtwin<br />rem <span style="color: #00C800;">if</span> not <span style="color: #ff0000;">"%2"</span> == <span style="color: #ff0000;">"/b"</span> set GT=gtgui<br />set GT=gtgui<br /><br />ECHO Compiling...<br /><br />set hdir=%HBDIR%<br />set hdirl=%hdir%\lib<br />set fwh=%FWDIR%<br /><span style="color: #00C800;">if</span> exist c:\bcc7 set bcdir=c:\bcc7<br /><span style="color: #00C800;">if</span> exist c:\bcc64 set bcdir=c:\bcc64<br /><br />%hdir%\bin\harbour %<span style="color: #000000;">1</span> /n /i..\include;%hdir%\include /w /p %<span style="color: #000000;">2</span> %<span style="color: #000000;">3</span> > clip.log <span style="color: #000000;">2</span>> warnings.log<br />@type clip.log<br />@type warnings.log<br /><br /><span style="color: #00C800;">IF</span> ERRORLEVEL <span style="color: #000000;">1</span> <span style="color: #00C800;">PAUSE</span><br /><span style="color: #00C800;">IF</span> ERRORLEVEL <span style="color: #000000;">1</span> GOTO EXIT<br /><br />echo -O2 -I%hdir%\include %<span style="color: #000000;">1</span>.c > b32.bc<br />%bcdir%\bin\bcc32 -M -c @b32.bc<br />:<span style="color: #000000;">ENDCOMPILE</span><br /><br /><span style="color: #00C800;">IF</span> EXIST %<span style="color: #000000;">1</span>.rc %bcdir%\bin\brc32 -r %<span style="color: #000000;">1</span><br /><br />echo c0d32.obj + > b32.bc<br />echo %<span style="color: #000000;">1</span>.obj, + >> b32.bc<br />echo %<span style="color: #000000;">1</span>.dll, + >> b32.bc<br />echo %<span style="color: #000000;">1</span>.map, + >> b32.bc<br />echo ..\lib\FiveH.lib ..\lib\FiveHC.lib + >> b32.bc<br />echo %hdirl%\hbwin.lib + >> b32.bc<br />echo %hdirl%\gtgui.lib + >> b32.bc<br />echo %hdirl%\hbrtl.lib + >> b32.bc<br />echo %hdirl%\hbvm.lib + >> b32.bc<br />echo %hdirl%\hblang.lib + >> b32.bc<br />echo %hdirl%\hbmacro.lib + >> b32.bc<br />echo %hdirl%\hbrdd.lib + >> b32.bc<br />echo %hdirl%\rddntx.lib + >> b32.bc<br />echo %hdirl%\rddcdx.lib + >> b32.bc<br />echo %hdirl%\rddfpt.lib + >> b32.bc<br />echo %hdirl%\hbsix.lib + >> b32.bc<br />echo %hdirl%\hbdebug.lib + >> b32.bc<br />echo %hdirl%\hbcommon.lib + >> b32.bc<br />echo %hdirl%\hbpp.lib + >> b32.bc<br />echo %hdirl%\hbcpage.lib + >> b32.bc<br />echo %hdirl%\hbcplr.lib + >> b32.bc<br />echo %hdirl%\hbct.lib + >> b32.bc<br />echo %hdirl%\hbpcre.lib + >> b32.bc<br />echo %hdirl%\xhb.lib + >> b32.bc<br />echo %hdirl%\hbziparc.lib + >> b32.bc<br />echo %hdirl%\hbmzip.lib + >> b32.bc<br />echo %hdirl%\hbzlib.lib + >> b32.bc<br />echo %hdirl%\minizip.lib + >> b32.bc<br />echo %hdirl%\png.lib + >> b32.bc<br />echo %hdirl%\hbusrrdd.lib + >> b32.bc<br />echo %hdirl%\hbtip.lib + >> b32.bc<br /><br />rem Uncomment these two lines <span style="color: #0000ff;">to</span> use Advantage RDD<br />rem echo %hdir%\lib\b32\rddads.lib + >> b32.bc<br />rem echo ..\lib\Ace32.lib + >> b32.bc<br /><br />echo %bcdir%\lib\cw32.lib + >> b32.bc<br />echo %bcdir%\lib\uuid.lib + >> b32.bc<br />echo %bcdir%\lib\import32.lib + >> b32.bc<br />echo %bcdir%\lib\ws2_32.lib + >> b32.bc<br />echo %bcdir%\lib\psdk\odbc32.lib + >> b32.bc<br />echo %bcdir%\lib\psdk\nddeapi.lib + >> b32.bc<br />echo %bcdir%\lib\psdk\iphlpapi.lib + >> b32.bc<br />echo %bcdir%\lib\psdk\msimg32.lib + >> b32.bc<br />echo %bcdir%\lib\psdk\psapi.lib + >> b32.bc<br />echo %bcdir%\lib\psdk\rasapi32.lib + >> b32.bc<br />echo %bcdir%\lib\psdk\gdiplus.lib + >> b32.bc<br />echo %bcdir%\lib\psdk\shell32.lib, >> b32.bc<br /><br /><span style="color: #00C800;">IF</span> EXIST %<span style="color: #000000;">1</span>.res echo %<span style="color: #000000;">1</span>.res >> b32.bc<br />%bcdir%\bin\ilink32 -Tpd @b32.bc<br /><br /><span style="color: #00C800;">IF</span> ERRORLEVEL <span style="color: #000000;">1</span> GOTO LINKERROR<br />ECHO * <span style="color: #00C800;">self</span> contained DLL successfully built<br />GOTO EXIT<br />ECHO<br /><br />rem delete temporary files<br />@del %<span style="color: #000000;">1</span>.c<br />@del %<span style="color: #000000;">1</span>.il?<br /><br />:<span style="color: #000000;">LINKERROR</span><br />ECHO * There are errors<br />GOTO EXIT<br /><br />:<span style="color: #000000;">SINTAX</span><br />ECHO &nbsp; &nbsp;SYNTAX: <span style="color: #000000;">Build</span> <span style="color: #000000;">&#91;</span>Program<span style="color: #000000;">&#93;</span> &nbsp; &nbsp; <span style="color: #000000;">&#123;</span>-- No especifiques la extensi¢n PRG<br />ECHO &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000;">&#123;</span>-- Don<span style="color: #ff0000;">'t specify .PRG extension<br />GOTO EXIT<br /><br />:NOEXIST<br />ECHO The specified PRG %1 does not exist<br /><br />:EXIT<br /></span></div>[/code:168pp8j8]
create a harbour dll containing functions to be executed
Now the MYDLL.DLL has been created with your new buildhd.bat and (usin the original mydll.prg) But using the BUILDH.BAT TESTMYDL.PRG and running the TESTMYDL.EXE it gives: Error code: 0 loading MYDLL.dll Ops !!!
create a harbour dll containing functions to be executed
Romeo, Please include the code that I posted here inside #pragma BEGINDUMP ... ENDDUMP <!-- l --><a class="postlink-local" href="http://forums.fivetechsupport.com/viewtopic.php?p=193644#p193644">viewtopic.php?p=193644#p193644</a><!-- l -->
create a harbour dll containing functions to be executed
Antonio, Do you know if you can call a harbour DLL from a C# .Net exe ? If so can you provide an example?
create a harbour dll containing functions to be executed
Perry, Here you have an example that I coded for FiveNet: [url:2nss5as9]https&#58;//bitbucket&#46;org/fivetech/fivenet/src/fdc55d7abee75799ae25b716c4c79c06556aa8ee/source/cs/fivetech&#46;cs?at=master&fileviewer=file-view-default[/url:2nss5as9] Look for: public class FiveNet { // public string AppName; [ DllImport ( "ftsnet.dll", CallingConvention = CallingConvention.Cdecl ) ] public static extern void One( uint pBlock );
create a harbour dll containing functions to be executed
Antonio, I'm not sure that I have the Harbour DLL setup properly. I receive the following error An unhandled exception of type 'System.EntryPointNotFoundException' occurred in WindowsFormsApplication1.exe Additional information: Unable to find an entry point named 'OneParam' in DLL 'Mydll.dll'. This is the code we are using for the DLL // Build a DLL from this code using: buildhd.bat mydll // Please review TESTMYDL.prg to see how to use this DLL. //----------------------------------------------------------------------------// function Main() MsgInfo( "Inside DLL main()" ) return nil //----------------------------------------------------------------------------// function OneParam( x ) MsgInfo( x ) return nil //----------------------------------------------------------------------------// #pragma BEGINDUMP #include <windows.h> #include <hbapi.h> #include <hbapiitm.h> __declspec( dllexport ) LONG pascal DOPROC( char * cProcName, char * cParam ) { PHB_ITEM pItem = hb_itemPutC( NULL, cParam ); if( cProcName ) { hb_itemDoC( cProcName, 1, ( PHB_ITEM ) pItem, 0 ); hb_itemRelease( pItem ); } else MessageBox( 0, "inside the DLL", "DOPROC", 0 ); return 0; } BOOL WINAPI DllEntryPoint( HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved ) { HB_SYMBOL_UNUSED( hinstDLL ); HB_SYMBOL_UNUSED( fdwReason ); HB_SYMBOL_UNUSED( lpvReserved ); switch( fdwReason ) { case DLL_PROCESS_ATTACH: MessageBox( 0, "DLL properly loaded", "DLL entry", 0 ); hb_vmInit( 0 ); break; case DLL_PROCESS_DETACH: MessageBox( 0, "DLL unloaded", "DLL exit", 0 ); break; } return TRUE; } #pragma ENDDUMP //----------------------------------------------------------------------------//
create a harbour dll containing functions to be executed
You are not exporting OneParam() from the DLL so you can not call OneParam() directly from your EXE. You have to call DOPROC() from your EXE, as it is the exported function of the DLL
create a harbour dll containing functions to be executed
NO more help ?
create a harbour dll containing functions to be executed
Hi dear Perry Nichols, please can you kindly send me at <!-- e --><a href="mailto:romeox@tiscali.it">romeox@tiscali.it</a><!-- e --> those files: MYDLL.PRG TESTMYDLL.PRG BUILDHD.BAT I wrong samethins in my files, and it doesnot work ! FWH 16.02 many thanks
create a harbour dll containing functions to be executed
OK, i retrive my error. it works now ! tks
create a harbour dll containing functions to be executed
very good <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) -->
create a pcode dll
I am using the samples from FiveWin testdllp.prg and pcodedll.prg when I execute the exe made using the testdllp.prg the following message appears "An exception (C00000FD) occurred during DllEntryPoint or DLLMain in module: ...\pcodedll.dll any help is greatly appreciated.
create a pcode dll
Hello Don, I compiled and tested the samples < TESTDLLP.prg (13.12.2007) > and < PCODEDLL.prg (13.12.2007) It works fine here, no error ( I using xHARBOUR ). The Dll is inside the same path of the exe-file ? Regards Uwe <!-- s:lol: --><img src="{SMILIES_PATH}/icon_lol.gif" alt=":lol:" title="Laughing" /><!-- s:lol: -->
create a pcode dll
Don, Are you using Harbour or xHarbour ? Borland C ?
create a pcode dll
borland c with xharbour10 with fwh 7.1
create a pcode dll
Don, We provide several examples with FWH: FWH\samples\TestDLLP.prg shows how to use a pcode DLL FWH\samples\pcodedll.prg shows how to build a pcode DLL using buildhdp.bat But I am afraid that you may experience compatibility problems. We recommend you to upgrade to FWH 8.12 and current xHarbour provided by FiveTech, in order to be able to build and test our same examples, so we can provide you the proper tech support.
create a pcode dll
Antonio, estos ejemplos solo funcionan con Harbour? Estoy tratando de probarlos con xHarbour, y Borland C++ 5.5, pero me hace falta "MAINDLLP.OBJ" Saludos cordiales. Carlos Sincuir.
create a pcode dll
Carlos, Those examples work with both Harbour and xHarbour. maindllp.obj is not automatically created by Harbour/xHarbour makefiles, so you have to create it manually from Harbour/xHarbour source\vm\maindllp.c Here you have maindllp.obj already created for Harbour: <!-- m --><a class="postlink" href="http://www.mediafire.com/?sharekey=de511730a5a4890a91b20cc0d07ba4d23528bcb23c8c3964">http://www.mediafire.com/?sharekey=de51 ... b23c8c3964</a><!-- m --> and maindllp.obj for xHarbour: <!-- m --><a class="postlink" href="http://www.mediafire.com/?sharekey=de511730a5a4890a91b20cc0d07ba4d274e69e052f1d41f7">http://www.mediafire.com/?sharekey=de51 ... 052f1d41f7</a><!-- m -->
create a pcode dll
Thank you for your help - we have successfully passed a char value to DLL Is it possible to pass an array ? If not can you provide samples for Int, Logical(bool). We have a Need to pass various parameters to a dll, and are not C programmers. We are having difficulties with more than 1 parm. Thank you for your help. p.s. Is the debugger fixed in the Latest version of xHarbour1.0? We have NOT upgraded do to the lack of a debugger.
create a pcode dll
Don, Based on your comments it seems to me that you are talking about a C DLL instead of a pcode DLL. A pcode DLL is created using PRG code and it uses the EXE "virtual machine". They are small DLLs that just contain "pcode" and need the "virtual machine" from the EXE, to execute the pcode. A C DLL is created using C code (usually) and its C code is called from the EXE. It does not need the EXE "virtual machine" at all. I recommend you this document reading as it explains the different kind of DLLs that can be managed with Harbour/xHarbour: [quote:6mfm92ke] /* * $Id: windll.txt 5836 2002-12-28 00:32:44Z brianhays $ */ Windows 32-bit DLLs with Harbour code ===================================== Programs created with Clipper or Harbour are traditionally a monolithic EXE containing all executable code. This includes the Virtual Machine (VM) and the RunTime Library (RTL) as well as your own code. Running under Windows (Win32) with Harbour, you can now also create and use Windows DLLs that contain PRG code. Harbour supports Win32 DLLs in 3 ways. 1) Self-contained DLLs containing functions from any platform. (These are not what we call a "Harbour.dll", although they may be named that. The DLL entry points are different.) These have the VM/RTL inside them and can be used by any other Windows program. You can create a .lib for static linking, or use GetProcAddress as in any standard Win32 DLL. Calling Harbour/Prg functions directly is limited to those that take no parameters unless you include C functions in the DLL that take parameters and then call the PRG-level code. To do static linking, do this to create the .lib: implib harbour.lib harbour.dll For the Borland C platform, use that library and import32.lib and cw32.lib from Borland, and you are ready to go. See contrib\delphi\hbdll for an example of a Delphi program that can use all of Harbour's functionality by accessing a self-contained DLL. BLD_SDLL.BAT is used there to create the DLL. 2) PCode EXEs using a Harbour.dll A Harbour.dll is designed to be called from a Harbour app. A pcode EXE is a small Harbour executable that does not contain the VM/RTL. To execute its functions, it must load and access a Harbour.dll. If you want dynamic linking, then use this to execute a Harbour dynamically loaded pcode DLL function or procedure: HB_DllDo( <cFuncName> [,<params...>] ) --> [<uResult>] This lets you have all your common code in a DLL, and have lots of small EXEs that use it. Realize however that, even though this may be a nice way to manage your code, each EXE may load its own image of the Harbour.dll into memory at runtime. In terms of Windows memory, there may not be a benefit to using pcode EXEs over monolithic EXEs. But it may be a worthwhile maintenance benefit to have lots of replaceable small exes. 3) PCode DLLs used from traditional EXEs A pcode DLL does not contain the VM/RTL. It is a library of Harbour-compiled PRG code that uses the VM/RTL of the EXE that calls it. This has the benefit of having replaceable modules in DLLs that don't necessarily require updating your EXE. The following is clipped from a msg by Antonio Linares to the Harbour developer list explaining some of the details: Please notice that there are three different Windows DLL entry points: + source/vm/ * maindll.c Windows self-contained DLL entry point * maindllh.c Windows Harbour DLL entry point (harbour.dll) * maindllp.c Windows pcode DLL entry point and VM/RTL routing functions > * maindll.c Windows self-contained DLL entry point To produce Harbour code, as DLLs, that may be used from other programming languages applications (as VB, Delphi, C++, etc...) > * maindllh.c Windows Harbour DLL entry point (harbour.dll) To produce Harbour.dll, to be just used from small pcode Harbour EXEs > * maindllp.c Windows pcode DLL entry point and VM/RTL routing To produce small pcode DLLs, to be used just from Harbour EXE apps. maindllp.c is the entry point for the Harbour pcode DLLs. pcode DLLs are quite small DLLs, that just contain pcode and/or C (using extend api) functions. mainwin.c is the entry point for Windows EXEs, not for DLLs. You may use maindll.c, maindllh.c or maindllp.c based on your needs. If you are looking to build a Harbour.dll, then you must use maindllh.c [/quote:6mfm92ke]
create a pcode dll
Don, The question is: Are you using a third party DLL that can be used from any programming language ? This uses to be a C DLL. If this is the case, then keep in mind that the C language knows "nothing" about the Harbour/xHarbour items structure. You can just supply C types to the DLL, so you have to convert the Harbour/xHarbour items values to C types, in order to manage them from the DLL. Have you created the DLL youself using C language ? Or, have you used harbour.exe to create the DLL ?
create a pcode dll
Don, > Is the debugger fixed in the Latest version of xHarbour1.0? We have NOT upgraded do to the lack of a debugger. > The xHarbour debugger is properly working with FWH 8.12 and the xHarbour build that FiveTech provides: [url=http&#58;//imageshack&#46;us:yjie50av][img:yjie50av]http&#58;//img114&#46;imageshack&#46;us/img114/6829/capturecx0&#46;png[/img:yjie50av][/url:yjie50av]
create a pcode dll
Antoio, Thank you for your feedback. We are wanting to create an executable dll using prg code. We do not have much C coding experience. Sounds like the pcode dll is the way to go. We are currently looking at our options to determine the best way to implement custom coding without having to make a new exe. I am assuming since you did not answer the "pass array question" - it is not possible. Please advise. Once again your assistance is greatly appreciated.
create a pcode dll
Don, > I am assuming since you did not answer the "pass array question" - it is not possible. It is perfectly possible <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) --> Being a pcode DLL you can supply Harbour/xHarbour items to it. No limitations. Please show how you are coding your DLL or an example, so we can point you in the right way. thanks
create a pcode dll
Antonio, Below is a sample calling prg: [code:2boqunhf] #include "FiveWin&#46;ch" function Main() local cString &#58;= "Hello world!" local cString2 &#58;= "ABC or 123?" local LPARM &#58;= &#46;T&#46;, retarr &#58;= {}, passparm &#58;= {} local NPARM &#58;= 998877 local DPARM &#58;= DATE() DOPROC( "MAIN" ) aadd(passparm, {cstring, cstring2, nparm, lparm, dparm } ) retarr &#58;= DOPROC( "ONEPARAM", @passparm ) MsgInfo( "mydll returned OK to myEXE" ) return nil DLL FUNCTION DOPROC( cProc AS LPSTR, aparm AS ???? ) AS LONG PASCAL LIB "MYDLL&#46;dll" [/code:2boqunhf] What we would like to do is call the dll with an array of parameters. This array may contain various data types. We would like to get back an array contining various data items as needed. Also, is it possible to change the contents of the original passed array and see the results in the calling prg? Once again your assistance is greatly appreciated.
create a pcode dll
Don, Are you building your DLL as described here ? <!-- l --><a class="postlink-local" href="http://forums.fivetechsupport.com/viewtopic.php?f=3&t=11626&start=0&hilit=oneparam">viewtopic.php?f=3&t=11626&start=0&hilit=oneparam</a><!-- l --> If yes, then you are calling a C function and you can not supply a Harbour item to it. Please review the use of HBDLLENTRY...() in that same post. You can supply a Harbour item to those functions, even if they are arrays <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) -->
create a pcode dll
Antonio, I'm thinking that's a good sample, and i have curiosity for the correct use and compiling. The sample dll maybe can be: [code:11x5s1hc]MyDll&#46;dll Function OneParam( aData ) *------------------------- LOCAL nI LOCAL nTotal &#58;= Len(aData) FOR nI &#58;= 1 TO nTotal MsgInfo( aData&#91; nI &#93;&#91; 1 &#93; + CRLF + ; aData&#91; nI &#93;&#91; 2 &#93; + CRLF + ; Str( aData&#91; nI &#93;&#91; 3 &#93; ) + CRLF + ; cValToChar( aData&#91; nI &#93;&#91; 4 &#93; ) + CRLF + ; DToC( aData&#91; nI &#93;&#91; 5 &#93; ) NEXT RETU &#46;T&#46;[/code:11x5s1hc]
create a pcode dll
Antonio, I am using the samples testdllp.prg and pcodell.prg The pcodedll.prg is giving me the following when I try to make with the buildhdp.bat Turbo Incremental Link 5.00 Copyright (c) 1997, 2000 Borland Error: Unresolved external '_HB_FUN___CLSINST' referenced from T:\FWH\SAMPLES\PC ODEDLL.OBJ Error: Unresolved external '_HB_FUN_PCOUNT' referenced from T:\FWH\SAMPLES\PCODE DLL.OBJ Error: Unresolved external '_HB_FUN_HB_APARAMS' referenced from T:\FWH\SAMPLES\P CODEDLL.OBJ Any help is greatly appreciated.
create a pcode dll
Don, Have you modified buildhdp.bat to call xHarbour instead of Harbour ?
create a pcode dll
Thank you for your prompt response - can we create a pcode dll in xharbour?
create a pcode dll
Don, Yes, they can be created with xharbour too. But buildhdp.bat has to be modified to call xharbour.exe and use the xharbour libraries.
create a pcode dll
Antonio, Thank you for all of your assistance - we have been successful in creating a pcode dll passing parameters as needed. <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D --> Here is what we have - xHarbour calling exe: [code:3s851xdo] function Main() local dllret, dparm &#58;= date(), lparm &#58;= &#46;t&#46; local aparm &#58;= {'a', date(), 4321,&#46;t&#46;,{'c'}} local hDll &#58;= LoadLibrary( "mypdll&#46;dll" ) private p1 m->p1 &#58;= 'this is a private var' altd(1) altd() //**HB_LibDo( "DLLInit" ) dllret &#58;= HB_LibDo( "mydllFunc", {'tstparm1', 'aparm2', 1234, dparm, lparm, aparm } ) ? dllret return &#46;t&#46; [/code:3s851xdo] xHarbour pcode dll - [code:3s851xdo] function mydllFunc( aparm ) local i &#58;= 0 altd(1) altd() ? m->p1 for i &#58;= 1 to len(aparm) ? aparm&#91;i&#93; next return i [/code:3s851xdo] Once again thank you for your help
create a pcode dll
Don, Very good <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) -->
create a pcode dll
Don, In your example, where is HB_LibDo() ?
create a pcode dll
Hello Antonio, Could you please instruct me how to set up the debugger. Thanks in advance Otto >Is the debugger fixed in the Latest version of xHarbour1.0? >We have NOT upgraded do to the lack of a debugger. > >The xHarbour debugger is properly working with FWH 8.12 and the xHarbour build that FiveTech provides:
create a pcode dll
Otto, Please build FWH\samples\altd.prg this way: buildh.bat altd /b
create a pcode dll
HB_LibDo() is a Harbour function. We have also experienced some Debugger issues in xHarbour v1.0 It seems that the f7 - run to cursor, and f9 - set break do not work with the xHarbour v1.0, as in the previous versions.
create an arra from txt file
I have a file txt "level1.txt" type : 001700509573024106800501002700295018009400305652800007465080071000159004908007053 029650178705180600100900500257800309600219005900007046573400021800020453010395000 008203500009670408346050702430010059967005001000496203280034067703500904004107020 800005216045862007670009500769204030020001765001670009004096800907400601306107940 I wish insert all into a array having only one field of 81 space atest:= { Space(81) } I made this but it make error cFile:="level1.txt" ctext:= Memoread(cFile) nLinea :=MLCOUNT(cTexto) for n=1 to nLinea cLinea:=MEMOLINE(cTexto,81,n) AADD(atest,ALLTRIM(cLinea)) next [b:3cz0xy08]the error It make error because it count me 1998 lines but the sum of lines are 999 then add other fields to array [/b:3cz0xy08] I cannot post the file because it contains 82748 characters. The maximum number of allowed characters is 60000 for this forum
create an arra from txt file
Silvio, [code=fw:1gl27dxu]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"tselex.ch"</span><br /><br /><span style="color: #00C800;">FUNCTION</span> MAIN<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><span style="color: #00C800;">LOCAL</span> oText:= TTxtFile<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"level1.txt"</span> <span style="color: #000000;">&#41;</span>, aTest := <span style="color: #000000;">&#123;</span><span style="color: #000000;">&#125;</span>, n<br /><br /><span style="color: #00C800;">FOR</span> n = <span style="color: #000000;">1</span> <span style="color: #0000ff;">to</span> oText:<span style="color: #000000;">RecCount</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />      AADD<span style="color: #000000;">&#40;</span> aTest,  oText:<span style="color: #000000;">ReadLine</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />      MsgAlert<span style="color: #000000;">&#40;</span> aTest<span style="color: #000000;">&#91;</span>n<span style="color: #000000;">&#93;</span>, <span style="color: #ff0000;">"Array-line : "</span> + ALLTRIM<span style="color: #000000;">&#40;</span>STR<span style="color: #000000;">&#40;</span>n<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />      oText:<span style="color: #000000;">Skip</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><span style="color: #00C800;">NEXT</span><br />oText:<span style="color: #000000;">Close</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br /><span style="color: #00C800;">RETURN</span><span style="color: #000000;">&#40;</span> <span style="color: #00C800;">NIL</span> <span style="color: #000000;">&#41;</span><br /> </div>[/code:1gl27dxu] Line 2 [img:1gl27dxu]http&#58;//www&#46;pflegeplus&#46;com/IMAGES/Array1&#46;jpg[/img:1gl27dxu] best regards Uwe <!-- s:) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":)" title="Smile" /><!-- s:) -->
create an arra from txt file
thanks Uwe, some files.txt are very very big how I can make to have a show text type : " Load level2.txt in n seconds" I try with a timer but it not run good
create an arra from txt file
Silvio, It will be much faster the way you did it--loading the entire file into memory then parsing it, rather than reading each line from the disk. Your coding mistake is here: nLinea :=MLCOUNT(cTexto) Should be: nLinea :=MLCOUNT(cTexto, 81) // was missing the line length I would also suggest setting cTexto to nil right after you are done parsing it so the memory will be recovered.
create an arra from txt file
[code=fw:nt6cb26x]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00C800;">FUNCTION</span> Txt2Array<span style="color: #000000;">&#40;</span> cCAdena, nCaracteres<span style="color: #000000;">&#41;</span><br />  <span style="color: #00C800;">LOCAL</span> aTexto := <span style="color: #000000;">&#123;</span><span style="color: #000000;">&#125;</span>, nCuantos := LEN<span style="color: #000000;">&#40;</span>cCadena<span style="color: #000000;">&#41;</span> / nCaracteres, nBrinco := <span style="color: #000000;">0</span><br />  <span style="color: #00C800;">DEFAULT</span> nCaracteres := <span style="color: #000000;">1</span><br /><br />  nStart := <span style="color: #000000;">1</span>; nxLen := nCaracteres; cxTexto := cCAdena<br />  cTxt := <span style="color: #0000ff;">SUBSTR</span><span style="color: #000000;">&#40;</span> cxTexto, nStart, nxLen <span style="color: #000000;">&#41;</span><br /><br />  <span style="color: #00C800;">DO</span> <span style="color: #00C800;">WHILE</span> nBrinco < nCuantos<span style="color: #B900B9;">/*! EMPTY(cTxt)*/</span><br />    nBrinco++<br /><br />    AADD<span style="color: #000000;">&#40;</span>aTexto, cTxt <span style="color: #000000;">&#41;</span><br />    nStart += nxLen<br />    cTxt := <span style="color: #0000ff;">SUBSTR</span><span style="color: #000000;">&#40;</span> cxTexto, nStart, nxLen <span style="color: #000000;">&#41;</span><br />  <span style="color: #00C800;">ENDDO</span><br /><br /><span style="color: #00C800;">RETURN</span><span style="color: #000000;">&#40;</span>aTexto<span style="color: #000000;">&#41;</span><br /> </div>[/code:nt6cb26x]
create an arra from txt file
James, [quote="James Bott":1k2yibdo]I would also suggest setting cTexto to nil right after you are done parsing it so the memory will be recovered.[/quote:1k2yibdo] Better limit the scope of the variable. EMG
create an arra from txt file
[quote:2r7o63bc]FOpen() Opens a file on the operating system level. Syntax FOpen( <cFileName>, [<nMode>]) --> nFileHandle Arguments <cFilename> This is a character string holding the name of the file to open. It must include path and file extension. If the path is omitted from <cFileName>, the file is searched in the current directory. <nMode> A numeric value specifying the open mode and access rights for the file. #define constants from the FILEIO.CH file can be used for <nMode> as listed in the table below: File open modes Constant Value Description FO_READ *) 0 Open file for reading FO_WRITE 1 Open file for writing FO_READWRITE 2 Open file for reading and writing *) default Constants that define the access or file sharing rights can be added to an FO_* constant. They specify how file access is granted to other applications in a network environment. File sharing modes Constant Value Description FO_COMPAT *) 0 Compatibility mode FO_EXCLUSIVE 16 Exclusive use FO_DENYWRITE 32 Prevent other applications from writing FO_DENYREAD 48 Prevent other applications from reading FO_DENYNONE 64 Allow others to read or write FO_SHARED 64 Same as FO_DENYNONE *) default [/quote:2r7o63bc] [quote:2r7o63bc]FRead() Reads characters from a binary file into a memory variable. Syntax FRead( <nFileHandle>, ; @<cBuffer> , ; <nBytes> , ; [<nOffset>] ) --> nBytesRead Arguments <nFileHandle> This is a numeric file handle returned from function FOpen() or FCreate(). @<cBuffer> A memory variable holding a character string must be passed by reference to FRead(). It must have at least <nBytes> characters. <nBytes> This is a numeric value specifying the number of bytes to transfer from the file into the memory variable <cBuffer>, beginning at the current file pointer position. <nOffset> This is a numeric value specifying the number of bytes to skip at the beginning of <cBuffer> where the result is copied to. This allows to copy the data from the file into the middle of a string buffer. The default value is zero. Note that the sum of <nBytes>+<nOffset> must be smaller than or equal Len(<cBuffer>). [/quote:2r7o63bc] [code=fw:2r7o63bc]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #B900B9;">// The example reads an entire file in blocks of 81 bytes and fills them into an array </span><br /><br />   <span style="color: #00D7D7;">#define</span> BLOCK_SIZE     <span style="color: #000000;">81</span><br /><br />   PROCEDURE Main<br />      <span style="color: #00C800;">LOCAL</span> cBuffer     := Space<span style="color: #000000;">&#40;</span> BLOCK_SIZE <span style="color: #000000;">&#41;</span><br />      <span style="color: #00C800;">LOCAL</span> nFileHandle := FOpen<span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"level1.txt"</span><span style="color: #000000;">&#41;</span><br />      <span style="color: #00C800;">LOCAL</span> aBlocks     := <span style="color: #000000;">&#123;</span><span style="color: #000000;">&#125;</span><br />      <span style="color: #00C800;">LOCAL</span> nRead<br /><br />      <span style="color: #00C800;">IF</span> FError<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <> <span style="color: #000000;">0</span><br />         ? <span style="color: #ff0000;">"Error opening file:"</span>, FERROR<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />         QUIT<br />      <span style="color: #00C800;">ENDIF</span><br /><br />      <span style="color: #00C800;">DO</span> <span style="color: #00C800;">WHILE</span> .T.<br />         nRead := FRead<span style="color: #000000;">&#40;</span> nFileHandle, @cBuffer, BLOCK_SIZE <span style="color: #000000;">&#41;</span><br />         <span style="color: #00C800;">IF</span> nRead == BLOCK_SIZE<br />            AAdd<span style="color: #000000;">&#40;</span> aBlocks, cBuffer <span style="color: #000000;">&#41;</span><br />         <span style="color: #00C800;">ELSE</span><br />            <span style="color: #B900B9;">// end of file reached</span><br />            AAdd<span style="color: #000000;">&#40;</span> aBlocks, <span style="color: #0000ff;">SubStr</span><span style="color: #000000;">&#40;</span>cBuffer,nRead<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />            EXIT<br />         <span style="color: #00C800;">ENDIF</span><br />      <span style="color: #00C800;">ENDDO</span><br /><br />      FClose<span style="color: #000000;">&#40;</span> nFileHandle <span style="color: #000000;">&#41;</span><br />      ? Len<span style="color: #000000;">&#40;</span> aBlocks <span style="color: #000000;">&#41;</span>, <span style="color: #ff0000;">"Blocks of"</span>, BLOCK_SIZE, <span style="color: #ff0000;">"bytes read"</span><br />   <span style="color: #00C800;">RETURN</span><br /><br /> </div>[/code:2r7o63bc]
create an arra from txt file
[code=fw:33a3bo4a]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #B900B9;">//Test program with Str2Array() function.</span><br /><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"fivewin.ch"</span><br /><br /><span style="color: #00C800;">Function</span> Main<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />   <span style="color: #00C800;">local</span> cFile:=<span style="color: #ff0000;">"level1.txt"</span>, cText:=<span style="color: #ff0000;">""</span>, aArray<br />   <span style="color: #00C800;">local</span> nLineLength:=<span style="color: #000000;">81</span><br />   <span style="color: #00C800;">local</span> cSample:=<span style="color: #ff0000;">""</span><br />            <br />   <span style="color: #B900B9;">// Create the sample file</span><br />   cSample:= cSample+<span style="color: #ff0000;">"001700509573024106800501002700295018009400305652800007465080071000159004908007053"</span>+CRLF<br />   cSample:= cSample+<span style="color: #ff0000;">"029650178705180600100900500257800309600219005900007046573400021800020453010395000"</span>+CRLF<br />   cSample:= cSample+<span style="color: #ff0000;">"008203500009670408346050702430010059967005001000496203280034067703500904004107020"</span>+CRLF<br />   cSample:= cSample+<span style="color: #ff0000;">"800005216045862007670009500769204030020001765001670009004096800907400601306107940"</span>+CRLF<br />   memowrit<span style="color: #000000;">&#40;</span> cFile, cSample<span style="color: #000000;">&#41;</span><br /><br />   <span style="color: #B900B9;">// Read the file</span><br />   cText  := Memoread<span style="color: #000000;">&#40;</span>cFile<span style="color: #000000;">&#41;</span><br />   <br />   <span style="color: #B900B9;">// convert to an array with line </span><br />   aArray:= str2Array<span style="color: #000000;">&#40;</span> cText, nLinelength <span style="color: #000000;">&#41;</span><br />   <br />   <span style="color: #0000ff;">msgInfo</span><span style="color: #000000;">&#40;</span> len<span style="color: #000000;">&#40;</span>aArray<span style="color: #000000;">&#41;</span>,<span style="color: #ff0000;">"Length of array"</span><span style="color: #000000;">&#41;</span><br />   <br />   <span style="color: #0000ff;">msgInfo</span><span style="color: #000000;">&#40;</span> aArray<span style="color: #000000;">&#91;</span><span style="color: #000000;">1</span><span style="color: #000000;">&#93;</span>,<span style="color: #ff0000;">"First element of array"</span><span style="color: #000000;">&#41;</span><br />   <br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br /><br />   <br /><span style="color: #00C800;">Function</span> str2Array<span style="color: #000000;">&#40;</span> cText, nLineLength <span style="color: #000000;">&#41;</span><br />   <span style="color: #00C800;">local</span> aArray:=<span style="color: #000000;">&#123;</span><span style="color: #000000;">&#125;</span><br />   <span style="color: #00C800;">local</span> cLine:=<span style="color: #ff0000;">""</span><br />   <span style="color: #00C800;">local</span> nLines := MLCOUNT<span style="color: #000000;">&#40;</span> cText, nLineLength <span style="color: #000000;">&#41;</span> <br /><br />   <span style="color: #00C800;">for</span> n=<span style="color: #000000;">1</span> <span style="color: #0000ff;">to</span> nLines<br />      cLine:=MEMOLINE<span style="color: #000000;">&#40;</span>cText,nLineLength,n<span style="color: #000000;">&#41;</span><br />      AADD<span style="color: #000000;">&#40;</span>aArray,cLine<span style="color: #000000;">&#41;</span><br />   <span style="color: #00C800;">next</span><br />   <br /><span style="color: #00C800;">Return</span> aArray</div>[/code:33a3bo4a]
create and use an index for a set of records
Hi to all Given a list of records ( see array aRecord ) , does exist a faster way to create a temporary index containing only these records? Thank in advance? Marco #include "fivewin.ch" ANNOUNCE RDDSYS FUNCTION MAIN LOCAL nIni SET DELETED ON SET EXCLUSIVE OFF USE clihs PUBLIC aRecord := { 985 , 10754 , 22456 , 23677 , 23679 , 32121 , 35109 , 38372 , 43872 } PUBLIC nRecI := 1 PUBLIC nRecF := 9 PUBLIC nRecC := 1 PUBLIC lWhile := .T. nIni := SECONDS() INDEX ON field->clifor TAG ARECORD TO CLIFOR_REC FOR punta_record() WHILE M->lWhile browse() RETURN NIL FUNCTION PUNTA_RECORD() LOCAL lReturn := .F. DBGOTO( M->aRecord[ M->nRecC ] ) IF M->nRecC < M->nRecf M->nRecC ++ lReturn := .T. ELSE GO BOTTOM M->lWhile := .F. ENDIF RETURN lReturn INIT PROCEDURE RddInit REQUEST DBFFPT REQUEST DBFCDX rddSetDefault( "DBFCDX" ) RETURN
create and use an index for a set of records
I'm sorry This is the source working sample code #include "fivewin.ch" ANNOUNCE RDDSYS REQUEST HB_GT_GUI_DEFAULT STATIC aRecord STATIC nRecF STATIC nRecC STATIC lWhile FUNCTION MAIN SET DELETED ON SET EXCLUSIVE OFF USE clihs aRecord := { 100 , 200 , 300 , 400 , 500 , 600 , 700 , 800, 900 , 1000, 1100 } nRecF := LEN( aRecord ) nRecC := 1 lWhile := .T. GOTO aRecord[ 1 ] INDEX ON field->clifor TAG ARECORD TO CLIFOR_REC WHILE punta_record() GO TOP BROWSE() RETURN NIL FUNCTION PUNTA_RECORD() LOCAL lRitorna := .F. IF nRecC <= nRecF GOTO aRecord[ nRecC ] nRecC ++ lRitorna := .T. ELSE lWhile := .F. ENDIF RETURN lRitorna INIT PROCEDURE RddInit REQUEST DBFFPT REQUEST DBFCDX rddSetDefault( "DBFCDX" ) RETURN
create and use an index for a set of records
Marco, The simplest solution would be to move all the record data into the array and then browse the array. The next simplest would be to create a database class that has a modified skip() method that uses the array as an index. The set the oBrw:bSkip codeblock to use this database skip method. The most complicated way would be to write functions to work with standard DBF commands that use the array as an index. Regards, James
create and use an index for a set of records
Marco, The INDEX command has a clause CUSTOM : CUSTOM specifies that a custom built order will be created for RDDs that support them. A custom built order is initially empty, giving you complete control over order maintenance. The system does not automatically add and delete keys from a custom built order. Instead, you explicitly add and delete keys using ORDKEYADD() and ORDKEYDEL(). This capability is excellent for generating pick lists of specific records and other custom applications. I never used it , but i suppose you have to [code=fw:1jopxsfy]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00C800;">LOCAL</span> aRecord := <span style="color: #000000;">&#123;</span> <span style="color: #000000;">985</span> , <span style="color: #000000;">10754</span> , <span style="color: #000000;">22456</span> , <span style="color: #000000;">23677</span> , <span style="color: #000000;">23679</span> , <span style="color: #000000;">32121</span> , <span style="color: #000000;">35109</span> , <span style="color: #000000;">38372</span> , <span style="color: #000000;">43872</span> <span style="color: #000000;">&#125;</span> , nRecord<br /><br /><span style="color: #0000ff;">INDEX</span> <span style="color: #0000ff;">ON</span> field->clifor TAG ARECORD CUSTOM<span style="color: #B900B9;">//TO CLIFOR_REC FOR punta_record() WHILE M->lWhile</span><br /><span style="color: #00C800;">FOR</span> EACH nRecord In aRecord<br />    GOTO nRecord<br />    OrdKeyAdd<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><span style="color: #00C800;">NEXT</span><br />browse<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br /><br /> </div>[/code:1jopxsfy]
create and use an index for a set of records
COOL! Thank you so much Frank
create and use an index for a set of records
James, your solution is very interesting too Thank you
create and use an index for a set of records
Marco, Well, Frank's solution looks easier. I was not aware of the CUSTOM clause. Let us know what solution you use. Regards, James
create and use an index for a set of records
[quote:5evhg3gn]The INDEX command has a clause CUSTOM :[/quote:5evhg3gn] This is the best way to deal with a hand-picked set of records. Along with CUSTOM clause, also if we use TEMPORARY ( or MEMORY ) clause, the index is created locally in the memory or temporary space ( depending on RDD ) and is even faster and is automatically erased when the table is closed. This is what I do in my programs where this is necessary. Incidentally, if the only intention is to browse the record numbers in an array, xbrowse provides even much simpler way to do this, even without creating any index, custom or otherwise. Use the normal syntax for creating xbrowse for the DBF and add the clause ROWS aRecArray. Only the record numbers in the aRecArray are browsed. Example: [code=fw:5evhg3gn]<div class="fw" id="{CB}" style="font-family: monospace;"><br />@ <span style="color: #000000;">0</span>,<span style="color: #000000;">0</span> <span style="color: #0000ff;">XBROWSE</span> oBrw <span style="color: #0000ff;">OF</span> oWnd AUTCOLS <span style="color: #0000ff;">ALIAS</span> <span style="color: #ff0000;">"CUSTOMER"</span> ROWS <span style="color: #000000;">&#123;</span> <span style="color: #000000;">22</span>, <span style="color: #000000;">44</span>, <span style="color: #000000;">66</span> <span style="color: #000000;">&#125;</span><br />&nbsp;</div>[/code:5evhg3gn]
create and use an index for a set of records
Everything comes from the fact that a function like this at_search() free searches in a table is very much faster than traditional methods. The function returns an array containing the records that I find the string passed as parameter. I put this function in a application that run in a server (search32.exe) in polling mode. Result of every request from clients is an index creation or an Array containing matching record. #include "fivewin.ch" #include "FileIO.ch" ANNOUNCE RDDSYS #define crlf CHR(13)+CHR(10) // parameters: dbf file to open and string to search with .AND. clause ( not words but strings! ) FUNCTION MAIN() LOCAL aRecord := {} LOCAL i LOCAL cRecords := "" LOCAL nRecord aRecord := at_search( "clifor", "COMPUTER", "PADOVA" ) FOR i := 1 TO LEN( aRecord ) cRecords := cRecords + " " + ALLTRIM( STR(aRecord[i]) ) NEXT i ? cRecords USE clifor INDEX ON recno() TAG COD_CLI CUSTOM TO clifor_rec FOR EACH nRecord In aRecord GOTO nRecord OrdKeyAdd() NEXT // open browse to monitor GO TOP browse() RETURN NIL FUNCTION AT_SEARCH( cFile , cString1 , cString2, cString3, cString4 ) LOCAL iW1, iW2 LOCAL cStringa LOCAL cIndRec := cFile + "_rec" LOCAL nHandle LOCAL nSize LOCAL nRead LOCAL nPosRec LOCAL nHead, nRecSize LOCAL nPosStart := 0 LOCAL nPosRecord := 0 LOCAL aPosRec1 := {} LOCAL aPosRec2 := {} LOCAL aString := {} LOCAL nAndOr := 1 LOCAL aRecord := {} LOCAL cTrova := "" LOCAL nFound LOCAL cRecord LOCAL nPos2 LOCAL nIni := SECONDS() LOCAL lDeleted SET DELETED OFF SET EXCLUSIVE OFF // load an array with strings to search IF cString1 <> NIL ; AADD( aString , cString1 ) ; ENDIF IF cString2 <> NIL ; AADD( aString , cString2 ) ; ENDIF IF cString3 <> NIL ; AADD( aString , cString3 ) ; ENDIF IF cString4 <> NIL ; AADD( aString , cString4 ) ; ENDIF // open and read all dbf file into cStringa variable nHandle := FOPEN( cFile + ".dbf" ) nSize := FSeek( nHandle, 0, FS_END ) FSeek( nHandle, -nSize, FS_RELATIVE ) cStringa := SPACE( nSize ) nRead := FRead( nHandle, @cStringa, nSize ) FCLOSE( nHandle ) // open with use commands to obtain header and recsize USE &cFile nHead := header() nRecSize := recsize() USE nPosRec := 1 nFound := 0 iW1 := 1 iW2 := 1 nPosStart := 1 // enter in a loop to begin search operations DO WHILE .T. // search counter nFound := 0 // aPosrec1 contain in position 1 the absolute position in cStringa and in position // 2 the calculated record aPosRec1 := ATREC( aString[ 1 ] , cStringa , nPosStart, nHead, nRecSize ) IF aPosRec1[ 1 ] > 0 // if the first string to search is founded... // if a * is present record is deleted lDeleted := IIF(SUBSTR( cStringa , nHead + nRecSize * ( aPosrec1[ 2 ] -1) +1 , 1 ) = "*", .T., .F. ) IF .NOT. lDeleted // start position for next search is the beginning of record nPosStart := aPosRec1[1] + 1 // IF there are other strings to search IF LEN( aString ) > 1 // first string has been founded nFound ++ // create a string containing only the actual record nPosRecord := nHead + nRecSize * ( aPosrec1[ 2 ] - 1 ) + 2 cRecord := SUBSTR( cStringa , nPosRecord , nRecSize ) // pointer for second string to search iW2 := 2 DO WHILE .T. // I search the second string only in the record string (more little) nPos2 := AT( aString[ iW2 ] , cRecord ) IF nPos2 > 0 // second string is founded nFound ++ ELSE // if not found exit from loop EXIT ENDIF // if there are other strings to search increment pointer of 1 IF iW2 < LEN( aString ) iW2 ++ ELSE // otherwise exit EXIT ENDIF ENDDO // at the exit of loop IF all strings are founded I add record number to aRecord Array IF nFound = LEN( aString ) AADD( aRecord , aPosRec1[2] ) ENDIF nPosStart ++ ELSE // there is only one string to search AADD( aRecord , aPosRec1[2] ) ENDIF ELSE nPosStart := nPosStart + nHead + nRecSize ENDIF ELSE EXIT ENDIF ENDDO ? SECONDS() - nIni RETURN aRecord FUNCTION ATREC( cTesto , cStringa , nStart, nHead, nRecSize ) LOCAL nPos := 0 LOCAL nRecord := 0 nPos := AT( cTesto , cStringa , nStart ) IF nPos > 0 nRecord := INT( ( nPos - nHead ) / nRecSize ) + 1 ENDIF RETURN { nPos, nRecord } FUNCTION DbfSize() RETURN ( (RecSize() * LastRec()) + Header() + 1 ) INIT PROCEDURE RddInit REQUEST DBFFPT REQUEST DBFCDX rddSetDefault( "DBFCDX" ) RETURN
create and use an index for a set of records
Is to do a search in a field specific database? Thank Dorneles
create and use an index for a set of records
No this is a wild search in all fields of database. For instance if You considere cutomer.dbf from fwh\samples change Main function on this way even if the table is not the best example to appreciate the potential of this function. Customer table is too little. I search customer name "Tom" that live in a "Street" aRecord := at_search( "customer", "Tom", "Street" ) Please try this function in a your big big table Thanks Marco FUNCTION MAIN() LOCAL aRecord := {} LOCAL i LOCAL cRecords := "" LOCAL nRecord aRecord := at_search( "customer", "Tom", "Street" ) FOR i := 1 TO LEN( aRecord ) cRecords := cRecords + " " + ALLTRIM( STR(aRecord[i]) ) NEXT i ? cRecords USE customer INDEX ON recno() TAG COD_CLI CUSTOM TO cust_rec FOR EACH nRecord In aRecord GOTO nRecord OrdKeyAdd() NEXT // open browse to monitor GO TOP browse() RETURN NIL
create database SQL Server
Hello, After installing SQL Express server, I need to create the main database, without the Management Studio Express. Is it posible?. Thank you so much.
create database SQL Server
Lucas Here is a snipit from one of my install programs .. Rick Lipkin [code=fw:2cqyvdvy]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00C800;">Try</span><br />&nbsp; &nbsp; &nbsp;oCn &nbsp;:= CREATEOBJECT<span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"ADODB.Connection"</span> <span style="color: #000000;">&#41;</span><br />&nbsp; Catch<br />&nbsp; &nbsp; &nbsp;Saying := <span style="color: #ff0000;">"Could not create an ADO COnnection"</span><br />&nbsp; &nbsp; &nbsp;<span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">&#40;</span> Saying <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp;oDLG:<span style="color: #000000;">End</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp;<span style="color: #00C800;">Return</span><span style="color: #000000;">&#40;</span>.f.<span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;End <span style="color: #00C800;">Try</span><br /><br />&nbsp; &nbsp;<span style="color: #B900B9;">// assumes database has been created </span><br />&nbsp; &nbsp;<span style="color: #B900B9;">// and you want to add tables</span><br /><br />&nbsp; &nbsp;<span style="color: #00C800;">TRY</span><br />&nbsp; &nbsp; &nbsp;oCn:<span style="color: #000000;">Open</span><span style="color: #000000;">&#40;</span> xCONNECT <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; CATCH oErr<br />&nbsp; &nbsp; &nbsp; Saying := <span style="color: #ff0000;">"Sorry .. It does not appear the database "</span>+xCatalog+chr<span style="color: #000000;">&#40;</span><span style="color: #000000;">10</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; Saying += <span style="color: #ff0000;">"Exists on Sql Server "</span>+xSource+chr<span style="color: #000000;">&#40;</span><span style="color: #000000;">10</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; Saying += <span style="color: #ff0000;">"Please contact your Sql Server DBA"</span>+chr<span style="color: #000000;">&#40;</span><span style="color: #000000;">10</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">&#40;</span> Saying <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; oDLG:<span style="color: #000000;">End</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; <span style="color: #00C800;">RETURN</span><span style="color: #000000;">&#40;</span>.F.<span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;END <span style="color: #00C800;">TRY</span><br /><br />&nbsp; &nbsp;oCn:<span style="color: #000000;">Close</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;oCn := <span style="color: #00C800;">nil</span><br /><br />&nbsp; &nbsp;oRs := TOleAuto<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"ADODB.Recordset"</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;oRs:<span style="color: #000000;">CursorType</span> &nbsp; &nbsp; := <span style="color: #000000;">1</span> &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #B900B9;">// opendkeyset</span><br />&nbsp; &nbsp;oRs:<span style="color: #000000;">CursorLocation</span> := <span style="color: #000000;">3</span> &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #B900B9;">// local cache</span><br />&nbsp; &nbsp;oRs:<span style="color: #000000;">LockType</span> &nbsp; &nbsp; &nbsp; := <span style="color: #000000;">3</span> &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #B900B9;">// lockoportunistic</span><br /><br />&nbsp; &nbsp;<span style="color: #B900B9;">// check for very first table</span><br /><br />&nbsp; &nbsp;cSQL := <span style="color: #ff0000;">"SELECT * FROM USERINFO"</span><br />&nbsp; &nbsp;<span style="color: #00C800;">TRY</span><br />&nbsp; &nbsp; &nbsp; oRs:<span style="color: #000000;">Open</span><span style="color: #000000;">&#40;</span> cSQL, xCONNECT <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;CATCH oErr<br />&nbsp; &nbsp; &nbsp; Saying := <span style="color: #ff0000;">"WARNING .. the Database File "</span>+xSource+chr<span style="color: #000000;">&#40;</span><span style="color: #000000;">10</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; Saying += <span style="color: #ff0000;">"appears to exist, however the Tables have not been created"</span>+chr<span style="color: #000000;">&#40;</span><span style="color: #000000;">10</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; Saying += <span style="color: #ff0000;">"If this is your First time using this Program ..."</span>+chr<span style="color: #000000;">&#40;</span><span style="color: #000000;">10</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; Saying += <span style="color: #ff0000;">"Please proceed, otherwise contact your Administrator"</span>+chr<span style="color: #000000;">&#40;</span><span style="color: #000000;">10</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; Saying += <span style="color: #ff0000;">" "</span>+chr<span style="color: #000000;">&#40;</span><span style="color: #000000;">10</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; Saying += <span style="color: #ff0000;">"Do you wish to proceed to create the NEW Database &nbsp;Tables ?"</span>+chr<span style="color: #000000;">&#40;</span><span style="color: #000000;">10</span><span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; &nbsp; <span style="color: #00C800;">If</span> MsgNoYes<span style="color: #000000;">&#40;</span> saying <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;lCreate := .t.<br />&nbsp; &nbsp; &nbsp; <span style="color: #00C800;">Else</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;oDlg:<span style="color: #000000;">End</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #00C800;">Return</span><span style="color: #000000;">&#40;</span>.f.<span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; <span style="color: #00C800;">Endif</span><br />&nbsp; &nbsp;End <span style="color: #00C800;">Try</span><br /><br />&nbsp; &nbsp;oRs:<span style="color: #000000;">CLose</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;oRs := <span style="color: #00C800;">nil</span><br /><br />&nbsp; &nbsp;lCreate := .f.<br /><br />End <span style="color: #00C800;">Case</span><br /><br /><span style="color: #00C800;">If</span> lCreate = .t.<br /><br />&nbsp; &nbsp;<span style="color: #B900B9;">// create tables</span><br />&nbsp; &nbsp;<span style="color: #00C800;">Try</span><br />&nbsp; &nbsp; &nbsp;oCn &nbsp;:= CREATEOBJECT<span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"ADODB.Connection"</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;Catch<br />&nbsp; &nbsp; &nbsp;<span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"Could not create the ADO object for connection"</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp;oDLG:<span style="color: #000000;">End</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp;<span style="color: #00C800;">Return</span><span style="color: #000000;">&#40;</span>.f.<span style="color: #000000;">&#41;</span><br />&nbsp; End <span style="color: #00C800;">Try</span><br /><br />&nbsp; &nbsp;<span style="color: #00C800;">TRY</span><br />&nbsp; &nbsp; &nbsp;oCn:<span style="color: #000000;">Open</span><span style="color: #000000;">&#40;</span> xCONNECT <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;CATCH oErr<br />&nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"Could not open a Connection to Database "</span>+xSource <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; oDLG:<span style="color: #000000;">End</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; <span style="color: #00C800;">RETURN</span><span style="color: #000000;">&#40;</span>.F.<span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;END <span style="color: #00C800;">TRY</span><br /><br />&nbsp; &nbsp;cSQL := <span style="color: #ff0000;">"CREATE TABLE UserInfo"</span><br />&nbsp; &nbsp;cSQL += <span style="color: #ff0000;">"( "</span><br />&nbsp; &nbsp;cSQL += <span style="color: #ff0000;">"[USEREID] &nbsp; char(18) NOT NULL, "</span><br />&nbsp; &nbsp;cSQL += <span style="color: #ff0000;">"[USERID] &nbsp; &nbsp;char(25) NULL, "</span><br />&nbsp; &nbsp;cSQL += <span style="color: #ff0000;">"[LNAME] &nbsp; &nbsp; char(15) NULL, "</span><br />&nbsp; &nbsp;cSQL += <span style="color: #ff0000;">"[FNAME] &nbsp; &nbsp; char(1) &nbsp;NULL, "</span><br />&nbsp; &nbsp;cSQL += <span style="color: #ff0000;">"[READONLY] &nbsp;char(1) NULL, "</span><br />&nbsp; &nbsp;cSQL += <span style="color: #ff0000;">"[WRITEONLY] char(1) NULL, "</span><br />&nbsp; &nbsp;cSQL += <span style="color: #ff0000;">"[SUPER] &nbsp; &nbsp; char(1) NULL, "</span><br />&nbsp; &nbsp;cSQL += <span style="color: #ff0000;">"[ADMIN] &nbsp; &nbsp; char(1) NULL, "</span><br />&nbsp; &nbsp;cSQL += <span style="color: #ff0000;">"[ENTRYBY] &nbsp; char(25) NULL, "</span><br />&nbsp; &nbsp;cSQL += <span style="color: #ff0000;">"[ENTRYDATE] DATETIME NULL, "</span><br />&nbsp; &nbsp;cSQL += <span style="color: #ff0000;">"[LASTLOG] &nbsp; DATETIME NULL, "</span><br />&nbsp; &nbsp;cSQL += <span style="color: #ff0000;">"[PASSWORD] &nbsp;char(16) NULL, "</span><br />&nbsp; &nbsp;cSQL += <span style="color: #ff0000;">"[UPDATED] SMALLINT DEFAULT 0, "</span><br />&nbsp; &nbsp;cSQL += <span style="color: #ff0000;">"CONSTRAINT PK_USERINFO PRIMARY KEY ( USEREID )"</span><br />&nbsp; &nbsp;cSQL += <span style="color: #ff0000;">" )"</span><br /><br />&nbsp; &nbsp;<span style="color: #B900B9;">// create the table Userinfo</span><br />&nbsp; &nbsp;<span style="color: #B900B9;">// with primary key</span><br /><br />&nbsp; &nbsp;<span style="color: #00C800;">Try</span><br />&nbsp; &nbsp; &nbsp; oCn:<span style="color: #000000;">Execute</span><span style="color: #000000;">&#40;</span> cSQL <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;Catch<br />&nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"Create Table USERINFO Failed"</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; oDLG:<span style="color: #000000;">End</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; <span style="color: #00C800;">Return</span><span style="color: #000000;">&#40;</span>.f.<span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;End <span style="color: #00C800;">try</span><br /><br />&nbsp; &nbsp;cSay := <span style="color: #ff0000;">"Created Table Userinfo"</span><br />&nbsp; &nbsp;oSay:<span style="color: #0000ff;">ReFresh</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;SysReFresh<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp;oCn:<span style="color: #000000;">Close</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />&nbsp;</div>[/code:2cqyvdvy]
create database SQL Server
Thank you, but my mistake, I need to create the database, not the tables. Sorry.
create database SQL Server
Connect without initial catalog Execute the sql statement "CREATE DATABASE MYDATA", with oCn:Execute( cSql )
create database SQL Server
Thank You ver y much. Andrés is It posible to add a user to the Sql server?. Thank you
create database SQL Server
oCn:Execute( "CREATE USER <name> WITH PASSWORD = '<password>'" ) <!-- m --><a class="postlink" href="http://technet.microsoft.com/en-us/library/ms173463.aspx">http://technet.microsoft.com/en-us/libr ... 73463.aspx</a><!-- m -->
create file PDF
Hi I want to create a report with FW1412 in PDF format When I select the CREATE PDF option, the program does nothing. Can someone give me a tip? What do I have to do ? Thanks.
create file PDF
The simplest solution would be to upgrade your FWH as it has evolved very much from the version that you are using <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) -->
create file PDF
OK Linaraes What is the price of the last version of fivewin and what is the version number ? Can i buy from you directly? How is the payment method? Thanks
create file PDF
> What is the price of the last version of fivewin and what is the version number ? Current FWH is version 16.11 The upgrade price is 170 euros. > Can i buy from you directly? > How is the payment method? Yes, of course. You may order it from <!-- w --><a class="postlink" href="http://www.fivetechsoft.com">www.fivetechsoft.com</a><!-- w --> using your credit card, alternatively you may pay it using PayPal to <!-- e --><a href="mailto:alinares@fivetechsoft.com">alinares@fivetechsoft.com</a><!-- e -->
create group on report class
Hi Friends I have coded one report with two groups (using the class report) Its is possible to create an third group at runtime and the same time can destroy it before the end of the report? Thanks in advance!
create group on report class
If the reason you want to do this is because you only want to use the third group for some versions of the report, you could just define the third group with a conditional. IF ... GROUP ON ... ENDIF Regards, James
create group on report class
James not all the reports can be make with two groups I should evaluate each register of the table in runtime. this is my code but i get the message: TRGroup does not exist [quote:ozly6mnz]REPORT oRpt ; ... GROUP oGrp1 ; ON Left(TMP->Cuenta,2) ; HEADER Left(TMP->Cuenta,2)+' '+ACONCUE->Descrip; FOOTER 'Total :' ; FONT 5 GROUP oGrp2 ; ON Left(TMP->Cuenta,4) ; HEADER Left(TMP->Cuenta,4)+' '+ACONCUE->Descrip; FOOTER 'SubTotal :' ; FONT 5 COLUMN TITLE " ","Cuenta" ; DATA TMP->CUENTA ; FONT 2 SIZE 9 COLUMN TITLE " ","Ruc" ; DATA TMP->Ruc ; FONT 2 SIZE 15 aadd(oRpt:aGroups, oRpt:aGroups[3]) ... ... ACTIVATE REPORT oRpt ; ON STARTGROUP iif(len(tmp->cuentat)=8,createnewgroup(),); ON ENDGROUP iif(len(oRpt:aGroups)=3, eval({||oRpt:Delgroup(3), oRpt:Stabilize() }),) END REPORT Static Function createnewgroup() oGrp3:= TRGroup:New({|| tmp->cuenta }, {|| tmp->cuenta+" "+aconcue->descrip}, {|| "Subtotal" }, , , oRpt) // Abort TRGroup does not exist oRpt:Stabilize() Return Nil [/quote:ozly6mnz]
create group on report class
Sorry i send it again [code=fw:icej20lf]<div class="fw" id="{CB}" style="font-family: monospace;">James<br />not all the reports can be make with two groups<br />I should evaluate each register <span style="color: #0000ff;">of</span> the table in runtime. <br /><br />this is my code but i <span style="color: #0000ff;">get</span> the <span style="color: #0000ff;">message</span>: <span style="color: #000000;">TRGroup</span> does not exist<br /><br /><span style="color: #000000;">&#91;</span>quote<span style="color: #000000;">&#93;</span>REPORT oRpt &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;<br />&nbsp; &nbsp; ...<br />&nbsp; &nbsp; GROUP oGrp1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">ON</span> <span style="color: #0000ff;">Left</span><span style="color: #000000;">&#40;</span>TMP->Cuenta,<span style="color: #000000;">2</span><span style="color: #000000;">&#41;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;;<br />&nbsp; &nbsp; &nbsp; &nbsp; HEADER <span style="color: #0000ff;">Left</span><span style="color: #000000;">&#40;</span>TMP->Cuenta,<span style="color: #000000;">2</span><span style="color: #000000;">&#41;</span>+<span style="color: #ff0000;">' '</span>+ACONCUE->Descrip;<br />&nbsp; &nbsp; &nbsp; &nbsp; FOOTER <span style="color: #ff0000;">'Total :'</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">FONT</span> <span style="color: #000000;">5</span><br /><br />&nbsp; &nbsp; GROUP oGrp2 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">ON</span> <span style="color: #0000ff;">Left</span><span style="color: #000000;">&#40;</span>TMP->Cuenta,<span style="color: #000000;">4</span><span style="color: #000000;">&#41;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;;<br />&nbsp; &nbsp; &nbsp; &nbsp; HEADER <span style="color: #0000ff;">Left</span><span style="color: #000000;">&#40;</span>TMP->Cuenta,<span style="color: #000000;">4</span><span style="color: #000000;">&#41;</span>+<span style="color: #ff0000;">' '</span>+ACONCUE->Descrip;<br />&nbsp; &nbsp; &nbsp; &nbsp; FOOTER <span style="color: #ff0000;">'SubTotal :'</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">FONT</span> <span style="color: #000000;">5</span><br /><br />&nbsp; &nbsp; &nbsp; COLUMN <span style="color: #0000ff;">TITLE</span> <span style="color: #ff0000;">" "</span>,<span style="color: #ff0000;">"Cuenta"</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00C800;">DATA</span> TMP->CUENTA &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">FONT</span> <span style="color: #000000;">2</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">9</span><br /><br />&nbsp; &nbsp; &nbsp; COLUMN <span style="color: #0000ff;">TITLE</span> <span style="color: #ff0000;">" "</span>,<span style="color: #ff0000;">"Ruc"</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00C800;">DATA</span> TMP->Ruc &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">FONT</span> <span style="color: #000000;">2</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">15</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; aadd<span style="color: #000000;">&#40;</span>oRpt:<span style="color: #000000;">aGroups</span>, oRpt:<span style="color: #000000;">aGroups</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">3</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; ... &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; ...<br /><br />&nbsp; &nbsp; &nbsp;<span style="color: #0000ff;">ACTIVATE</span> REPORT oRpt ;<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">ON</span> STARTGROUP iif<span style="color: #000000;">&#40;</span>len<span style="color: #000000;">&#40;</span>tmp->cuentat<span style="color: #000000;">&#41;</span>=<span style="color: #000000;">8</span>,createnewgroup<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>,<span style="color: #000000;">&#41;</span>;<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">ON</span> ENDGROUP iif<span style="color: #000000;">&#40;</span>len<span style="color: #000000;">&#40;</span>oRpt:<span style="color: #000000;">aGroups</span><span style="color: #000000;">&#41;</span>=<span style="color: #000000;">3</span>, eval<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#123;</span>||oRpt:<span style="color: #000000;">Delgroup</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">3</span><span style="color: #000000;">&#41;</span>, oRpt:<span style="color: #000000;">Stabilize</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span><span style="color: #000000;">&#41;</span>,<span style="color: #000000;">&#41;</span><br /><br />END REPORT<br /><br /><br /><span style="color: #00C800;">Static</span> <span style="color: #00C800;">Function</span> createnewgroup<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />oGrp3:= TRGroup:<span style="color: #00C800;">New</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#123;</span>|| tmp->cuenta <span style="color: #000000;">&#125;</span>, <span style="color: #000000;">&#123;</span>|| tmp->cuenta+<span style="color: #ff0000;">" "</span>+aconcue->descrip<span style="color: #000000;">&#125;</span>, <span style="color: #000000;">&#123;</span>|| <span style="color: #ff0000;">"Subtotal"</span> <span style="color: #000000;">&#125;</span>, , , oRpt<span style="color: #000000;">&#41;</span> <span style="color: #B900B9;">// Abort TRGroup does not exist</span><br />oRpt:<span style="color: #000000;">Stabilize</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><span style="color: #00C800;">Return</span> <span style="color: #00C800;">Nil</span><br /><span style="color: #000000;">&#91;</span>/quote<span style="color: #000000;">&#93;</span></div>[/code:icej20lf]
create mind blowing ai art in 5 minutes for free
[url:2zxxkftz]https&#58;//medium&#46;com/codex/how-i-create-mind-blowing-ai-art-in-5-minutes-for-free-7456e778c543[/url:2zxxkftz]
create object y Ocx
Estimados... Tengo un OCX de 32 bits que resgistre sin problemas en windows 64 bits Try xCtrl:=CreateObject(OCXSAM350.Ocxsam350Ctrl.1) Catch MsgAlert("Error de carga de controlador") Return Nil End MsgAlert(ValType(xCtrl)) // Devuelve "O", correcto // Aqui Todo Correcto MsgAlert(xCtrl:Fecha) //-> WinOle 1007 error de argumento xCtrl:AboutVox() //-> WinOle 1009 No exported Method Segun Manuales los variables son FECHA,HORA, ESTADO.... Funciones serian, INIT, FINI, ABOUTBOX.... Si reviso su nombre en el editor de registro, esta bien, si reviso sus variables y funciones con OleView y OleBrow, hay coincidencia en nombres de variables y funciones, o sea todo correcto.... Y aqui estoy sin pillarle la vuelta, Cualquier consejo, ayuda sera bienvenida.. Gracias Desde Chile Adolfo
create object y Ocx
Prueba con "Date" en vez de "Fecha" Escribiste AboutBox() con "v", o es al escribirlo en tu mensaje ?
create object y Ocx
Puedes inspeccionarlo con la utilidad que publiqué aqui: <!-- l --><a class="postlink-local" href="http://forums.fivetechsupport.com/viewtopic.php?p=144649#p144649">viewtopic.php?p=144649#p144649</a><!-- l -->
create object y Ocx
Gracias por la respuesta Antonio... Si ya lo inspeccione con OleBrow... SI, tenia un error de tipeo, ahora AboutBox, retorna el mismo error 1007, de error de argumento, a pesar que OleBrow dice : STDCALL dispatch FUNX void AboutBox() EL ocx fue creado en Chile, todos las variables estan en español. Algun otro consejo.. Desde Chile Adolfo
create object y Ocx
Prueba a pasarle valores distintos a AboutBox()
create object y Ocx
Probe con AboutBox() AboutBox("C") AboutBox(1) AboutBox(Chr(13)) AboutBox(Nil) El mismo error... WinOle 1007 Argument Error:AboutBox Y ni siquiera puedo obtener el codigo de estado del periferico que se encuentra en la variable ESTADO Aqui el OCX [url:2g2srx0f]https&#58;//dl&#46;dropboxusercontent&#46;com/u/26565274/ocxsam350&#46;ocx[/url:2g2srx0f] El nombre del OCX es "OCXSAM350.Ocxsam350Ctrl.1" En los Win64 se copia en Windows/Syswow64, y se registra son REGSVR32 OCXSAM32, en consola con derechos de administrador Por si alguien puede a lo menos obtener el valor de las variables o ejecutar el AboutBox Gracias de antemano Desde Chile Adolfo
create object y Ocx
Adolfo, A mi me aparece este error al intentar registrarlo: [img:7cos5481]https&#58;//bitbucket&#46;org/fivetech/screenshots/downloads/ocx_error&#46;JPG[/img:7cos5481]
create object y Ocx
Antonio... La llamada al simbolo de sistema debe ser con derechos de administrador, es decir, ejecutar como administrador. Si no sale ese error. Probado en Win7 y win10, y lo registra sin problemas asi.
create object y Ocx
adolfo, puede que si o puede que no, pero te puede ayudar: una vez registré un ocx en syswow64, pero también tuve que hacerlo en el system32, así que copia y registra tu ocx en system32, fue la única forma para que funcionara un programa hecho en otro lenguaje. saludos