topic
stringlengths 1
63
| text
stringlengths 1
577k
⌀ |
---|---|
necesito solucionar esto de FIELDS en listbox
|
la definicion de un listbox (para poder usarlo en una TW) es:
redefine listbox oListBox;
fields columna(1),;
columna(2),..
....
Ahora bien, estoy queriendo hacer una libreria donde esos "fields" varien en cantidad, o sea, 1, 4, 5, etc.
o sea para cualquier numero de campos en fields...
Pero veo que no hay un DATA en el listbox para poder pasar un "array" como parametro de Fields (o por lomenos no lo he podido hacer funcionar)
como puedo hacer para solucionar este inconveniente?
Gracias.
|
necesito solucionar esto de FIELDS en listbox
|
[quote="goosfancito":3gtjdyx1]la definicion de un listbox (para poder usarlo en una TW) es:
redefine listbox oListBox;
fields columna(1),;
columna(2),..
....
Ahora bien, estoy queriendo hacer una libreria donde esos "fields" varien en cantidad, o sea, 1, 4, 5, etc.
o sea para cualquier numero de campos en fields...
Pero veo que no hay un DATA en el listbox para poder pasar un "array" como parametro de Fields (o por lomenos no lo he podido hacer funcionar)
como puedo hacer para solucionar este inconveniente?
Gracias.[/quote:3gtjdyx1]
Gracias wMorman
[code=fw:3gtjdyx1]<div class="fw" id="{CB}" style="font-family: monospace;"> WITH OBJECT <span style="color: #000000;">(</span>::<span style="color: #000000;">oTw</span> := TWBrowse<span style="color: #000000;">(</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /> :<span style="color: #0000ff;">REDEFINE</span><span style="color: #000000;">(</span> <span style="color: #000000;">100</span>, <span style="color: #000000;">{</span>|| <span style="color: #000000;">{</span>::<span style="color: #000000;">armarcolumna</span><span style="color: #000000;">(</span><span style="color: #000000;">1</span><span style="color: #000000;">)</span>,::<span style="color: #000000;">armarcolumna</span><span style="color: #000000;">(</span><span style="color: #000000;">2</span><span style="color: #000000;">)</span>,::<span style="color: #000000;">armarcolumna</span><span style="color: #000000;">(</span><span style="color: #000000;">3</span><span style="color: #000000;">)</span>,::<span style="color: #000000;">armarcolumna</span><span style="color: #000000;">(</span><span style="color: #000000;">4</span><span style="color: #000000;">)</span><span style="color: #000000;">}</span> <span style="color: #000000;">}</span>, ::<span style="color: #000000;">oDlg</span>, ::<span style="color: #000000;">aNombreColumnas</span>, ::<span style="color: #000000;">aTamanioColumnas</span> <span style="color: #000000;">)</span><br /> :<span style="color: #000000;">nHeaderHeight</span> := <span style="color: #000000;">28</span><br /> :<span style="color: #000000;">nLineHeight</span> := <span style="color: #000000;">20</span><br /> :<span style="color: #000000;">aHJustify</span>:= <span style="color: #000000;">{</span><span style="color: #000000;">2</span>,<span style="color: #000000;">2</span>,<span style="color: #000000;">2</span><span style="color: #000000;">}</span><br /><br /> :<span style="color: #000000;">bBkColor</span> := <span style="color: #000000;">{</span> |nRow, nCol, nstyle| <span style="color: #00C800;">IF</span><span style="color: #000000;">(</span>nCol==<span style="color: #000000;">1</span>, ::<span style="color: #000000;">ColorCol1</span>,<span style="color: #000000;">)</span><span style="color: #000000;">}</span><br /> :<span style="color: #000000;">nClrPane</span> := <span style="color: #000000;">{</span> || <span style="color: #00C800;">IF</span> <span style="color: #000000;">(</span>::<span style="color: #000000;">oQuery</span>:<span style="color: #000000;">Recno</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> % <span style="color: #000000;">2</span> == <span style="color: #000000;">0</span>, ::<span style="color: #000000;">colorRowPar</span>, ::<span style="color: #000000;">colorRowImpar</span><span style="color: #000000;">)</span><span style="color: #000000;">}</span><br /><br /> <span style="color: #B900B9;">//----------( teclado )----------</span><br /> :<span style="color: #000000;">bKeyDown</span>:= <span style="color: #000000;">{</span> |nKey| <span style="color: #00C800;">IF</span><span style="color: #000000;">(</span>!Empty<span style="color: #000000;">(</span>::<span style="color: #000000;">bAbm</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span>,Eval<span style="color: #000000;">(</span>::<span style="color: #000000;">bABM</span>, nkey<span style="color: #000000;">)</span>,<span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /> END WITH<br /> </div>[/code:3gtjdyx1]
Hay q hacerlo por OOP no por redefine directamente. Esto hasta aca funciona.
|
necesito tsbrowse para fwh 8.04
|
amigos, voy avanzando, pero lento, ahora necesito saber donde conseguir la libreria sbrowse.lib, para poder usar la clase tsbrowse, con fwh 8.04, bcc55, y harbour
|
necesito tsbrowse para fwh 8.04
|
Hola ¿norte?,tendrías que recompilar la librería completa. Manuel distribuye la TSBrowse con todo el código fuente y un rmk para recompilarlo. Si tienes alguna version anterior, búsca en el directorio lib (si mal no recuerdo, no estoy en la oficina para verificarlo) y encontrarars un .rmk para usar con rmake, al que deberas seguramente ajustar los paths a tu bcc y a tu harbour.Si no resolviste el problema cuando llegue a casa te doy mas detalles.Un saludo,Carlos.
|
necesito tsbrowse para fwh 8.04
|
[quote="norte_67":r7pxltp3]amigos, voy avanzando, pero lento, ahora necesito saber donde conseguir la libreria sbrowse.lib, para poder usar la clase tsbrowse, con fwh 8.04, bcc55, y harbour[/quote:r7pxltp3]Hola Carlos:Aquí puedes descargarla:[url:r7pxltp3]http://www.box.net/shared/jdkzu5paqu[/url:r7pxltp3]Saludos.Manuel Mercado
|
necesito tsbrowse para fwh 8.04
|
maestro gracias, logre generar la lib de tsbrowse, estoy usando verce 5.3, fwh 8.04, harbour 1.1, bcc55, workshop 4.5, el tema es cuando quiero enlazar mis prg con la lib, me sale esto;Error: Unresolved external '_HB_FUN_TOLEAUTO' referenced from C:\PROGRAMAS\PROGH\SBROWSEH.LIB|TSBROWSE
|
necesito una ayuda
|
he realizado un reporte simple para ir cazando bugs ... una dbf con clientes , 2 areas , una de ellas titulo , otra que se repite para cada nombre de cliente.
¿ como se hace para que el reporte cree mas de una hoja ? , esiste algo que tengo que cliquear o es un bug ?
Saludos a todos.
|
necesito una ayuda
|
Manuel,
Si se trata de un reporte estandard de FWH, lo más sencillo es que construyas samples\FiveDBU.prg y que abras una DBF y la imprimas.
Aqui tienes el FiveDBU ya construido:
[url:1dz6zvcu]https://bitbucket.org/fivetech/fivewin-contributions/downloads/fivedbu_20140730.zip[/url:1dz6zvcu]
|
necesito una ayuda
|
Me explicado mal , yo creo el informe con easyreport y le doy a imprimir , y me sale solo una hoja ... ¿ que tengo que hacer ahora ? , se que me tienen que salir un monton de hojas ( por lo menos 5 ) , pero solo imprime una con 5 clientes ( la dbf tiene por lo menos 200 )
-------------- editado ------------------------
Me respondo en parte ... colocando en el codigo LAutobreak := .t. ya me salen multiples paginas . Ahora , ¿ donde podemos asignar si el reporte es autobreak ?
|
necesito una ayuda
|
Manuel,
Cuando en el código se van asignando los ITEMIDS e ITEMVALUES, el flujo se controla así:
//Nueva Página
IF oVRD:nNextRow > oVRD:nPageBreak
PAGEBREAK oVRD
PRINTAREA 1 OF oVRD ;
ITEMIDS { 500,501 ,;....
ENDIF
Y un simple report:
[code=fw:13mv3tos]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #B900B9;">// EasyReport: Simple report</span><br /><br /><span style="color: #00C800;">FUNCTION</span> PrintReport<span style="color: #000000;">(</span> lPreview <span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">LOCAL</span> oVRD, oItem, nOldCol<br /><br /> <span style="color: #00C800;">DEFAULT</span> lPreview := .T.<br /><br /><br /> <span style="color: #B900B9;">//Open report</span><br /> oVRD := VRD<span style="color: #000000;">(</span><span style="color: #000000;">)</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">".<span style="color: #000000;">\e</span>xamples<span style="color: #000000;">\E</span>asyReportExample3.vrd"</span>, lPreview,, oWnd, ;<br /> ,,,,, IIF<span style="color: #000000;">(</span> lPreview, .F., .T. <span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">IF</span> oVRD:<span style="color: #000000;">lDialogCancel</span> = .T.<br /> <span style="color: #00C800;">RETURN</span><span style="color: #000000;">(</span> .F. <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">ENDIF</span><br /><br /> USE .\EXAMPLES\EXAMPLE3<br /><br /> oVRD:<span style="color: #000000;">AreaStart</span><span style="color: #000000;">(</span> <span style="color: #000000;">1</span> <span style="color: #000000;">)</span><br /> oVRD:<span style="color: #000000;">PrintArea</span><span style="color: #000000;">(</span> <span style="color: #000000;">1</span> <span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">DO</span> <span style="color: #00C800;">WHILE</span> .NOT. EOF<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #B900B9;">//Change item color</span><br /> oItem := VRDItem<span style="color: #000000;">(</span><span style="color: #000000;">)</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">(</span> <span style="color: #00C800;">NIL</span>, oVRD, <span style="color: #000000;">2</span>, <span style="color: #000000;">110</span> <span style="color: #000000;">)</span><br /> nOldCol := oItem:<span style="color: #000000;">nColFill</span><br /> oItem:<span style="color: #000000;">nColFill</span> := <span style="color: #000000;">1</span><br /> oItem:<span style="color: #000000;">Set</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> oVRD:<span style="color: #000000;">AreaStart</span><span style="color: #000000;">(</span> <span style="color: #000000;">2</span> <span style="color: #000000;">)</span><br /> oVRD:<span style="color: #000000;">PrintArea</span><span style="color: #000000;">(</span> <span style="color: #000000;">2</span> <span style="color: #000000;">)</span><br /><br /> <span style="color: #B900B9;">//Set old item color</span><br /> oItem:<span style="color: #000000;">nColFill</span> := nOldCol<br /> oItem:<span style="color: #000000;">Set</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> EXAMPLE3-><span style="color: #000000;">(</span>DBSKIP<span style="color: #000000;">(</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #B900B9;">//New Page</span><br /> <span style="color: #00C800;">IF</span> oVRD:<span style="color: #000000;">nNextRow</span> > oVRD:<span style="color: #000000;">nPageBreak</span><br /><br /> oVRD:<span style="color: #000000;">PageBreak</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #B900B9;">//Print header</span><br /> oVRD:<span style="color: #000000;">AreaStart</span><span style="color: #000000;">(</span> <span style="color: #000000;">1</span> <span style="color: #000000;">)</span><br /> oVRD:<span style="color: #000000;">PrintArea</span><span style="color: #000000;">(</span> <span style="color: #000000;">1</span> <span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">ENDIF</span><br /><br /> <span style="color: #00C800;">ENDDO</span><br /><br /> <span style="color: #B900B9;">//Print footer</span><br /> oVRD:<span style="color: #000000;">AreaStart</span><span style="color: #000000;">(</span> <span style="color: #000000;">3</span> <span style="color: #000000;">)</span><br /> oVRD:<span style="color: #000000;">PrintArea</span><span style="color: #000000;">(</span> <span style="color: #000000;">3</span> <span style="color: #000000;">)</span><br /><br /> EXAMPLE3-><span style="color: #000000;">(</span>DBCLOSEAREA<span style="color: #000000;">(</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #B900B9;">//End the printout</span><br /> oVRD:<span style="color: #000000;">End</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">RETURN</span> <span style="color: #000000;">(</span>.T.<span style="color: #000000;">)</span></div>[/code:13mv3tos]
|
necesito una ayuda
|
Lucas , entiendo entonces que desde el diseñador no podremos previsualizar un reporte completamente terminado según está pues le faltan opciones de configuración que tendremos que colocar en nuestro programa "a mano " .
Gracias por la ayuda.
|
necesito una ayuda
|
Manuel, prueba lo siguiente
Una vez hayas creado el area y definido los campos, sitúa el mouse sobre la cabecera del área y pulsa boton derecho
Selecciona: Area properties ( o en lugar de estos dos pasos pulsa Ctrl+A)
En el diálogo de propiedades del area, en la opcion: Print area for each record of:
Selecciona la base de datos a la que pertenece el registro cuyos campos tienes definidos en esa area
Et voilà
Imprime todos los registros
|
necesito una ayuda
|
[quote="cnavarro":a937fkl3]Manuel, prueba lo siguiente
Una vez hayas creado el area y definido los campos, sitúa el mouse sobre la cabecera del área y pulsa boton derecho
Selecciona: Area properties ( o en lugar de estos dos pasos pulsa Ctrl+A)
En el diálogo de propiedades del area, en la opcion: Print area for each record of:
Selecciona la base de datos a la que pertenece el registro cuyos campos tienes definidos en esa area
Et voilà
Imprime todos los registros[/quote:a937fkl3]
Efectivamante así lo estaba haciendo pero previo he tenido que poner el lautobreak a .T. .
Otra... el area de titulo quiero que aparezca en cada una de las hojas , puedo escoger entre que aparezca después del break y entonces aparece en todas menos en la primera pagina o que aparezca en la primera pagina y entonces no aparece en las demás ....
|
necesito una mano para arrancar a usar el MySql
|
Saludos o todos los foristas.
Siempre he trabajado con DBF, nunca me he salido de esa línea.
Leyendo y leyendo, veo que muchas aplicaciones usan MysQl sea de manera local o bajo filosofía cliente-servidor. Incluso ya se habla de otros como MariaDb.
Estoy por comenzar una aplicación, y debo hacerla con FW+MySql (cliente-servidor) ya que el cliente así lo amerita.
Ya tengo el servicio host contratado con MySql disponible.
Ahora bien, les soy sincero y les digo que no tengo NI IDEA por donde comenzar, he visto algunos tips de mysql y no se ve nada complicado, de hecho ya tengo algún material a la mano y tengo algunas ideas de como funciona.
La consulta en esta oportunidad es: ¿ Por donde debo comenzar ? que debo tener en mi equipo y que otras herramientas de software necesito ? algún lugar donde conseguir ejemplos cortos de los procesos mas comunes en programación ? donde conseguir información de como instalarlo, configurarlo ? en fin, ponerlo a tiro listo para trabajar ...
Quedo a la espera de la ayuda de este foro, que siempre esta dispuesta a tender la mano a todos ,
<!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D -->
|
necesito una mano para arrancar a usar el MySql
|
José:
Dame un correo, por favor.
Saludos
|
necesito una mano para arrancar a usar el MySql
|
Hola Armando.
mis correo son:
<!-- e --><a href="mailto:[email protected]">[email protected]</a><!-- e -->
<!-- e --><a href="mailto:[email protected]">[email protected]</a><!-- e -->
|
necesito una mano para arrancar a usar el MySql
|
[quote="JoseAlvarez":3c4m9i9x]Saludos o todos los foristas.
Siempre he trabajado con DBF, nunca me he salido de esa línea.
Leyendo y leyendo, veo que muchas aplicaciones usan MysQl sea de manera local o bajo filosofía cliente-servidor. Incluso ya se habla de otros como MariaDb.
Estoy por comenzar una aplicación, y debo hacerla con FW+MySql (cliente-servidor) ya que el cliente así lo amerita.
Ya tengo el servicio host contratado con MySql disponible.
Ahora bien, les soy sincero y les digo que no tengo NI IDEA por donde comenzar, he visto algunos tips de mysql y no se ve nada complicado, de hecho ya tengo algún material a la mano y tengo algunas ideas de como funciona.
La consulta en esta oportunidad es: ¿ Por donde debo comenzar ? que debo tener en mi equipo y que otras herramientas de software necesito ? algún lugar donde conseguir ejemplos cortos de los procesos mas comunes en programación ? donde conseguir información de como instalarlo, configurarlo ? en fin, ponerlo a tiro listo para trabajar ...
Quedo a la espera de la ayuda de este foro, que siempre esta dispuesta a tender la mano a todos ,
<!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D -->[/quote:3c4m9i9x]
Hola.
Si vas a usar TMySql Class, te puedo suministrar ejemplos de Conección y de creacion de base de datos y sus tablas.
|
necesito una mano para arrancar a usar el MySql
|
Hola francisco,
Gracias por tu respuesta.
De verdad q aun no se cual usar, he leido sobre tdolphin. No se cual es mejor o simplemente en que se diferencian una de otra.
Cualquier luz que me puedas arrojar al respecto sera bienvenida.
Gracias.
|
necesito una mano para arrancar a usar el MySql
|
[quote="JoseAlvarez":ffspux5h]Hola francisco,
Gracias por tu respuesta.
De verdad q aun no se cual usar, he leido sobre tdolphin. No se cual es mejor o simplemente en que se diferencian una de otra.
Cualquier luz que me puedas arrojar al respecto sera bienvenida.
Gracias.[/quote:ffspux5h]
Si te decides por TDolphin...
[quote:ffspux5h]Daniel wrote:
...visita <!-- m --><a class="postlink" href="http://tdolphin.blogspot.com/">http://tdolphin.blogspot.com/</a><!-- m --> sitio elaborado por mi, donde encontraras todo funcionando y el codigo totalmente abierto...
disponible para usarse tanto en 32 como 64 bit, y distintos compiladores de C, como borland, microsoft y mingw[/quote:ffspux5h]
Saludos.
|
necesito una mano para arrancar a usar el MySql
|
ook, Muchas gracias Francisco, agradecido
Un abrazo desde Venezuela,
Voy a leer y te comento vía mail.
|
necesito una mano para arrancar a usar el MySql
|
Hola
yo aprendí el uso de mysql gracias
al[b:1lf9r1ak] excelente blog de Armando [/b:1lf9r1ak]
que nos enseño paso a paso el uso de mysql
desde la instalación hasta su uso
y también a las muchas contribuciones en el foro
una cosa que es importante es que si quieres entrarle
a Mysql debes hacerlo desde [b:1lf9r1ak]ADO directo[/b:1lf9r1ak] es un camino
difícil al principio pero a la larga es el más efectivo
|
necesito una mano para arrancar a usar el MySql
|
José,
Experimenta ADORDD.
Es muy fácil entrar en el mundo SQL com ADO.
Usas la mesma sintaxis que cualquier otra RDD.
|
necesito una mano para arrancar a usar el MySql
|
José
Saludos,
Si deseas escribeme a mi correo <!-- e --><a href="mailto:[email protected]">[email protected]</a><!-- e -->, si puedes viajas para caracas, te damos apoyo y capacitación para que te inicies rápido. Tambien te ofrecemos hospedarte en las instalaciones de AdaptaPro.
Puedo asignarte a un técnico que te apoye de manera remota a instalar, configurar, optimizar y hacer respaldos de MySQL.
<!-- e --><a href="mailto:[email protected]">[email protected]</a><!-- e -->
57-0414-3000518
|
necesito una mano para arrancar a usar el MySql
|
Ciertamente, la calidad de las personas que conforman este foro, su profesionalismo y camaradería es impresionante. Siempre prestos a tender la mano sin ningún otro interés que conformar una comunidad de ayuda entre todos.
Gracias Antonio, gracias Marcos, gracias Juan ! <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D -->
Excelente !
PD: Juan, te contesté a tu correo.
|
necesito una mano para arrancar a usar el MySql
|
De las diferentes alternativas que te han ofrecido, tienes que buscar la que mas se adapta a esa primera aplicación que vas a realizar. Según tu dices estás "por comenzar una aplicación, y debo hacerla con FW+MySql (cliente-servidor) ya que el cliente así lo amerita.Ya tengo el servicio host contratado con MySql disponible".
En mi opinión, lo primero que debes haces es estudiar un poco los comandos SQL y empezar a practicar con PhpMyAdmin que seguramente tendrás en el servidor que has contratado.
Una vez tenga un conocimiento somero de los comandos SQL, yo sin duda, escogería TDolphin (embebido) para esa aplicación. ¿Porque?
1) Tienes claro que vas a trabajar con MySql en esa aplicación (no con Oracles o Progress)
2) Si es embebido, no necesitaras instalar nada mas en cada estación del cliente donde vayan a instalar tu exe.
3) TDolphin está creada con los mismos conceptos de Clipper. Por ejemplo, los arrays comienzas por el elemento 1 y no por el 0.
4) Hay muchos usuarios en este foro que lo utilizan y ademas tenemos al amigo Daniel, su creador.
Si en otra ocasión necesitas trabajar con otra base de datos (por ejemplo, Oracles o Progress) entonces si podrías plantearte aprender ADO e instalar los driver del motor. Pero ahora no lo necesitas y conseguirías el mismo resultado que con Tdolphin, pero con un recorrido mas duro.
Creo que cuando Armando empezó con ADO, no existía TDolphin (corrígeme si me equívoco). Igual me pasó a mí. Comencé con ADO, pero luego, en alguna aplicación específica como la que comentas, la hice en TDolphin.
|
necesito una mano para arrancar a usar el MySql
|
Hola,
Con ADORDD puedes trabajar con MySQL, Access, Microsoft SQL Server, etc de la misma forma que un DBF:
Aquí tienes el manual en español:
<!-- m --><a class="postlink" href="https://github.com/AHFERREIRA/adordd/blob/master/02_LEEME.pdf">https://github.com/AHFERREIRA/adordd/bl ... _LEEME.pdf</a><!-- m -->
|
necesito una mano para arrancar a usar el MySql
|
Te aconsejo
MariaDB en reemplazo de MySQL
TDolphin de Daniel Garcia
Dbf2Sql de Kleyber para pasar tus Dbf al motor de MariaDB/MySql
Heidisql para explorar el motor
Harbour en vez de xHarbour ya que es mas completo.
Saludos,
Adhemar
|
necesito una mano para arrancar a usar el MySql
|
oK,
Gracias Manuel, Lucas y Adhemar...
Estoy tomando en cuenta todos los consejos, pronto les comentaré que camino escogí.
Saludos..
|
necesito una mano para arrancar a usar el MySql
|
Cuando me tocó hacer ese cambio hace varios años, no habían más opciones que ADO, y es el que yo utilizo. Y en verdad que fue duro al principio, pero era porque no había mucha documentación, sobre su uso con harbour. Pero hoy es diferente y en este foro encontrarás la ayuda para hacer todo lo que necesites, y te aseguro que te resultará sencillo, sin importar la opción que selecciones.
Saludos
|
necesito una mano para arrancar a usar el MySql
|
[quote="Armando":oicubjxu]José:
Dame un correo, por favor.
Saludos[/quote:oicubjxu]
Hola buenos dias Ing. Armando, de antemano les envio cordial saludos.
Sera que me puedas contactar a mi correo referente al tema de ADO puro y duro,ya que he leido en el foro que mencionas tu experiencia,entre a tu blog, pero no veo algun ejemplo de conexion...! y el tipo de motor de bases de datos es recomendable instalar.
Le dejo mi correo.
[b:oicubjxu][email protected][/b:oicubjxu]
Saludos cordiarles
Atte: Adrian C. C.
<!-- e --><a href="mailto:[email protected]">[email protected]</a><!-- e -->
|
necesito una mano para arrancar a usar el MySql
|
Un punto a tomar en cuenta simpre, si se va ha utilizar un hosting, es que este permita conexiones remotas para mysql,
ya que no todos lo permite.
ahora, para desarrollo, no es recomendable usar el hosting con mysql, eso se hace ya una vez finalizada la app, tanto en los periodos de implantacion, depuracion y produccion.
para el desarrollo, tienes varias opciones, embbebido en caso de usar tdolphin, instalar mysq/mariadb en la pc de desarrollo (usar localhost) o utilizar una maquina virtual con cualquier OS instalado y mysql/mariadb.
es altamente recomendable usar un frontend como heidisql para aprender a usar las instrucciones sql,
haciendo una conexion a tu hosting desde heidisql te permitira probar si tu hosting permite conexiones remotas a mysql.
salu2
carlos vargas
|
necesito una mano para arrancar a usar el MySql
|
[quote="carlos vargas":fvm22zqs]Un punto a tomar en cuenta simpre, si se va ha utilizar un hosting, es que este permita conexiones remotas para mysql,
ya que no todos lo permite.
ahora, para desarrollo, no es recomendable usar el hosting con mysql, eso se hace ya una vez finalizada la app, tanto en los periodos de implantacion, depuracion y produccion.
para el desarrollo, tienes varias opciones, embbebido en caso de usar tdolphin, instalar mysq/mariadb en la pc de desarrollo (usar localhost) o utilizar una maquina virtual con cualquier OS instalado y mysql/mariadb.
es altamente recomendable usar un frontend como heidisql para aprender a usar las instrucciones sql,
haciendo una conexion a tu hosting desde heidisql te permitira probar si tu hosting permite conexiones remotas a mysql.
salu2
carlos vargas[/quote:fvm22zqs]
Hola Ing. Carlos Vargas, gracias por tu interes,por el momento ya tengo instalado mariaDB,anteriormente tenia instalado MySQL,pero de tanto leer y releer,recomiendan ahora mariaDB que ttiene ventajas,y hago conexiones con tdolphin que utilizo gracias al Ing. Daniel Garcia,pero que no al cien por ciento utilizo los comandos mas comunes de sql,ya que lo trae casi todo la clase tdolphin.
Pero ahora me surge la inquietud de desarrollar en ADO, que tengo entendido que se puede aplicar a cualquier tipo de base de datos,pero no le entiendo como hacer conexion ya busque por ahi por alla y no veo algun ejemplo de conexion usando ADO puro.
Saludos y gracias.
Atte: Adrian C. C.
<!-- e --><a href="mailto:[email protected]">[email protected]</a><!-- e -->
|
necesito una mano para arrancar a usar el MySql
|
Adrian:
Te envíe un mensaje a tu correo.
Saludos
|
need a link script or file to link
|
need to link a lot of prgs to create exe.Using borland..Harbour and buildh.bat for each prg. Now I need to start to link several of them together. Soon about 100+ prgs.Someobdy sending a script or bat file would be great. I'm lost.
|
need a link script or file to link
|
Harvey,maybe it´s better to use a simple project manager than a big batch for this job.I suggest to use xMate, it´s a really great and easy to use tool.You can download it at [url:291q2v17]http://www.andywos.ih.co.za/xmate/[/url:291q2v17]
|
need a link script or file to link
|
Hello Harvey,you can use Stefan's solution or usea standard-sample and change the contents.here is the basic-structure of the script-file : [code:ugias4o3]
1. create a batchfile : GO.bat
----------------------------------
IF not exist obj md obj
c:\bcc55\bin\make -f PROGFILE.rmk
2. create a file PROGFILE.rmk
----------------------------------
#Borland make sample, (c) FiveTech Software 2005
# your BORLAND, HARBOUR and FWH directorys
--------------------------------------------------------
HBDIR=c:\xharbour
BCDIR=c:\bcc55
FWDIR=c:\fwh
.path.OBJ = .\obj
.path.PRG = .\
.path.CH = $(FWDIR)\include;$(HBDIR)\include
.path.C = .\
.path.rc = .\
# the list of the PRG-files ( PRG has to be uppercase )
// ------------------------------------------------------------
PRG = \
Prog1.PRG \
Prog2.PRG \
Prog3.PRG \
Prog4.PRG \
Prog5.PRG
// the same with c-files if needed
// -----------------------------------
# C = \
# two.C
PROJECT : MYPROG.exe
// the resource-file
// -------------------
MYPROG.exe : $(PRG:.PRG=.OBJ) $(C:.C=.OBJ) MYPROG.res
echo off
echo $(BCDIR)\bin\c0w32.obj + > b32.bc
# OBJ-Liste
# -------------
echo obj\Prog1.obj \
obj\Prog2.obj \
obj\Prog3.obj \
obj\Prog4.obj \
obj\Prog5.obj, + >> b32.bc
echo MYPROG.exe, + >> b32.bc
echo MYPROG.map, + >> b32.bc
# Fivewin Lib`s für xHARBOUR
# --------------------------------------
echo $(FWDIR)\lib\Fivehx.lib $(FWDIR)\lib\FiveHC.lib + >> b32.bc
# xHARBOUR-Lib`s
# -----------------------
echo $(HBDIR)\lib\rtl.lib + >> b32.bc
echo $(HBDIR)\lib\vm.lib + >> b32.bc
echo $(HBDIR)\lib\gtgui.lib + >> b32.bc
echo $(HBDIR)\lib\lang.lib + >> b32.bc
echo $(HBDIR)\lib\macro.lib + >> b32.bc
echo $(HBDIR)\lib\rdd.lib + >> b32.bc
echo $(HBDIR)\lib\dbfntx.lib + >> b32.bc
echo $(HBDIR)\lib\dbfcdx.lib + >> b32.bc
echo $(HBDIR)\lib\dbffpt.lib + >> b32.bc
echo $(HBDIR)\lib\hbsix.lib + >> b32.bc
echo $(HBDIR)\lib\debug.lib + >> b32.bc
echo $(HBDIR)\lib\common.lib + >> b32.bc
echo $(HBDIR)\lib\pp.lib + >> b32.bc
echo $(HBDIR)\lib\codepage.lib + >> b32.bc
echo $(HBDIR)\lib\pcrepos.lib + >> b32.bc
# Uncomment these two lines to use Advantage RDD
# echo $(HBDIR)\lib\rddads.lib + >> b32.bc
# echo $(HBDIR)\lib\Ace32.lib + >> b32.bc
echo $(BCDIR)\lib\cw32.lib + >> b32.bc
echo $(BCDIR)\lib\import32.lib + >> b32.bc
echo $(BCDIR)\lib\psdk\odbc32.lib + >> b32.bc
echo $(BCDIR)\lib\psdk\nddeapi.lib + >> b32.bc
echo $(BCDIR)\lib\psdk\iphlpapi.lib + >> b32.bc
echo $(BCDIR)\lib\psdk\msimg32.lib + >> b32.bc
echo $(BCDIR)\lib\psdk\rasapi32.lib, >> b32.bc
# MYPROG.res includes Symbol ICON : favorite.ico
# it will be the EXE-symbol
# ----------------------------------------------------------
IF EXIST MYPROG.res echo MYPROG.res >> b32.bc
$(BCDIR)\bin\ilink32 -Gn -aa -Tpe -s -v @b32.bc
# $(BCDIR)\bin\ilink32 -Gn -aa -Tpe -s @b32.bc
del b32.bc
.PRG.OBJ:
$(HBDIR)\bin\harbour $< /N /W /Oobj\ /I$(FWDIR)\include;$(HBDIR)\include > clip.log
$(BCDIR)\bin\bcc32 -c -tWM -I$(HBDIR)\include -oobj\$& obj\$&.c
.C.OBJ:
echo -c -tWM -D__HARBOUR__ -DHB_API_MACROS > tmp
echo -I$(HBDIR)\include;$(FWDIR)\include >> tmp
$(BCDIR)\bin\bcc32 -oobj\$& @tmp $&.c
del tmp
MYPROG.res : MYPROG.rc
$(BCDIR)\bin\brc32.exe -r MYPROG.rc
[/code:ugias4o3]
To compile start GO.bat
Best Regards
Uw <!-- s:lol: --><img src="{SMILIES_PATH}/icon_lol.gif" alt=":lol:" title="Laughing" /><!-- s:lol: -->
[/code]
|
need a link script or file to link
|
Harvey,FiveWin provides a Borland make working example:FWH/makes/bormake.zip
|
need a link script or file to link
|
Thanks for the help.I'll try it later today and get back. Thanks again
|
need a link script or file to link
|
Thanks for the input but it doesn't work.Please test it for me and let me know whats happening.Using files one.prg, alert.prg.Message i get: .PRG: not recognized etc. etc.If I comment it out ,PRG: I get "can't find alert.exe."code:#Borland make sample, (c) FiveTech Software 2005HBDIR=F:\harbourBCDIR=c:\Borland\bcc55FWDIR=F:\fwh#change these paths as needed.path.OBJ = .\obj.path.PRG = .\.path.CH = $(FWDIR)\include;$(HBDIR)\include.path.C = .\.path.rc = .\#important: Use Uppercase for filenames extensions, in the next two rules!PRG = \alert.PRG \one.PRG # C = \# two.C PROJECT : Alert.exeAlert.exe : $(PRG:.PRG=.OBJ) $(C:.C=.OBJ) Alert.res echo off echo $(BCDIR)\lib\c0w32.obj + > b32.bc echo obj\alert.obj obj\one.obj, + >> b32.bc echo alert.exe, + >> b32.bc echo alert.map, + >> b32.bc echo $(FWDIR)\lib\FiveH.lib $(FWDIR)\lib\FiveHC.lib + >> b32.bc echo $(HBDIR)\lib\hbrtl.lib + >> b32.bc echo $(HBDIR)\lib\hbvm.lib + >> b32.bc echo $(HBDIR)\lib\gtgui.lib + >> b32.bc echo $(HBDIR)\lib\hblang.lib + >> b32.bc echo $(HBDIR)\lib\hbmacro.lib + >> b32.bc echo $(HBDIR)\lib\hbrdd.lib + >> b32.bc echo $(HBDIR)\lib\dbfntx.lib + >> b32.bc echo $(HBDIR)\lib\dbfcdx.lib + >> b32.bc echo $(HBDIR)\lib\dbffpt.lib + >> b32.bc echo $(HBDIR)\lib\hbsix.lib + >> b32.bc echo $(HBDIR)\lib\hbdebug.lib + >> b32.bc echo $(HBDIR)\lib\hbcommon.lib + >> b32.bc echo $(HBDIR)\lib\hbpp.lib + >> b32.bc echo $(HBDIR)\lib\hbcpage.lib + >> b32.bc #rem Uncomment these two lines to use Advantage RDD #rem echo $(HBDIR)\lib\b32\rddads.lib + >> b32.bc #rem echo $(HBDIR)\lib\b32\Ace32.lib + >> b32.bc echo $(BCDIR)\lib\cw32.lib + >> b32.bc echo $(BCDIR)\lib\import32.lib + >> b32.bc echo $(BCDIR)\lib\psdk\odbc32.lib + >> b32.bc echo $(BCDIR)\lib\psdk\nddeapi.lib + >> b32.bc echo $(BCDIR)\lib\psdk\iphlpapi.lib + >> b32.bc echo $(BCDIR)\lib\psdk\rasapi32.lib, >> b32.bc IF EXIST Alert.res echo Alert.res >> b32.bc ECHO $(BCDIR)\bin\ilink32 -Gn -aa -Tpe -s @b32.bc del b32.bc .PRG.OBJ: #$(HBDIR)\bin\b32\harbour $< /L /N /W /Oobj\ /I$(FWDIR)\include;$(HBDIR)\include $(HBDIR)\bin\harbour $< /L /N /W /Oobj\ /I$(FWDIR)\include;$(HBDIR)\include $(BCDIR)\bin\bcc32 -c -tWM -I$(HBDIR)\include -oobj\$& obj\$&.c .C.OBJ: echo -c -tWM -D__HARBOUR__ -DHB_API_MACROS > tmp echo -I$(HBDIR)\include;$(FWDIR)\include >> tmp $(BCDIR)\bin\bcc32 -oobj\$& @tmp $&.c del tmp Alert.res : Alert.rc $(BCDIR)\bin\brc32.exe -r Alert.rcend code. [url][/url]
|
need Help with oBro:bSeek
|
hi,
can somebody point me to working "increment" Seek <!-- s:?: --><img src="{SMILIES_PATH}/icon_question.gif" alt=":?:" title="Question" /><!-- s:?: -->
Question :
a.) i guess it need an Index to SEEK. *CDX seems to be open "automatic" but *.NTX must be open before ?
b.) if *.CDX have TAGs, how to change TAG when click on Header of Column ?
c.) what about ADO ?
i saw
[code=fw:910zto2f]<div class="fw" id="{CB}" style="font-family: monospace;"> oBrw:<span style="color: #000000;">bSeek</span> := <span style="color: #000000;">{</span> | c | oBrw:<span style="color: #000000;">AdoIncrSeek</span><span style="color: #000000;">(</span> c <span style="color: #000000;">)</span> <span style="color: #000000;">}</span></div>[/code:910zto2f]
can i use it on Recordset of Excel ?
|
need Help with oBro:bSeek
|
[url:2mnmn3p2]https://www.forums.fivetechsupport.com/viewtopic.php?f=3&t=25731[/url:2mnmn3p2]
[url:2mnmn3p2]https://www.forums.fivetechsupport.com/viewtopic.php?f=3&t=26404[/url:2mnmn3p2]
[url:2mnmn3p2]https://forums.fivetechsoft.com/viewtopic.php?t=38833[/url:2mnmn3p2]
regards, saludos.
|
need Help with oBro:bSeek
|
[quote:2qo37sh5]
can somebody point me to working "increment" Seek <!-- s:?: --><img src="{SMILIES_PATH}/icon_question.gif" alt=":?:" title="Question" /><!-- s:?: -->
[/quote:2qo37sh5]
Incremental seek works automatically if the programmer does not do anything to disturb the automatic behavior of xbrowse.
[code=fw:2qo37sh5]<div class="fw" id="{CB}" style="font-family: monospace;">XBROWSER <span style="color: #ff0000;">"any.dbf"</span> AUTOSORT</div>[/code:2qo37sh5]
Start clicking on any header and the order is changed and incremental seek / filter work automatically
[quote:2qo37sh5]
a.) i guess it need an Index to SEEK. *CDX seems to be open "automatic" but *.NTX must be open before ?
[/quote:2qo37sh5]
Yes.
In case of DBFNTX, after USE, open indexes by
[code=fw:2qo37sh5]<div class="fw" id="{CB}" style="font-family: monospace;">SET <span style="color: #0000ff;">INDEX</span> <span style="color: #0000ff;">TO</span> .....</div>[/code:2qo37sh5]
and it is ready.
[quote:2qo37sh5]
b.) if *.CDX have TAGs, how to change TAG when click on Header of Column ?
[/quote:2qo37sh5]
XBrowse automatically does all this for us.
XBrowse searches all open indexes/tags and identifies which index/tag is to be used to sort on which column and stores the index/tag information in oCol:cSortOrder.
When the header is clicked, xbrowse automatically sets the index tag to oCol:cSortOrder, without disturbing the cuurent record pointer.
[quote:2qo37sh5]
c.) what about ADO ?
[/quote:2qo37sh5]
Whether ADO or other sources like Mysql, postgre, etc. XBrowse derives the field name from the expression and stores the right information in oCol:cSortOrder. On header click, xbrowse uses this information to switch the sort order and it also knows depending on the datasource, how to change the sort order.
Better we leave all this to XBrowse.
[quote:2qo37sh5]
can i use it on Recordset of Excel ?
[/quote:2qo37sh5]
Yes, you can. Clicking on header to sort the column and incremental seek/filter works just like any other datasource.
Inline Cell Edit:
Pressing Enter key starts inline cell edit, if the cell is editable.
[A reason why we should not disturb the internal behavior of XBrowse by assigning different actions to common keys using bKeyDown]
When FASTEDIT is true (oBrw:lFastEdit is .t.), pressing a permitted alpha numeric key starts inline cell edit, using that key as the first key of the Get.
Incremental Seek:
This is the default behavior of xbrowse unless we inhibit it by setting oBrw:lIncrSeek := .f.
if the data is sorted on any column and lFastEdit is not .t., pessing any key seeks the first row where the sorted column value begins with that character. Example, pressing "a" seeks value starting with "a" and again pressing "n" seeks "an" and so on.
If we set
oBrw:lSeekWild := .t.
Then xbrowse searches for entered value anywhere inside the field value.
if we set oBrw:lIncFilter, the entered keys are used to filter the data instead of seeking.
PS: Please do not disturb the internal behavior or xbrowse by using method keydown.
|
need Help with oBro:bSeek
|
hi,
thx for all Information.
i have to read it which "Keyword" are used
( AUTOSORT, oCol;cSortOrder, oBrw:lIncrSeek, lFastEdit, oBrw:lSeekWild, oBrw:lIncFilter,)
and learn how to use it
|
need help
|
Dear all,how to load this file "RWM600X.OCX" into fivewin harbour , and how to use then command inside the rwm600x.ocx.Thanks for your helpkok joek hoanote : rwm600x.ocx (visual basic) is a set command to control RFID reader amp600
|
need help
|
kok joek hoa,Do you have documentation for that ActiveX ?Do you have an example of use in Visual Basic ?
|
need help
|
Dear Antonio,Yes , I send to your email .Thanks,Kok Joek Hoa
|
need help
|
Kok Joek Hoa,Please review the FWH activex examples provided in FWH\samples\Search for "ACTIVEX" in FWH\samples\*.prg
|
need help how build xharbour from cvs?
|
Friends, for a long time since I built the compiler code xHarbour from CVS, now that I try, I have changed some things, I could suggest how it is currently building!
I searched for information but frankly I have not found how.
Before, what he did, was to have the bison.exe and bison.sim in borland folder and defined an environment variable to point to where BISON_SIMPLE were those files, and then executes the now make_b32.bat but that does not work.
Please developers, please a guide, easy or not <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) -->
|
need help how build xharbour from cvs?
|
This is the batch I'm using to build xHarbour:
[code=fw:2tcn57vt]<div class="fw" id="{CB}" style="font-family: monospace;">@ ECHO OFF<br />SET PATH=e:\bcc55\bin;e:\bison\bin;%PATH%<br />SET PRG_USR=-l<br />make_b32 clean build</div>[/code:2tcn57vt]
EMG
|
need help how build xharbour from cvs?
|
thank tou, Enrico. <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) -->
I try now build xharbour.
salu2
carlos vargas
|
need help how build xharbour from cvs?
|
Enrico, bison.sim is even necessary? and indicate the variable BISON_SIMPLE?
|
need help how build xharbour from cvs?
|
I don't have any bison.sim in my hard disk.
EMG
|
need help how build xharbour from cvs?
|
ok, thank you.
|
need help how build xharbour from cvs?
|
Enrico,
Now, i build xharbour compiler from CVS, and all ok.
My problem was what using the borland c++ version 5.82 and this version fail with bison. <!-- s:-( --><img src="{SMILIES_PATH}/icon_sad.gif" alt=":-(" title="Sad" /><!-- s:-( -->
but with the version 5.5 of Borland C++ all ok.
thank you.
sorry for my very bad english. <!-- s:-( --><img src="{SMILIES_PATH}/icon_sad.gif" alt=":-(" title="Sad" /><!-- s:-( -->
salu2
Carlos vargas
|
need help how build xharbour from cvs?
|
What version of Bison are you using? You need to use Bison 2.1.
EMG
|
need help how build xharbour from cvs?
|
I use the version 2.1 of bison for this build.
all ok, thank you.
salu2
carlos vargas
|
need odbccp32.lib for bcc 5.8.2
|
Hi,
Anyone has odbccp32.lib form BCC 5.8.2?.
Thanks.
|
need odbccp32.lib for bcc 5.8.2
|
Download :
<!-- m --><a class="postlink" href="http://www.pflegeplus.com/fw_downloads/odbccp32.lib">http://www.pflegeplus.com/fw_downloads/odbccp32.lib</a><!-- m -->
Best Regards
Uwe <!-- s:lol: --><img src="{SMILIES_PATH}/icon_lol.gif" alt=":lol:" title="Laughing" /><!-- s:lol: -->
|
need odbccp32.lib for bcc 5.8.2
|
Thanks Uve.
But I still getting:
Error: Unresolved external 'SQLInstallerError' referenced from C:\XHB2\LIB\BCC\SQLBCC58.LIB|sqlsrodbc
Error: Unresolved external 'SQLConfigDataSource' referenced from C:\XHB2\LIB\BCC\SQLBCC58.LIB|sqlsrodbc
Those functions are suppoused to be at odbccp32.lib but I get Unresolved external.
Thanks again.
|
need odbccp32.lib for bcc 5.8.2
|
Lucas,
the Lib comes from [color=#FF0000:jo6d38il]BCC63/psdk[/color:jo6d38il], because it is not included in BCC582
Maybe more libs are missing.
Best Regards
Uwe <!-- s:?: --><img src="{SMILIES_PATH}/icon_question.gif" alt=":?:" title="Question" /><!-- s:?: -->
|
need sbrowseh.lib
|
hi all,
does any one have sbrowseh.lib version 6.0 or over and sbuttonh.lib version 5 ?
Thanks.
|
need sbrowseh.lib version 6.0
|
hi all,
does any one have sbrowseh.lib version 6.0 ?
Thanks,
Kok
|
need sbrowseh.lib version 6.0
|
Hello,
Do you just need the Library?
Which version of Harbour Or xHarbour do you
Need the Library Compiled in?
I have the sBrowseh Version 6.0 (Super Browse)
Compiled with Harbour Version 39.0
And Fivewin For Harbour 2.3.
I have not updated it to Harbour 2.7.
But am work on it. I will be updateing
it in the Next Couple of day's
Jim
<!-- e --><a href="mailto:[email protected]">[email protected]</a><!-- e -->
|
need sbrowseh.lib version 6.0
|
There is also a Newer Version of the Super Browser Out.
Version 7.01
I have not used it.
Have been using Version 6.0
jim
<!-- e --><a href="mailto:[email protected]">[email protected]</a><!-- e -->
|
need sbrowseh.lib version 6.0
|
Dear J-Bohanan,
Thank you for your answer.
I use harbour version 45.0 and fivewin 27.
Regards,
Kok Joek hoa
|
need sbrowseh.lib version 6.0
|
kok joek hoa
I will recompile the Library Over the Weekend for you and then send
it to you. Can you send me a E-Mail address to send it to.
Thank You
Jim Bohanan
<!-- e --><a href="mailto:[email protected]">[email protected]</a><!-- e -->
|
need tcrw.prg for 32 bit
|
does anyone have tcrw.prg ( crystal report ) for 32bit
thanks
kok
|
need tcrw.prg for 32 bit
|
Hola Kok:
Aqui tienes la clase TCRW, modifique algun pequeño detalle, pero es 100% funcional, yo tengo aplicaciones desde hace muchos años funcionando con esta clase perfectamente.
// ===========================================================================
// TCRW.PRG (C) Tom Groeger 1998
// ===========================================================================
//
// 16 & 32 Bit Wrapper Classes for Crystal Reports gives you access to
// Crystal Reports 32Bit Dll. The class constructor automatically checks if
// 32Bit Dll's are available, and falls back to 16Bit if not.
// Thanks to Matthew Cullen/Adsystems for his help !
//
// downloaded from <!-- m --><a class="postlink" href="http://www.fivedb.com">http://www.fivedb.com</a><!-- m -->
//
// Modifico la Clase para visualizar los botones que quiero, y quitar los
// botones de la ventana, para emular MODAL. ( J.LLoris )
// ===========================================================================
#define FW_LEAN_AND_MEAN
#include "fivewin.CH"
#include "struct.CH"
#define TRUE 1
#define FALSE 0
# DEFINE HORZRES 8
# DEFINE VERTRES 10
// ==========================================================================
// CLASS TCRW // Crystal Reports 16/32Bit Wrapper
// ==========================================================================
CREATE CLASS TJCrw32
VAR hDll AS NUM
VAR l32 AS BOOL
VAR nJobHandle
VAR lError
VAR cReport
VAR oJobInfo
VAR oTabLocation
VAR oWinOptions
MESSAGE New METHOD NEW_ CONSTRUCTOR
MESSAGE FreeLibrary METHOD FREECRPE_
MESSAGE GetModuleHandle METHOD GETMOD_
MESSAGE PEOpenEngine METHOD PEOPEN_
MESSAGE PEErrorText METHOD ERRORT_
MESSAGE PEGetErrorCode METHOD ERRORN_
MESSAGE PEGetHandleString METHOD GETSTR_
MESSAGE PEOpenPrintJob METHOD OPENJOB_
MESSAGE PEOutputToWindow METHOD OUTPUTW_
MESSAGE PEPrintWindow METHOD PRINTWND_
MESSAGE PEOutToPrinter METHOD OUTPUTP_
MESSAGE PEStartPrintJob METHOD STARTPR_
MESSAGE PEGetWindowHandle METHOD GETHWND_
MESSAGE PEGetJobStatus METHOD GETJOBS_
MESSAGE PESetSelFormula METHOD SETSELE_
MESSAGE PEGetSelFormula METHOD GETSELE_
MESSAGE PECheckSelFormula METHOD CHECKSEL_
MESSAGE PESetFormula METHOD SETFORM_
MESSAGE PECheckFormula METHOD CHECKFOR_
MESSAGE PEGetNTables METHOD GETNTAB_ // Devuelve n§ de tablas usuadas
MESSAGE PEGetTabLocation METHOD GETTLOC_
MESSAGE PESetTabLocation METHOD SETTLOC_
MESSAGE PEGetSqlQuery METHOD GETSQLQ_
MESSAGE PESetSqlQuery METHOD SETSQLQ_
MESSAGE PETestNTable METHOD TESTTAB_
MESSAGE PEIsPrintFinished METHOD ISPRTRDY_ //
MESSAGE PEClosePrintJob METHOD CLOSEJOB_
MESSAGE PECloseEngine METHOD PECLOSE_
MESSAGE PeSetWindowOptions METHOD PESETWIN_
MESSAGE PEGetNSortFields METHOD PEGETSOR_
//MESSAGE PEGetNGroups METHOD PEGETNGR_
END CLASS
// ===========================================================================
// METHOD TCrw::New()
//
// Purpose:
// 16/32Bit Crystal Reports Class Constructor
//
// ===========================================================================
METHOD NEW_( nDirCrPe )
LOCAL cTemp
::hDll := 0
::nJobHandle := 0
::lError := .F.
// Check if we load 16 or 32 Bits. First try to load CRPE32
//
IF IsWin95() .OR. IsWinNT()
::hDll := LoadLib32( nDirCrPe + "CRPE32.DLL" )
::l32 := .T.
ENDIF
// If CRPE32.DLL did not load, try CRPE.DLL
//
IF ABS( ::hDll ) <= 32
::hDll := LoadLibrary( nDirCrPe + "CRPE.DLL" )
::l32 := .F.
ENDIF
IF ABS( ::hDll ) <= 32
::lError := .T.
IF ::hDll == 2
cTemp := "find"
ELSE
cTemp := "load"
ENDIF
MsgAlert( "Could not " + cTemp + " CRPE or CRPE32.DLL")
ELSE
::PEOpenEngine()
// Crea JobInfo Class
//
STRUCT ::oJobInfo
MEMBER structSize AS WORD LEN 2
MEMBER NumRecords AS DWORD LEN 4
MEMBER NumSelect AS DWORD LEN 4
MEMBER NumPrinted AS DWORD LEN 4
MEMBER DispPageN AS WORD LEN 2
MEMBER LatestPage AS WORD LEN 2
MEMBER StartPageN AS WORD LEN 2
MEMBER PrintEnded AS BOOL LEN 2
ENDSTRUCT
::oJobInfo:SetMember( 1, 22 )
STRUCT ::oTabLocation
MEMBER structSize AS WORD LEN 2
MEMBER location AS STRING LEN 256
ENDSTRUCT
::oTabLocation:SetMember(1, 258 )
// Crea oWinOptions Class
STRUCT ::oWinOptions
MEMBER structSize AS WORD LEN 2
MEMBER hasGroupTree AS BOOL LEN 2
MEMBER CanDrillDown AS BOOL LEN 2
MEMBER hasNavigationControls AS BOOL LEN 2
MEMBER hasCancelButton AS BOOL LEN 2
MEMBER hasPrintButton AS BOOL LEN 2
MEMBER hasExportButton AS BOOL LEN 2
MEMBER hasZoomControl AS BOOL LEN 2
MEMBER hasCloseButton AS BOOL LEN 2
MEMBER hasProgressControls AS BOOL LEN 2
MEMBER hasSearchButton AS BOOL LEN 2
MEMBER hasPrintSetupButton AS BOOL LEN 2
MEMBER hasRefreshButton AS BOOL LEN 2
ENDSTRUCT
::oWinOptions:SetMember(1, 26 )
ENDIF
RETURN Self
// ==========================================================================
// Method TCrw::FreeLibrary()
//
// ========================================================================== */
METHOD FREECRPE_()
IF ABS( ::hDll ) > 32
IF ::l32
FreeLib32( ::hDll )
ELSE
FreeLibrary( ::hDll )
ENDIF
ENDIF
::hDll := 0
RETURN .T.
// ==========================================================================
// METHOD TCrw::PEOpenEngine() -> lError
//
// Prepares the Report Engine for requests. This method is a necessary
// part of any custom-print link. It is also required for any print-only
// link in which you want the report to print to a window that is to remain
// visible after the report is printed.
// It is not necessary to use this method with a print-only link where
// you are directing the report to a printer
// ========================================================================== */
METHOD PEOPEN_()
LOCAL cFarProc
LOCAL cFunc := "PEOpenEngine"
IF ::l32
cFarProc := GetProc32( ::hDLL, cFunc, .T., LONG )
::lError := ( CallDll32( cFarProc ) == FALSE )
ELSE
cFarProc := GetProcAddress( ::hDLL, cFunc, .T., _INT )
::lError := ( CallDll( cFarProc ) == FALSE )
ENDIF
IF ::lError
MsgAlert( "Could not open the Print Engine!" + CRLF + ::PeErrorText())
ENDIF
RETURN ! ::lError
// ==========================================================================
// Method TCrw::PEErrorText()
//
// Purpose:
// Returns a string describing the status of the most recent Report
// Engine method called. These method can be used in a custom-print
// link to display the error string to the user as part of an error message.
// ========================================================================== */
METHOD ERRORT_()
LOCAL cFarProc
LOCAL cBuffer
LOCAL cError
LOCAL hError := 0
LOCAL nLen := 0
LOCAL nRet
LOCAL cFunc := "PEGetErrorText"
// Get ErrorCode
//
cError := "Error Code " + ALLTRIM( STR( ::PEGetErrorCode())) + ":" + CRLF
// Get StringHandle of ErrorText
//
IF ::l32
cFarProc := GetProc32( ::hDLL, cFunc, .T., _INT, LONG, PTR, PTR )
nRet := CallDll32( cFarProc , ::nJobHandle, @hError, @nLen )
ELSE
cFarProc := GetProcAddress( ::hDll, cFunc, .T., _INT, WORD, PTR, PTR )
nRet := CallDll( cFarProc , ::nJobHandle, @hError, @nLen )
ENDIF
// Now get the String
//
IF nRet == TRUE
cError += ::PEGetHandleString( hError, nLen )
ENDIF
return cError
// ==========================================================================
// Method TCrw::PEGetErrorCode() -> nCode
//
// Returns a number that indicates the status of the most recent Report
// Engine method called. When a call to another method fails, this call
// gets the error code that was generated so you can take some action based
// on that error code. If no Error occured, the method returns 0
// ========================================================================== */
METHOD ERRORN_()
LOCAL cFarProc
LOCAL nCode := 0
LOCAL cFunc := "PEGetErrorCode"
IF ::l32
cFarProc := GetProc32( ::hDLL, cFunc, .T., _INT, LONG )
nCode := CallDll32( cFarProc, ::nJobHandle )
ELSE
cFarProc := GetProcAddress( ::hDLL, cFunc, .T., _INT, _INT )
nCode := CallDll( cFarProc, ::nJobHandle )
ENDIF
RETURN nCode
// ==========================================================================
// Method TCrw::PEOpenPrintJob() -> lError
//
// Prepares to print a report and sets a number which identifies the
// particular print job, called a print job handle. This Handle is
// used in all subsequent calls related to the new print job
// (where a print job handle is required). This method is used as a
//
// reportFilePath Specifies the file name and path of the report
// you want to open
//
// ========================================================================== */
METHOD OPENJOB_( cReportName )
LOCAL cFarProc
LOCAL cFunc := "PEOpenPrintJob"
::cReport := cReportName
IF ::l32
cFarProc := GetProc32( ::hDll, cFunc,.T., _INT, LPSTR )
::nJobHandle := CallDll32( cFarProc, ::cReport )
ELSE
cFarProc := GetProcAddress( ::hDll, cFunc, .T., _INT, LPSTR )
::nJobHandle := CallDll( cFarProc, ::cReport )
ENDIF
::lError := .F.
IF ::nJobHandle == 0
MsgAlert( "Could not open Print Job!" + CRLF + '[' + ::cReport + ']' )
::lError := .T.
ENDIF
RETURN ! ::lError
// ==========================================================================
// Method TCrw::PEPrintWindow() -> lError
//
// Imprime el informe visualizado en el Preview.
//
// Prints the report displayed in the print window. This method can be
// used in a custom-print link to enable the user to preview the report
// in the print window, and then, if everything looks satisfactory, to
// print the report to the printer (in response to a user event).
//
// ========================================================================== */
METHOD PRINTWND_( lWait )
LOCAL cFarProc
LOCAL cFunc := "PEPrintWindow"
LOCAL nRet
DEFAULT lWait := .T.
::lError := .F.
IF ::l32
cFarProc := GetProc32( ::hDll, cFunc, .T., _INT, LONG, LONG )
nRet := CallDll32( cFarProc, ::nJobHandle, IIF(lWait,1,0))
ELSE
cFarProc := GetProcAddress( ::hDll, cFunc, .T., _INT, _INT, BOOL )
nRet := CallDll( cFarProc, ::nJobHandle, lWait )
ENDIF
IF nRet == FALSE
::lError := .T.
ENDIF
RETURN ! ::lError
// ==========================================================================
// Method TCrw::PEIsPrintFinished() -> lYesNo // PEIsPrintJobFinished
//
// Monitors the print job to see if it is finished or still in progress.
// You can use this method any time you have a call that is contingent
// on a print job being finished.
//
// ========================================================================== */
METHOD ISPRTRDY_()
LOCAL nRet
LOCAL cFarProc
LOCAL cFunc := "PEIsPrintJobFinished"
IF ::l32
cFarProc := GetProc32( ::hDll, cFunc, .T., _INT, LONG )
nRet := CallDll32( cFarProc, ::nJobHandle )
ELSE
cFarProc := GetProcAddress( ::hDll, cFunc, .T., _INT, _INT )
nRet := CallDll( cFarProc, ::nJobHandle )
ENDIF
RETURN ( nRet == TRUE )
// ==========================================================================
// Method TCrw::PEGetSelFormula() // PEGetSelectionFormula
//
// Returns the string for the selection formula used in the specified report.
// This method is typically used as one of a series of methods
// (PEGetSelectionFormula, PEGetHandleString, PESetSelectionFormula).
// The series can be used in a custom-print link to identify and then
// change an existing record selection formula at print time in response
// to a user selection.
//
// ========================================================================== */
METHOD GETSELE_()
LOCAL cFarProc
LOCAL nRet
LOCAL nText := 0
LOCAL nLen := 0
LOCAL cForm := ""
LOCAL cFunc := "PEGetSelectionFormula"
IF ::l32
cFarProc := GetProc32( ::hDll,cFunc,.T., _INT,LONG,PTR,PTR )
nRet := CallDll32( cFarProc, ::nJobHandle, @nText, @nLen )
ELSE
cFarProc := GetProcAddress( ::hDll,cFunc, .T., _INT, _INT, PTR, PTR )
nRet := CallDll( cFarProc, ::nJobHandle, @nText, @nLen )
ENDIF
IF nRet == FALSE
::lError := .T.
ELSE
cForm := ::PEGetHandleString( nText, nLen )
ENDIF
RETURN cForm
// ==========================================================================
// Method TCrw::PESetWindowOptions // PESetWindowOptions()
//
// ========================================================================== */
METHOD PESETWIN_()
LOCAL cStruc
LOCAL nRet
LOCAL cFarProc := "PESetWindowOptions"
::lError := .F.
//::oWinOptions:SetMember( 1, TRUE )
//::oWinOptions:SetMember( 2, TRUE )
//::oWinOptions:SetMember( 3, TRUE )
::oWinOptions:SetMember( 4, TRUE )
::oWinOptions:SetMember( 5, TRUE )
::oWinOptions:SetMember( 6, TRUE )
::oWinOptions:SetMember( 7, TRUE )
::oWinOptions:SetMember( 8, TRUE )
::oWinOptions:SetMember( 9, TRUE )
::oWinOptions:SetMember( 10, TRUE )
::oWinOptions:SetMember( 11, TRUE )
::oWinOptions:SetMember( 12, TRUE )
// ::oWinOptions:SetMember( 13, TRUE )
cStruc := ::oWinOptions:cBuffer
IF ::l32
cFarProc := GetProc32( ::hDll, cFarProc, .T., _INT, LONG, LPSTR )
nRet := CallDll32( cFarProc, ::nJobHandle, @cStruc )
ELSE
cFarProc := GetProcAddress( ::hDll, cFarProc, .T., _INT, _INT, LPSTR )
nRet := CallDll( cFarProc, ::nJobHandle, @cStruc )
ENDIF
RETURN self
// ==========================================================================
// Method TCrw::PeOutputToWindow( oWnd ) -> lError
//
// Prepares to direct printed output to a print window
//
// ========================================================================== */
METHOD OUTPUTW_( vWnd )
LOCAL nRet
LOCAL cFarProc
///LOCAL oRect := vWnd:GetCliRect()
LOCAL cFunc := "PEOutputToWindow"
LOCAL aScreen := ScrResolution( 800, 600 )
::lError := .F.
IF ::l32
cFarProc := GetProc32( ::hDll, cFunc, .T., _INT,; // nRetVar
LONG,; // nHandle
LPSTR,; // cReport
LONG,; // nTop
LONG,; // nLeft
LONG,; // nWidth
LONG,; // nHeigth
LONG,; // nStyle
LONG ) // hWnd
// nRet := CallDll32( cFarProc, ::nJobHandle, ::cReport, 0, 0, vWnd:nWidth, vWnd:nHeight, 0, vWnd:hWnd )
// nRet := CallDll32( cFarProc, ::nJobHandle, ::cReport, 0, 0, vWnd:nWidth-7, vWnd:nHeight-7, 0, vWnd )
//llamada original para el Preview
//nRet := CallDll32( cFarProc, ::nJobHandle, ::cReport, 0, 0, 800, 600, 0, vWnd )
nRet := CallDll32( cFarProc,;
::nJobHandle,;
::cReport,;
0,; //0
,; //0
aScreen[1],; //800
aScreen[2],; //600
nOR( WS_VISIBLE, WS_THICKFRAME ),; // , WS_SYSMENU ),;
vWnd )
ELSE
cFarProc := GetProcAddress( ::hDll, cFunc, .T.,;
_INT,; // nRetVar
_INT,; // nHandle
LPSTR,; // cReport
_INT,; // nTop
_INT,; // nLeft
_INT,; // nWidth
_INT,; // nHeigth
LONG,; // nStyle
HDC ) // hWnd
// nRet := CallDll( cFarProc, ::nJobHandle, ::cReport, 0, 0, vWnd:nWidth, vWnd:nHeight, 0, vWnd:hWnd )
*nRet := CallDll( cFarProc, ::nJobHandle, ::cReport, 0, 0, vWnd:nWidth-7, vWnd:nHeight-7, 0, vWnd )
ENDIF
IF nRet == FALSE
MsgAlert( 'Could not output to Window!' )
::lError := .T.
ENDIF
RETURN ! ::lError
// ==========================================================================
// Method TCrw::PeOutToPrinter( nCopies ) -> lError
//
// Prepares to direct printed output to a printer
//
// ========================================================================== */
METHOD OUTPUTP_( nCopies)
LOCAL nRet
LOCAL cFarProc
LOCAL cFunc := "PEOutputToPrinter"
DEFAULT nCopies := 1
::lError := .F.
IF ::l32
cFarProc := GetProc32( ::hDll, cFunc, .T., _INT, LONG, LONG )
nRet := CallDll32( cFarProc, ::nJobHandle, nCopies )
ELSE
cFarProc := GetProcAddress( ::hDll, cFunc, .T., _INT,_INT, _INT )
nRet := CallDll( cFarProc, ::nJobHandle, nCopies )
ENDIF
IF nRet == FALSE
MsgAlert( 'Could not output to Printer!' )
::lError := .T.
ENDIF
RETURN ! ::lError
// ==========================================================================
// Method TCrw::PeStartPrintJob( ) -> lError
// Purpose: Starts the printing of a report.
// ========================================================================== */
METHOD STARTPR_()
LOCAL nRet
LOCAL cFarProc
LOCAL cFunc := "PEStartPrintJob"
::lError := .F.
MEMORY( -1 )
Sysrefresh()
IF ::l32
cFarProc := GetProc32( ::hDll, cFunc,.T., _INT, LONG, LONG )
nRet := CallDll32( cFarProc , ::nJobHandle, .T. )
ELSE
cFarProc := GetProcAddress( ::hDll, cFunc,.T., _INT, _INT, BOOL )
nRet := CallDll( cFarProc , ::nJobHandle, .T. )
ENDIF
IF nRet == FALSE
::lError := .T.
MsgAlert( "Could not start Report!" + CRLF + ::PEErrorText())
ENDIF
RETURN ! ::lError
// ==========================================================================
// Method TCrw::PEGetWindowHandle() -> hWnd
//
// Purpose:
// Returns the handle of the print window . This method can be used in
// a custom-print link if you want to do something with the print window
// (move it, change its size, etc.).
// PEGetWindowHandle can also be used to determine if the user has already
// closed the print window.
//
// ========================================================================== */
METHOD GETHWND_()
LOCAL hWnd
LOCAL cFarProc
LOCAL cFunc := "PEGetWindowHandle"
IF ::l32
cFarProc := GetProc32( ::hDll, cFunc,.T.,_INT, LONG )
hWnd := CallDll32( cFarProc , ::nJobHandle )
ELSE
cFarProc := GetProcAddress( ::hDll, cFunc,.T.,_INT,_INT )
hWNd := CallDll( cFarProc , ::nJobHandle )
ENDIF
RETURN hWnd
// ==========================================================================
// Method TCrw::PEGetGetJobStatus() -> nStatus
//
// Evaluates the status of a print job. You can use this method in a
// number of programming situations, for example:
// - to trigger error messages, for example, when a print job fails
// (due to insufficient memory, insufficient disk space, etc.),
// - to trigger screen displays (hourglass, series of graphics, etc.)
// that confirm to the user that work is in progress, or
// — to find out whether a job was canceled by the user after
// PEStartPrintJob returns.
//
// ========================================================================== */
METHOD GETJOBS_()
LOCAL cStruct
LOCAL nStatus := 0
LOCAL cFarProc := "PEGetJobStatus"
cStruct := ::oJobInfo:cBuffer
IF ::l32
cFarProc := GetProc32( ::hDll, cFarProc,.T.,_INT, LONG, LPSTR )
nStatus := CallDll32( cFarProc, ::nJobHandle, @cStruct )
ELSE
cFarProc := GetProcAddress( ::hDll, cFarProc,.T.,_INT,_INT, LPSTR )
nStatus := CallDll( cFarProc, ::nJobHandle, @cStruct )
ENDIF
RETURN nStatus
// ==========================================================================
// Method TCrw::PESetSelFormula()
//
// Changes the selection formula to the formula string you supply as a
// parameter. This method can be used by itself to replace a known
// record selection formula.
// The method can also be used as one of a series of methods
// (PEGetSelectionFormula, PEGetHandleString, PESetSelectionFormula).
// The series can be used in a custom-print link to identify and then
// change an existing record selection formula at print time in response
// to a user selection.
// ========================================================================== */
METHOD SETSELE_( cFormula )
LOCAL nRet
LOCAL cFarProc := "PESetSelectionFormula"
::lError := .F.
IF ::l32
cFarProc := GetProc32( ::hDll, cFarProc,.T.,_INT,LONG, LPSTR )
nRet := CallDll32( cFarProc, ::nJobHandle, cFormula )
ELSE
cFarProc := GetProcAddress( ::hDll, cFarProc,.T.,_INT, _INT, LPSTR )
nRet := CallDll( cFarProc, ::nJobHandle, cFormula )
ENDIF
IF nRet == FALSE
MsgAlert( "Invalid Selection!" + CRLF + "[" + cFormula + "]" )
::lError := .T.
ENDIF
RETURN ! ::lError
// ==========================================================================
// Method TCrw::PECheckSelFormula()
//
// Checks the text of the report's record selection formula for errors.
// Use this method whenever the record selection formula has been changed
// and you wish to check the formula for syntax errors.
// If the record selection formula contains an error, this method returns
// False
// ========================================================================== */
METHOD CHECKSEL_()
LOCAL nRet
LOCAL cFarProc := "PECheckSelectionFormula"
::lError := .F.
IF ::l32
cFarProc := GetProc32( ::hDll, cFarProc,.T.,_INT, LONG )
nRet := CallDll32( cFarProc, ::nJobHandle )
ELSE
cFarProc := GetProcAddress( ::hDll, cFarProc,.T.,_INT, _INT )
nRet := CallDll( cFarProc, ::nJobHandle )
ENDIF
IF nRet == FALSE
::lError := .T.
ENDIF
RETURN ! ::lError
// ==========================================================================
// Method TCrw::PESetFormula( cformulaName, cFormulaString )
//
// Changes the specified formula to the formula string you supply as a
// parameter. This method will only change the text of a formula which
// already exists in the report; you can not use it to add a formula.
// This method can be used by itself to replace the formula string for
// a known formula.
// It can also be used as one of a series of methods (PEGetFormula,
// PEGetHandleString, PESetFormula). The series can be used in a
// custom-print link to identify and then change an existing formula at
// print time in response to a user selection.
//
// ==========================================================================
METHOD SETFORM_( cName, cString )
LOCAL nRet
LOCAL cFarProc := "PESetFormula"
::lError := .F.
IF ::l32
cFarProc := GetProc32( ::hDll,cFarProc ,.T.,_INT, LONG, LPSTR, LPSTR )
nRet := CallDll32( cFarProc, ::nJobHandle, cName, cString )
ELSE
cFarProc := GetProcAddress( ::hDll, cFarProc,.T.,_INT,_INT,LPSTR,LPSTR)
nRet := CallDll( cFarProc, ::nJobHandle, cName, cString )
ENDIF
IF nret == FALSE
//MsgAlert( "Could not set Formula!" + CRLF + "[" + cName + "]" + ;
// + CRLF + "[" + cString + "]" )
::lError := .T.
ENDIF
RETURN ! ::lError
// ==========================================================================
// Method TCrw::PECheckFormula( cFormualName )
//
// The PECheckFormula method checks the text of a named formula for
// validity. Use this method to check a named formula for errors. This
// method works like the Check button in the Formula Editor. If the
// named formula contains an error, the method returns False
//
// ========================================================================== */
METHOD CHECKFOR_( cformulaName )
LOCAL nRet
LOCAL cFarProc := "PECheckFormula"
::lError := .F.
IF ::l32
cFarProc := GetProc32( ::hDll, cFarProc,.T.,_INT,LONG,LPSTR )
nRet := CallDll32( cFarProc, ::nJobHandle, cformulaName )
ELSE
cFarProc := GetProcAddress( ::hDll, cFarProc,.T.,_INT,_INT, LPSTR )
nRet := CallDll( cFarProc, ::nJobHandle, cformulaName )
ENDIF
IF nRet == FALSE
MsgAlert("Invalid Formula!" + CRLF + "[" + cformulaName + "]" )
::lError := .T.
ENDIF
RETURN ! ::lError
// ==========================================================================
// Method TCrw::PEGetNTables()
//
// The PEGetNTables method retrieves the number of tables in the open report.
// It counts both PC and SQL databases. This method is one of a series of
// methods that enable you to retrieve and update database information in an
// opened report so that the report can be printed using different server,
// database, user, and/or table location settings.
//
// ========================================================================== */
METHOD GETNTAB_()
LOCAL nTables
LOCAL cFarProc := "PEGetNTables"
IF ::l32
cFarProc := GetProc32( ::hDll, cFarProc,.T.,_INT, LONG )
nTables := CallDll32( cFarProc, ::nJobHandle )
ELSE
cFarProc := GetProcAddress( ::hDll, cFarProc ,.T.,_INT, _INT )
nTables := CallDll( cFarProc, ::nJobHandle )
ENDIF
RETURN nTables
// ==========================================================================
// Method TCrw::PEGetTabLocation // PEGetNthTableLocation()
//
// The PEGetNthTableLocation method determines the location of a selected
// table used in the specified print job. This method is typically combined
// with PESetNthTableLocation to identify the location of a table and then
// to change it.
// ========================================================================== */
METHOD GETTLOC_( nPos )
LOCAL cBuffer
LOCAL nRet
LOCAL cFarProc := "PEGetNthTableLocation"
// Clear Filename-Buffer
//
::lError := .F.
::oTabLocation:SetMember( 2, CHR(0) )
cBuffer := ::oTabLocation:cBuffer
IF ::l32
cFarProc := GetProc32( ::hDll, cFarProc, .T., _INT, LONG, LONG, LPSTR )
nRet := CallDll32( cFarProc, ::nJobHandle, nPos, @cBuffer )
ELSE
cFarProc := GetProcAddress( ::hDll, cFarProc, .T., _INT, _INT, _INT, LPSTR )
nRet := CallDll( cFarProc, ::nJobHandle, nPos, @cBuffer )
ENDIF
::oTabLocation:cBuffer := cBuffer
cBuffer := ::oTabLocation:GetMember( 2 )
IF nRet == FALSE .OR. EMPTY( cBuffer )
MsgAlert( "Error locating Table", ::PEGetErrorCode())
::lError := .T.
ENDIF
RETURN IIF( ::lError, "", TRIM( cBuffer ))
// ==========================================================================
// Method TCrw::PESetTabLocation // peSetNthTableLocation()
//
// The PESetNthTableLocation method sets the location for a selected table
// in the specified print job. This method is typically combined with
// PEGetTableLocation to identify the location of a table and then to
// change it.
// ==========================================================================
METHOD SETTLOC_( nPos, cName )
LOCAL nRet
LOCAL cFarProc := "PESetNthTableLocation"
// Set Filename-Buffer
//
::oTabLocation:SetMember( 2, TRIM( cName ) + CHR(0) )
::lError := .F.
IF ::l32
cFarProc := GetProc32( ::hDll, cFarProc, .T., _INT, LONG, LONG, LPSTR )
nRet := CallDll32( cFarProc, ::nJobHandle, nPos, ::oTabLocation:cBuffer )
ELSE
cFarProc := GetProcAddress( ::hDll, cFarProc, .T., _INT, _INT, _INT, LPSTR )
nRet := CallDll( cFarProc, ::nJobHandle, nPos, ::oTabLocation:cBuffer )
ENDIF
IF nRet == FALSE
::lError := .T.
MsgAlert( "Error setting Location " + cName, ::PEGetErrorText())
ENDIF
RETURN ! ::lError
// ==========================================================================
// Method TCrw::PEGetSqlQuery
//
// You can use this method to retrieve the SQL query that will be generated
// to print the report, and you can update the query using PESetSQLQuery.
//
// ========================================================================== */
METHOD GETSQLQ_()
LOCAL cFarProc := "PEGetSqlQuery"
LOCAL nHandle := 0
LOCAL nLen := 0
LOCAL cBuffer := ""
LOCAL nRet
::lError := .F.
IF ::l32
cFarProc := GetProc32( ::hDll, cFarProc, .T., _INT, LONG, PTR, PTR )
nRet := CallDll32( cFarProc, ::nJobHandle, @nHandle, @nLen )
ELSE
cFarProc := GetProcAddress( ::hDll, cFarProc, .T.,_INT,_INT,PTR,PTR )
nRet := CallDll( cFarProc, ::nJobHandle, @nHandle, @nLen )
ENDIF
IF nRet == FALSE
MsgAlert("Could not get SQL query!" + CRLF )
::lError := .T.
ELSE
cBuffer := ::PEGetHandleString( nHandle, nLen )
ENDIF
RETURN cBuffer
// ==========================================================================
// Method TCrw::PESetSqlQuery
//
// You can use this method to set a SQL query
//
// ========================================================================== */
METHOD SETSQLQ_( cQuery )
LOCAL nRet
LOCAL cFarProc := "PESetSqlQuery"
::lError := .F.
IF ::l32
cFarProc := GetProc32( ::hDll, cFarProc, .T., _INT, LONG, LPSTR )
nRet := CallDll32( cFarProc, ::nJobHandle, cQuery )
ELSE
cFarProc := GetProcAddress( ::hDll, cFarProc, .T., _INT, _INT, LPSTR )
nRet := CallDll( cFarProc, ::nJobHandle, cQuery )
ENDIF
IF nRet == FALSE
MsgAlert('Could not set query!' + CRLF + cQuery )
::lError := .T.
ENDIF
RETURN ! ::lError
// ==========================================================================
// Method TCrw::PETestNTable( n ) // PETestNthTableConnectivity( nPos )
//
// Purpose:
// The PETestNthTableConnectivity method tests whether a database
// table's settings are valid and ready to be reported on.
// This method is typically used if you plan to print at a later time
// but you want to test now to make sure everything is in order for
// logging on.
//
// ========================================================================== */
METHOD TESTTAB_( nPos )
LOCAL nRet
LOCAL cFarProc := "PETestNthTableConnectivity"
LOCAL cError := ""
LOCAL cBuffer
DEFAULT nPos := 0
IF ::l32
cFarProc := GetProc32( ::hDll, cFarProc, .T., _INT, LONG, LONG )
nRet := CallDll32( cFarProc, ::nJobHandle, nPos )
ELSE
cFarProc := GetProcAddress( ::hDll, cFarProc, .T., _INT, WORD, WORD)
nRet := CallDll( cFarProc, ::nJobHandle, nPos )
ENDIF
IF nRet == FALSE
cError := ::PEErrorText()
cBuffer := ::PEGetTabLocation( nPos )
cError += CRLF + "File: " + cBuffer
ENDIF
RETURN cError
// ==========================================================================
// Method TCrw::PEClosePrintJob()
//
// PEClosePrintJob closes the print job. If printing has not yet finished,
// it continues; if the print window is open, it stays open.
// This method is used as a mandatory part of each custom-print link
// to shut down the print job once it has finished printing to screen
// or to window.
// ========================================================================== */
METHOD CLOSEJOB_()
LOCAL nRet
LOCAL cFarProc := "PEClosePrintJob"
::lError := .F.
IF ::nJobHandle != 0
IF ::l32
cFarProc := GetProc32( ::hDll, cFarPRoc, .T., _INT, LONG )
nRet := CallDll32( cFarProc, ::nJobHandle )
ELSE
cFarProc := GetProcAddress( ::hDll, cFarProc, .T., _INT, _INT )
nRet := CallDll( cFarProc, ::nJobHandle )
ENDIF
IF nRet == FALSE
::lError := .T.
ENDIF
ENDIF
RETURN ::lError
// ==========================================================================
// Method TCrw::PECloseEngine()
//
// PECloseEngine terminates the Report Engine. All printing is stopped
// and all windows are closed.
//
// NOTE: This will only happen if the calling application is the
// last one using CRPE !!!
//
// This method stops the Report Engine from sending output, but the
// report may continue to print from data remaining in the spooler.
// This method is a necessary part of any custom-print link. It is
// also required for any print-only link in which you want the report
// to print to a window that is to remain visible after the report is
// printed. It is not necessary to use this method with a print-only link
// where you are directing the report to a printer.
// ========================================================================== */
METHOD PECLOSE_()
LOCAL cFarProc := "PECloseEngine"
IF ::hDll != 0
IF ::l32
cFarProc := GetProc32( ::hDll, cFarProc, .T., _INT )
CallDll32( cFarProc )
ELSE
cFarProc := GetProcAddress( ::hDll, cFarProc, .T., _INT )
CallDll( cFarProc )
ENDIF
ENDIF
RETURN .T.
// ==========================================================================
// Method TCrw::PEGetHandleString( nHandle )
//
// This method will return the text that the string handle is pointing to.
//
// ========================================================================== */
METHOD GETSTR_( nHandle, nLen )
LOCAL nRet
LOCAL cFarProc := "PEGetHandleString"
LOCAL cBuffer := SPACE( nLen )
IF ::l32
cFarProc := GetProc32( ::hDll, cFarProc, .T., _INT, LONG,LPSTR,LONG )
nRet := CallDll32( cFarProc , nHandle, @cBuffer, nLen )
ELSE
cFarProc := GetProcAddress( ::hDll, cFarProc, .T., _INT, _INT,LPSTR,_INT)
nRet := CallDll( cFarProc , nHandle, @cBuffer, nLen )
ENDIF
IF nRet == FALSE
cBuffer := ""
ELSE
cBuffer := SUBSTR( cBuffer, 1, nLen -1 )
ENDIF
RETURN cBuffer
// ==========================================================================
// Method TCrw::GetModuleHandle( lpName )
//
// This method will return the Handle to a Module( Dll ) that is mapped
// into our address space
//
// ========================================================================== */
METHOD GETMOD_( cModule )
LOCAL hDll := LoadLib32( "Kernel32.dll" )
LOCAL cFarProc
LOCAL nRet
cFarProc := GetProc32( hDll, "GetModuleHandleA", .T., LONG, LPSTR )
nRet := CallDll32( cFarProc ,cModule )
RETURN nRet
//
// Devuelve los nombre de los campos de ordenacion del informe
//
METHOD PEGETSOR_( oDlg )
LOCAL nSort
LOCAL cFarProc := "PEGetNSortFields"
If ::l32
cFarProc := GetProc32( ::hDll, cFarProc, .T., _INT, LONG )
nSort := CallDll32( cFarProc, oDlg )
End
Return( nSort )
//
//
//
/*
METHOD PEGETNGR_( oDlg )
LOCAL cGrupos := ::oTabLocation:StrucSize
LOCAL cFarProc := "PEGetNGroups"
If ::l32
cFarProc := GetProc32( ::hDll, cFarProc, .T., _INT, LONG )
cGrupos := CallDll32( cFarProc, oDlg )
End
Return( cGrupos )
*/
Function ScrResolution( nWidth, nHeight)
LOCAL hDC
hDC := CreateDC("DISPLAY", "", "")
nWidth := GetDeviceCaps(hDC, HORZRES)
nHeight := GetDeviceCaps(hDC, VERTRES)
DeleteDC(hDc)
Return {nWidth, nHeight}
UN saludo
JLL
|
need to change a field type on the fly
|
I need to change a field type on the fly and change size etc. I'm lost. Help
|
need to change a field type on the fly
|
Please,
what you have to do?
Marco
|
need to change a field type on the fly
|
I have a field in a data base that for past users is an incorrect data type (character when it should be numeric. My programing error). So I need to change the field from a character to numeric and the length from 4 to 18 and decimals from 0 to 6. It need to be done on the fly.
Thanks for the quick response.
|
need to change a field type on the fly
|
Harvey
Here is what I would do ..
1 - open the database in question .. test for valtype( table->field)
If valtype returns "N" .. then write a routine like this .. ( psudo code )
A) Open your old table excl ..
B) dbcreate a ( temp .. exclusive ) new table with all your fields and the correct the valtype
C) write a routine like this
[code=fw:3lx6vy3t]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #0000ff;">select</span> <span style="color: #000000;">1</span><br />use <span style="color: #000000;">(</span> oldtable <span style="color: #000000;">)</span> via <span style="color: #ff0000;">"dbfcdx"</span> excl<br /><br /><span style="color: #0000ff;">select</span> <span style="color: #000000;">2</span><br />use <span style="color: #000000;">(</span> temp <span style="color: #000000;">)</span> via <span style="color: #ff0000;">"dbfcdx"</span> excl<br /><br /><span style="color: #0000ff;">select</span> <span style="color: #000000;">1</span><br />go top<br /><br /><span style="color: #00C800;">Do</span> <span style="color: #00C800;">while</span> .not. eof<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #0000ff;">select</span> <span style="color: #000000;">2</span><br /> append blank<br /> <span style="color: #B900B9;">// append your fields here</span><br /><br /> <span style="color: #0000ff;">select</span> <span style="color: #000000;">1</span><br /> skip<br /><br />End <span style="color: #00C800;">Do</span><br /><br />CLose databases<br /><br />ferase<span style="color: #000000;">(</span> <span style="color: #ff0000;">"OldTable"</span> <span style="color: #000000;">)</span><br />Rename <span style="color: #000000;">(</span> Temp <span style="color: #000000;">)</span> <span style="color: #0000ff;">to</span> <span style="color: #000000;">(</span> oldtable <span style="color: #000000;">)</span><br /> </div>[/code:3lx6vy3t]
Don't forget to re-index your new table ..
Hope that helps .. you can leave the routine in your program at startup since it will always look for the Valtype( table->field) = "N" .. and since you have made the change .. it will not run your update routine again.
Hope my psudo code makes sense .. if you need any help .. just let me know.
Rick Lipkin
|
need to change a field type on the fly
|
Try this
<!-- m --><a class="postlink" href="http://www.emagsoftware.it/EmagDbu240.zip">http://www.emagsoftware.it/EmagDbu240.zip</a><!-- m -->
All users have to close this dbf
Make a copy of your table
Open dbf with emagdbu
press F3
select wrong field
press RETURN
change type (second column)
change len and dec
click first btnbmp "Conferma"
that's all folks
|
need to change a field type on the fly
|
Rick:
If I append blank it adds another field of the same name to the dbf rather then change the existing field.
|
need to change a field type on the fly
|
Rick, Marco:
Is there a way to remove a field while the program is running then I can append a new field with the same name. Now I get 2 fields with the same name.
|
need to change a field type on the fly
|
You cannot modify dbf structure while the dbf is open by other users
|
need to change a field type on the fly
|
[code=fw:x5ohh3p2]<div class="fw" id="{CB}" style="font-family: monospace;"> <span style="color: #00C800;">if</span> valtype<span style="color: #000000;">(</span>field->RATE<span style="color: #000000;">)</span> == <span style="color: #ff0000;">"C"</span> <span style="color: #000000;">[</span>b<span style="color: #000000;">]</span><span style="color: #B900B9;">// if rate is "C" need to make "Numeric"</span><br /><span style="color: #000000;">[</span>/b<span style="color: #000000;">]</span><br /> copy <span style="color: #0000ff;">to</span> atemp3 structure extended<br /> use atemp3<br /><br /> append blank <span style="color: #B900B9;">// [b:x5ohh3p2]when I append blank it adds another field with the same name. [/b:x5ohh3p2]</span><br /> replace field_name with <span style="color: #ff0000;">"rate"</span>,field_type with <span style="color: #ff0000;">"numeric"</span>,field_len with <span style="color: #000000;">18</span>, field_dec with <span style="color: #000000;">6</span><br /> <br /> create atemp9 <span style="color: #0000ff;">from</span> atemp3<br /> <br /> use atemp9 <span style="color: #0000ff;">alias</span> atemp9<br /> append <span style="color: #0000ff;">from</span> <span style="color: #000000;">(</span>gld<span style="color: #000000;">)</span><br /> <br /> atemp9-><span style="color: #000000;">(</span>dbclosearea<span style="color: #000000;">(</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /> <br /> erase <span style="color: #000000;">(</span>gld<span style="color: #000000;">)</span><br /> <br /> rename atemp9.dbf <span style="color: #0000ff;">to</span> <span style="color: #000000;">(</span>gld<span style="color: #000000;">)</span> <span style="color: #B900B9;">//"gl.d"+cEntity</span><br /> <br /> <span style="color: #00C800;">endif</span></div>[/code:x5ohh3p2]
Code works fine but i have two fields with same name.
|
need to change a field type on the fly
|
Harvy
Consider this code .. add this to your main program and it will run every time
[code=fw:g0mkml51]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><br /><span style="color: #00C800;">Local</span> nType<br /><br /><span style="color: #0000ff;">select</span> <span style="color: #000000;">1</span><br />Use <span style="color: #000000;">(</span> <span style="color: #ff0000;">"OldTable.dbf"</span> <span style="color: #000000;">)</span> via <span style="color: #ff0000;">"DBFCDX"</span> Shared <span style="color: #B900B9;">// test in shared first</span><br /><br />nType := valtype<span style="color: #000000;">(</span> a->fieldinquestion<span style="color: #000000;">)</span><br />Close databases<br /><br /><span style="color: #00C800;">If</span> nType = <span style="color: #ff0000;">"N"</span><br /> _Update<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><span style="color: #00C800;">Else</span><br /> CLose Databases<br /><span style="color: #00C800;">Endif</span><br /><br /><span style="color: #B900B9;">//--------------</span><br /><span style="color: #00C800;">Static</span> Func _Update<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">Local</span> DBFSTRU<br /><br />DBF_STRU := <span style="color: #000000;">{</span> <span style="color: #000000;">}</span><br />AADD<span style="color: #000000;">(</span> DBF_STRU, <span style="color: #000000;">{</span> <span style="color: #ff0000;">"FIELD1"</span>, <span style="color: #ff0000;">"C"</span>, <span style="color: #000000;">18</span>, <span style="color: #000000;">0</span> <span style="color: #000000;">}</span> <span style="color: #000000;">)</span><br />AADD<span style="color: #000000;">(</span> DBF_STRU, <span style="color: #000000;">{</span> <span style="color: #ff0000;">"FIELD2, "</span>C<span style="color: #ff0000;">", 30, 0 } )<br />AADD( DBF_STRU, { "</span>FIELDTOCHANGE<span style="color: #ff0000;">", "</span>N<span style="color: #ff0000;">", 1, 6 } ) // was char in orig table<br />//.. add the rest or your fields from the orig table here<br /> )<br /><br />DBCREATE( TEMP.DBF, DBF_STRU )<br /><br />Select 1<br />Use ( "</span>OldTable.dbf<span style="color: #ff0000;">" ) via "</span>DBFCDX<span style="color: #ff0000;">" Excl<br /><br />Select 2<br />Use ("</span>Temp.dbf<span style="color: #ff0000;">") via "</span>DBFCDX<span style="color: #ff0000;">" Excl<br /><br />Select 1<br />Go Top<br /><br />Do While .not. eof<br /> <br /> select 2<br /> append blank<br /><br /> b->field1 := a->field1<br /> b->field2 := a->field2<br /> b->FIELDTOCHANGE := val(a->oldfield) // may have to convert to val with dec<br /> <br /> select 1<br /> skip<br /><br />Enddo<br /><br />CLose databases<br /><br />ferase( "</span>OldTable.dbf<span style="color: #ff0000;">" )<br />rename ( "</span>temp.dbf<span style="color: #ff0000;">" ) to ( "</span>OldTable.dbf<span style="color: #ff0000;">" )<br /><br />Return(.t.)<br /> <br /></span></div>[/code:g0mkml51]
|
need to change a field type on the fly
|
Thank you all for the help. Couldn't get it working. Came up with a solution which is not on the fly. Thanks again.
|
need to close others windows when my application is running
|
Hi All !
My application is running, but users playing the games. <!-- s:twisted: --><img src="{SMILIES_PATH}/icon_twisted.gif" alt=":twisted:" title="Twisted Evil" /><!-- s:twisted: -->
How to close others active windows when my application is running.
Thank's for help
Best Regards
Areang
|
need to close others windows when my application is running
|
[code:18yammrs]#define GW_HWNDFIRST 0
#define GW_HWNDLAST 1
#define GW_HWNDNEXT 2
#define GW_HWNDPREV 3
#define GW_OWNER 4
#define GW_CHILD 5
#define WM_CLOSE 16
STATIC FUNCTION CLOSEAPPS( hMWnd )
LOCAL ahWnd := {}
LOCAL hWnd := GETWINDOW( hMWnd, GW_HWNDFIRST )
LOCAL i
SYSREFRESH()
WHILE hWnd != 0
IF GETWINDOW( hWnd, GW_OWNER ) = 0 .AND.;
ISWINDOWVISIBLE( hWnd ) .AND.;
hWnd != hMWnd .AND.;
!EMPTY( GETWINDOWTEXT( hWnd ) ) .AND.;
!( GETWINDOWTEXT( hWnd ) == "Program Manager" )
AADD( ahWnd, hWnd )
ENDIF
hWnd = GETWINDOW( hWnd, GW_HWNDNEXT )
ENDDO
FOR i = 1 TO LEN( ahWnd )
POSTMESSAGE( ahWnd[ i ], WM_CLOSE, 0, 0 )
NEXT
RETURN NIL[/code:18yammrs]
EMG
|
need to close others windows when my application is running
|
Areang,
Here is my LanHouse Spy. To use it.
1 - Create a C:\Spyfolder on server and install the LanHouse Spy.
2 - Share the C:\SpyFolder to other machines.
3 - Exec the LanHouse Spy on each machine.
To lock one machine, open ACESSOS.DBF on server, locate user and change status for STATUS field, true or false.
Implement the Enrico's code to improve.
Full SERVICE.PRG code
[code:tfdhazfc]
#include "FiveWin.ch"
#include "dll.ch"
#DEFINE WM_SYSCOMMAND 274 // &H112
#DEFINE SC_TASKLIST 61744 //&HF130
#DEFINE SC_SCREENSAVE 61760 // &HF140
#DEFINE SW_HIDE 0 // &H0
#DEFINE SW_SHOWNA 8 // &H8
#DEFINE SW_SHOW 5 // &H5
#DEFINE SW_SHOWNORMAL 1
#DEFINE SC_MONITORPOWER 61808 //&HF170 Gracias a Ramon Ramirez por la info
#DEFINE SM_CLEANBOOT 67
#DEFINE GWL_EXSTYLE (-20)
#DEFINE WS_EX_LAYERED 0x00080000
#DEFINE LWA_ALPHA 0x00000002
#DEFINE LWA_COLORKEY 0x00000001
#DEFINE GW_CHILD 5
#DEFINE GW_HWNDNEXT 2
#DEFINE RT_BITMAP 2
#DEFINE MB_ICONEXCLAMATION 48
#DEFINE CBM_INIT 4 && should move to prg header
#DEFINE DIB_RGB_COLORS 0 && should move to prg header
static hLib, hDib
Function Main(_tempo_)
Local oB, oApp, oIcon, oTimer, cImgFile := "service.bmp", oClp
public cUsuario := space(15), cImage, cIMGAlerta, oEsconde
lStatus := .f.
Default _tempo_ := "05"
cPath := cFilePath( GetModuleFileName( GetInstance() ) )
nTempo := VerifyINI( "SERVICE", "TEMPO" , "360", cPath+"service.ini" )
cImage := VerifyINI( "SERVICE", "IMAGEM", "NAO", cPath+"service.ini" )
cIMGAlerta := VerifyINI( "SERVICE", "ALERTA", "SIM", cPath+"service.ini" )
//hLib := LoadLibrary( "freeimage.dll" )
//if hLib <= 32
// MsgStop( "Freeimage.dll nao foi carregada" )
// return 0
//endif
if !file("service.dbf")
DbCreate("service.dbf",{ { "Usuario" , "C", 15, 0},;
{ "Data" , "D", 8, 0},;
{ "Hora" , "C", 8, 0},;
{ "Imagem" , "C", 30, 0} } )
endif
if !file("acessos.dbf")
DbCreate("acessos.dbf",{ { "Usuario" , "C", 15, 0},; // Pode ser IP
{ "Serial" , "C", 10, 0},;
{ "Data" , "D", 8, 0},;
{ "HoraINI" , "C", 8, 0},;
{ "HoraFIM" , "C", 8, 0},;
{ "Status" , "L", 1, 0},;
{ "Imagem" , "C", 30, 0} } )
endif
USE service NEW SHARED
USE acessos NEW SHARED
HDSerial := HDSerial()
dbGoTop()
locate for alltrim(acessos->serial) = alltrim(HDSerial)
if .not. found()
MsgGet( "Configuracao", "Nick do Usuario:", @cUsuario )
dbNetAppend( 0 ) // Adiciona usuario a lista
acessos->Data := Date() // coloca a data do dia do acesso
acessos->Usuario := cUsuario // coloca o nome do usuario
acessos->Serial := HDSerial // coloca o nome do usuario
acessos->Status := .F. // e autentica o usuario mas nao libera
dbNetReglock()
else
lStatus := acessos->Status // verifica se o usuario esta liberado
endif
dbSelectArea( "acessos" )
set filter to alltrim(acessos->serial) = alltrim(HDSerial)
dbGoTop()
//---------------
ServiceProcess(1)
//---------------
DEFINE BRUSH oB COLOR CLR_HGRAY
DEFINE ICON oIcon FILE "LOGO.ICO"
DEFINE CLIPBOARD oClp OF oApp
//ShowWindow( FindWindow(nil,'Program Manager'), SW_SHOW)
//ShowWindow(FindWindow( 'Shell_TrayWnd',nil), SW_SHOWNA)
//if ! lStatus
// cBmp := "service.bmp"
// DEFINE BRUSH oBrush STYLE NULL
// DEFINE BITMAP oBmp FILENAME cBmp
// hDC := oBmp:hDC
// DEFINE WINDOW oEsconde FROM 0,0 TO 600,800 PIXEL BRUSH oBrush STYLE WS_POPUP
// ACTIVATE WINDOW oEsconde ON PAINT PalBmpDraw( hDC, 0, 0, oBmp:hBitmap )
//endif
DEFINE WINDOW oApp FROM 0,0 to 1,1 pixel TITLE "Service" BRUSH oB STYLE WS_POPUP ICON "racer.ico"
DEFINE TIMER oTimer OF oApp INTERVAL (val(_tempo_)*1000) ACTION GravaProcess( cImgFile, oApp )
ACTIVATE TIMER oTimer
ACTIVATE WINDOW oApp ON INIT (Shell_NotifyIcon( 0, "racer.ico" ), oApp:Hide()) //VALID (oEsconde:End(), .t.)
ShowWindow( FindWindow(nil,'Program Manager'), SW_SHOW)
ShowWindow(FindWindow( 'Shell_TrayWnd',nil), SW_SHOWNA)
Return NIL
//-------------------------------------
Function GravaProcess( cImgFile, oWnd )
//-------------------------------------
if cImage = "SIM"
//hWnd := FindWindow(nil,'Program Manager')
//hBmp := WndBitmap( hWnd )
//fErase(cImgFile)
//hDib := DibFromBitmap( hBmp )
//DibWrite( cImgFile, hDib )
//WaitRun( "nconvert -out jpeg -q 100 -D "+cImgFile, 0 )
dbSelectArea( "service" )
dbAppend()
service->usuario := NetName()
service->data := Date()
service->hora := Time()
service->imagem := StrTran( cImgFile, ".bmp", ".jpg" )
dbNetReglock()
endif
//USE service SHARED
//dbCloseAll()
if cIMGAlerta = "SIM"
//Ballon("C A P T U R E I "+acessos->USUARIO,2)
Ballon("Capturei mais uma imagem",2)
endif
dbSelectArea( "acessos" )
dbGoTop()
lStatus := acessos->Status
if lStatus // Se usuario esta liberado para uso da maquina ela sera ativada
//Ballon("M O S T R A N D O "+acessos->USUARIO,2)
WinExec( "servshow", 7 )
ShowWindow( FindWindow(nil,'Program Manager'), SW_SHOW)
ShowWindow(FindWindow( 'Shell_TrayWnd',nil), SW_SHOWNA)
else
//Ballon("E S C O N D E N D O "+acessos->USUARIO,2)
WinExec( "servhide", 7 )
ShowWindow(FindWindow( 'Shell_TrayWnd',nil), SW_HIDE)
ShowWindow( FindWindow(nil,'Program Manager'), SW_HIDE)
endif
//lOk := fiSave( 0, hDib, cImgFile )
//if !lOk
// MsgInfo( "Can't not save file" )
//endif
//MsgRun('gravei')
Return NIL
//-------------------------------------
Function ServiceProcess( mode )
//-------------------------------------
Local nProcessId := 0
Default mode := 0
nProcessId := GCP( )
If Abs( nProcessId ) > 0
RSProcess( nProcessId, mode )
Endif
RETURN
//-------------------------------------
Function Ballon(cBallonMsg,nBallonTime)
//-------------------------------------
local oDlgBallon, oBrush
default cBallonMsg := "Nova mensagem chegando..."
DEFINE WINDOW oDlgBallon ;
FROM GetSysMetrics(1),GetSysMetrics(0)-300 TO 200,200 PIXEL ;
COLOR nRGB(255,255,255),nRGB(255,255,230) ;
NO CAPTION BORDER NONE
@ 5, 5 GET cBallonMsg MEMO OF oDlgBallon SIZE 195,195 PIXEL COLOR nRGB(000,000,000),nRGB(255,255,230) NOBORDER NO MODIFY NO VSCROLL
//ACTIVATE WINDOW oDlgBallon ON INIT ( LayeredWindow( oDlgBallon, 070 ), MoveDLG(oDlgBallon,nBallonTime) )
ACTIVATE WINDOW oDlgBallon ON INIT MoveDLG(oDlgBallon,nBallonTime)
return nil
//-------------------------------------
Function LayeredWindow( oWnd, nLay )
//-------------------------------------
//SetWindowLong( oWnd:hWnd, GWL_EXSTYLE, GetWindowLong( oWnd:hWnd, GWL_EXSTYLE ) | WS_EX_LAYERED )
SetWindowLong( oWnd:hWnd, GWL_EXSTYLE, WS_BORDER )
SetWindowLong( oWnd:hWnd, GWL_EXSTYLE, WS_EX_LAYERED )
SetLayeredWindowAttributes( oWnd:hWnd, 0, ( 255 * nLay ) / 100, LWA_ALPHA )
Return NIL
//-------------------------------------
Function dbNetCommit( tempo )
//-------------------------------------
private sempre
dbCommit()
dbRUnlock() // tenta incluir registro
if RLock() // se conseguiu
mensagem(" Aguarde... Tentando liberar o registro")// se nao conseguiu
sempre = (tempo = 0) // fica tentando inclusao
for i = 1 to 10 // ate o tempo esgotar ou
dbRUnlock() // o usuario se encher...
if .not. neterr()
return .t.
endif
inkey(.5) && espera 1/2 segundo
tempo = tempo - .5
next
endif
return (.f.) && nao bloqueado
//-------------------------------------
Function dbNetAppend( tempo )
//-------------------------------------
private sempre
dbappend() // tenta incluir registro
if .not. neterr() // se conseguiu
return (.t.) // retorna verdadeiro
endif
mensagem(" Aguarde... Tentando Acesso aos Arquivos ") // se nao conseguiu
sempre = (tempo = 0) // fica tentando inclusao
do while (sempre .or. tempo > 0) .and. inkey()<>27 // ate o tempo esgotar ou
dbappend() // o usuario se encher...
if .not. neterr()
return .t.
endif
inkey(.5) && espera 1/2 segundo
tempo = tempo - .5
enddo
return (.f.) && nao bloqueado
//-------------------------------------
Function dbNetReglock( tempo )
//-------------------------------------
private sempre
if rlock()
return (.t.) && bloqueado
endif
dbUnlockAll()
mensagem(" Aguarde... Tentando Acesso aos Arquivos ")
sempre = (tempo = 0)
do while (sempre .or. tempo > 0) .and. inkey()<>27
if rlock()
return (.t.) && bloqueado
endif
inkey(.5) && espera 1/2 segundo
tempo = tempo - .5
enddo
return (.f.) && nao bloqueado
//-------------------------------------
Function MoveDLG(oDlgBallon,oDlgTime)
//-------------------------------------
oDlgAltura := GetSysMetrics(1)
for i = 1 to 20
oDlgAltura := oDlgAltura - i
oDlgBallon:Move( oDlgAltura, 100, 200, 200, .t. )
SysWait(.02)
next
SysWait(oDlgTime)
for i = 1 to 20
oDlgAltura := oDlgAltura + i
oDlgBallon:Move( oDlgAltura, 100, 200, 200, .t. )
SysWait(.02)
next
oDlgBallon:end()
return
//-------------------------------------
Function HDSERIAL()
//-------------------------------------
return substr(alltrim(str(nSerialHD())),1,8)
//-------------------------------------
Function MENSAGEM( MENSAGEM, TEMPO )
//-------------------------------------
if tempo <> NIL
MsgStop( OemToAnsi(MENSAGEM) )
else
MsgRun( OemToAnsi(MENSAGEM) )
endif
//-------------------------------------
Function Ping(DestinationAddress)
//-------------------------------------
local IcmpHandle,Replicas
local RequestData:="Testando ping",;
RequestSize:=15,;
RequestOptions:="",;
ReplyBuffer:=space(278),;
ReplySize:=278,;
Timeout:=500 && Milisegundos de espera
default DestinationAddress := "10.10.10.3"
DestinationAddress:=left(alltrim(DestinationAddress)+space(15),15)
//MsgGet("Ping...","Introduzca dirección IP",@DestinationAddress)
IcmpHandle:=IcmpCreateFile()
Replicas:=IcmpSendEcho(IcmpHandle,;
inet_addr(DestinationAddress),;
RequestData,;
RequestSize,0,;
ReplyBuffer,;
ReplySize,;
Timeout)
IcmpCloseHandle(IcmpHandle)
if Replicas > 0
msginfo("A maquina "+alltrim(DestinationAddress)+" existe")
else
msginfo("A maquina "+alltrim(DestinationAddress)+" nao existe")
endif
return nil
//----------------------------------------------------
DLL32 FUNCTION RSProcess(npID AS LONG ,nMode AS LONG ) AS LONG FROM "RegisterServiceProcess" LIB "kernel32.DLL"
DLL32 FUNCTION GCP() AS LONG FROM "GetCurrentProcessId" LIB "kernel32.dll"
DLL32 STATIC FUNCTION FISAVE( nFormat AS LONG, hDib AS LONG, cFileName AS LPSTR, nFlags AS LONG ) AS BOOL PASCAL FROM "_FreeImage_Save@16" LIB hLib
//----------------------------------------------------
DLL32 FUNCTION WSAGetLastError() AS _INT PASCAL FROM "WSAGetLastError" LIB "wsock32.dll"
DLL32 FUNCTION inet_addr(cIP AS STRING) AS LONG PASCAL FROM "inet_addr" LIB "wsock32.dll"
DLL32 FUNCTION IcmpCreateFile() AS LONG PASCAL FROM "IcmpCreateFile" LIB "icmp.dll"
DLL32 FUNCTION IcmpCloseHandle(IcmpHandle AS LONG) AS LONG PASCAL FROM "IcmpCloseHandle" LIB "icmp.dll"
DLL32 FUNCTION IcmpSendEcho(IcmpHandle AS LONG,;
DestinationAddress AS LONG,;
RequestData AS STRING,;
RequestSize AS LONG,;
RequestOptions AS LONG,;
ReplyBuffer AS LPSTR,;
ReplySize AS LONG,;
Timeout AS LONG) AS LONG PASCAL FROM "IcmpSendEcho" LIB "icmp.dll"
#include "errorsys.prg"
function VerifyINI( _section_, _entry_, _var_, _inifile_, _grava_ )
oIni := TIni():New( _inifile_ )
if _grava_ = .t.
oIni:Set( _section_, _entry_, _var_ )
endif
return oIni:Get( _section_, _entry_, _var_, _var_ )
[/code:tfdhazfc]
To save a photo of terminal change the lines below:
[code:tfdhazfc]
...
//hWnd := FindWindow(nil,'Program Manager')
//hBmp := WndBitmap( hWnd )
//fErase(cImgFile)
//hDib := DibFromBitmap( hBmp )
//DibWrite( cImgFile, hDib )
//WaitRun( "nconvert -out jpeg -q 100 -D "+cImgFile, 0 )
...
[/code:tfdhazfc]
|
need to close others windows when my application is running
|
Enrico where to put your static function in the main program ?
|
need to close others windows when my application is running
|
Just remove STATIC and put it anywhere.
EMG
|
need to close others windows when my application is running
|
Hello Mr. Enrico !
I tested this but not work
[code:1ksy2wr2]
GETWINDOWTEXT( hWnd ) == "Program Manager"
[/code:1ksy2wr2]
Is [b:1ksy2wr2]"Program Manager"[/b:1ksy2wr2] the title of Windows from this :
DEFINE DIALOG oDlg FROM 1,1 TO 200,200 TITLE [b:1ksy2wr2]"Program Manager"[/b:1ksy2wr2]
I have 2 windows set to title "Dialog1" and "Dialog2"
but not work to close with this source code :
[code:1ksy2wr2]
WHILE hWnd != 0
IF GETWINDOW( hWnd, GW_OWNER ) = 0 .AND.;
ISWINDOWVISIBLE( hWnd ) .AND.;
hWnd != hMWnd .AND.;
!EMPTY( GETWINDOWTEXT( hWnd ) ) .AND.;
!( GETWINDOWTEXT( hWnd ) == "Program Manager" )
AADD( ahWnd, hWnd )
ENDIF
hWnd = GETWINDOW( hWnd, GW_HWNDNEXT )
ENDDO
FOR i = 1 TO LEN( ahWnd )
POSTMESSAGE( ahWnd[ i ], WM_CLOSE, 0, 0 )
NEXT
[/code:1ksy2wr2]
Regards
Areang
|
need to create an array
|
I want to create an array from a data base of a specific range of accounts. The accounts are the first field of the data base.
Some of the accounts may not exist so it needs to stop at the last number available in the range.
I don't know how to do this.
All help will be appreciated.
Thanks
|
need to create an array
|
Harvey,
Try something like this. I haven't tested it, cAlias may need to be surrounded by parens, and field(1) maybe doesn't need to be. My memory is a little foggy on this.
If you can't get it working, then send me a sample database, and I will.
James
[code=fw:39h060j2]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00C800;">local</span> aAccounts:=<span style="color: #000000;">{</span><span style="color: #000000;">}</span><br /><br /><span style="color: #0000ff;">select</span> cAlias<br />set filter <span style="color: #0000ff;">to</span> ;<br /> cAlias-><span style="color: #000000;">(</span> field<span style="color: #000000;">(</span><span style="color: #000000;">1</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span> >= cStartAcctNo .and. ;<br /> cAlias-><span style="color: #000000;">(</span> field<span style="color: #000000;">(</span><span style="color: #000000;">1</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span> <= cEndAcctNo<br /> <br />cAlias->dbgotop<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">do</span> <span style="color: #00C800;">while</span> ! cAlias-><span style="color: #000000;">(</span>eof<span style="color: #000000;">(</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /> aadd<span style="color: #000000;">(</span> aAccounts, cAlias-><span style="color: #000000;">(</span>field<span style="color: #000000;">(</span><span style="color: #000000;">1</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /> cAlias-><span style="color: #000000;">(</span>dbskip<span style="color: #000000;">(</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /><span style="color: #00C800;">enddo</span><br /> </div>[/code:39h060j2]
|
need to create an array
|
As always thanks for the in put.
|
need working buildh32.bat
|
hi,
i can compile fiveDBU using buildh64.bat but get Error with buildh32.bat
now i have try to "compare" both
buildh64.bat
[code=fw:iqha0tac]<div class="fw" id="{CB}" style="font-family: monospace;">%hdir%\bin\win\msvc64\harbour %<span style="color: #000000;">1</span> /n /i%fwdir%\include;%hdir%\include /w /p /d__64__ %<span style="color: #000000;">2</span> %<span style="color: #000000;">3</span> > comp.log <span style="color: #000000;">2</span>> warnings.log<br />...<br />cl -TP -W3 -O2 -c -I%hdir%\include -I<span style="color: #ff0000;">"%ProgramFiles(x86)%<span style="color: #000000;">\W</span>indows Kits"</span>\<span style="color: #000000;">10</span>\Include\<span style="color: #000000;">10.0</span><span style="color: #000000;">.18362</span><span style="color: #000000;">.0</span>\ucrt %<span style="color: #000000;">1</span>.c<br />...<br /><br /><span style="color: #00C800;">IF</span> EXIST %<span style="color: #000000;">1</span>.rc rc -r -D__64__ %<span style="color: #000000;">1</span><br />...<br />echo %fwdir%\lib\FiveH64.lib %fwdir%\lib\FiveHC64.lib %fwdir%\lib\libmariadb64.lib >> msvc.tmp<br />...<br />link @msvc.tmp /nologo /subsystem:<span style="color: #000000;">windows</span> /force:<span style="color: #000000;">multiple</span></div>[/code:iqha0tac]
buildh32.bat
[code=fw:iqha0tac]<div class="fw" id="{CB}" style="font-family: monospace;">%hdir%\bin\harbour %<span style="color: #000000;">1</span> /n /i%fwh%\include;%hdir%\include /w /p %<span style="color: #000000;">2</span> %<span style="color: #000000;">3</span> > comp.log <span style="color: #000000;">2</span>> warnings.log<br />...<br />cl.exe -TP -W3 -c /GS- /I%hdir%\include /GA %<span style="color: #000000;">1</span>.c<br />...<br /><span style="color: #00C800;">IF</span> EXIST %<span style="color: #000000;">1</span>.rc rc -r -d__FLAT__ %<span style="color: #000000;">1</span><br /><span style="color: #00C800;">IF</span> EXIST %<span style="color: #000000;">1</span>.rc <span style="color: #00C800;">IF</span> NOT EXIST %<span style="color: #000000;">1</span>.res rc -r -d__FLAT__ %<span style="color: #000000;">1</span><br />...<br />echo %fwh%\lib\FiveH32.lib %fwh%\lib\FiveHC32.lib %fwh%\lib\libmysql32.lib >> msvc.tmp<br /><span style="color: #B900B9;">// not under 64 Bit</span><br />echo runtimeobject.lib >> msvc.tmp<br />...<br />link @msvc.tmp /nologo /subsystem:<span style="color: #000000;">windows</span> /NODEFAULTLIB:<span style="color: #000000;">msvcrt</span></div>[/code:iqha0tac]
so there are Difference between both *.BAT
who have a working buildh32.bat which can build FiveDBU 32 Bit using MSVC <!-- s:?: --><img src="{SMILIES_PATH}/icon_question.gif" alt=":?:" title="Question" /><!-- s:?: -->
|
need working buildh32.bat
|
Dear Jimmy,
This buildh32.bat properly builds FiveDbu here:
buildh32.bat
[code=fw:2recagp7]<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;">22.12</span> <span style="color: #000000;">(</span>VS32bits<span style="color: #000000;">)</span> Dec. <span style="color: #000000;">2022</span> Harbour development <span style="color: #0000ff;">power</span> ³Ü<br />ECHO ³ <span style="color: #000000;">(</span>c<span style="color: #000000;">)</span> FiveTech <span style="color: #000000;">1993</span><span style="color: #000000;">-2022</span> <span style="color: #00C800;">for</span> Microsoft Windows 9X/NT/200X/ME/XP/Vista/<span style="color: #000000;">7</span>/<span style="color: #000000;">8</span>/<span style="color: #000000;">10</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 />set oldpath=%Path%<br />set oldinclude=%include%<br />set oldlib=%lib%<br />set oldlibpath=%libpath%<br />@set current_dir=%cd%<br />setlocal<br />call <span style="color: #ff0000;">"%ProgramFiles%<span style="color: #000000;">\M</span>icrosoft Visual Studio<span style="color: #000000;">\2</span>022<span style="color: #000000;">\C</span>ommunity<span style="color: #000000;">\V</span>C<span style="color: #000000;">\A</span>uxiliary<span style="color: #000000;">\B</span>uild<span style="color: #000000;">\v</span>cvarsall.bat"</span> x86<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 /><br />ECHO Compiling...<br /><br />@set fwh=%FWDIR%<br />@set hdir=%HBDIR%<br />@set hdirl=%hdir%\lib\win\msvc<br /><br />@cd %current_dir%<br />%hdir%\bin\win\msvc\harbour %<span style="color: #000000;">1</span> /n /i%fwh%\include;%hdir%\include /w /p %<span style="color: #000000;">2</span> %<span style="color: #000000;">3</span> > comp.log <span style="color: #000000;">2</span>> warnings.log<br /><span style="color: #00C800;">IF</span> ERRORLEVEL <span style="color: #000000;">1</span> GOTO COMPILEERROR<br />@type comp.log<br />@type warnings.log<br /><br />cl.exe -nologo -c -O2 -W4 -wd4127 /I%hdir%\include %<span style="color: #000000;">1</span>.c<br />:<span style="color: #000000;">ENDCOMPILE</span><br /><br /><span style="color: #00C800;">IF</span> EXIST %<span style="color: #000000;">1</span>.rc rc -r -d__FLAT__ %<span style="color: #000000;">1</span><br /><span style="color: #00C800;">IF</span> EXIST %<span style="color: #000000;">1</span>.rc <span style="color: #00C800;">IF</span> NOT EXIST %<span style="color: #000000;">1</span>.res rc -r -d__FLAT__ %<span style="color: #000000;">1</span><br /><br />echo %<span style="color: #000000;">1</span>.obj > msvc.tmp<br /><br />echo %fwh%\lib\FiveH32.lib %fwh%\lib\FiveHC32.lib %fwh%\lib\libmysql32.lib >> msvc.tmp<br /><br />echo %fwh%\lib\hbhpdf32.lib >> msvc.tmp<br />echo %fwh%\lib\libhpdf32.lib >> msvc.tmp<br />echo %hdirl%\hbrtl.lib >> msvc.tmp<br />echo %hdirl%\hbvm.lib >> msvc.tmp<br />echo %hdirl%\gtgui.lib >> msvc.tmp<br />echo %hdirl%\hblang.lib >> msvc.tmp<br />echo %hdirl%\hbmacro.lib >> msvc.tmp<br />echo %hdirl%\hbrdd.lib >> msvc.tmp<br />echo %hdirl%\rddntx.lib >> msvc.tmp<br />echo %hdirl%\rddcdx.lib >> msvc.tmp<br />echo %hdirl%\rddfpt.lib >> msvc.tmp<br />echo %hdirl%\hbsix.lib >> msvc.tmp<br />echo %hdirl%\hbdebug.lib >> msvc.tmp<br />echo %hdirl%\hbcommon.lib >> msvc.tmp<br />echo %hdirl%\hbpp.lib >> msvc.tmp<br />echo %hdirl%\hbcpage.lib >> msvc.tmp<br />echo %hdirl%\hbwin.lib >> msvc.tmp<br />echo %hdirl%\hbcplr.lib >> msvc.tmp<br />echo %hdirl%\hbpcre.lib >> msvc.tmp<br />echo %hdirl%\hbct.lib >> msvc.tmp<br />echo %hdirl%\xhb.lib >> msvc.tmp<br />echo %hdirl%\png.lib >> msvc.tmp<br />echo %hdirl%\hbzlib.lib >> msvc.tmp<br />echo %hdirl%\hbziparc.lib >> msvc.tmp<br />echo %hdirl%\hbmzip.lib >> msvc.tmp<br />echo %hdirl%\minizip.lib >> msvc.tmp<br />echo %hdirl%\hbtip.lib >> msvc.tmp<br />echo %hdirl%\hbzebra.lib >> msvc.tmp<br /><br />rem Uncomment these two lines <span style="color: #0000ff;">to</span> use Advantage RDD<br />rem echo %hdirl%\rddads.lib >> msvc.tmp<br />rem echo %hdirl%\ace32.lib >> msvc.tmp<br /><br />echo kernel32.lib >> msvc.tmp<br />echo user32.lib >> msvc.tmp<br />echo gdi32.lib >> msvc.tmp<br />echo winspool.lib >> msvc.tmp<br />echo comctl32.lib >> msvc.tmp<br />echo comdlg32.lib >> msvc.tmp<br />echo advapi32.lib >> msvc.tmp<br />echo shell32.lib >> msvc.tmp<br />echo ole32.lib >> msvc.tmp<br />echo oleaut32.lib >> msvc.tmp<br />echo uuid.lib >> msvc.tmp<br />echo odbc32.lib >> msvc.tmp<br />echo odbccp32.lib >> msvc.tmp<br />echo iphlpapi.lib >> msvc.tmp<br />echo mpr.lib >> msvc.tmp<br />echo version.lib >> msvc.tmp<br />echo wsock32.lib >> msvc.tmp<br />echo msimg32.lib >> msvc.tmp<br />echo oledlg.lib >> msvc.tmp<br />echo psapi.lib >> msvc.tmp<br />echo gdiplus.lib >> msvc.tmp<br />echo winmm.lib >> msvc.tmp<br />echo vfw32.lib >> msvc.tmp<br />echo runtimeobject.lib >> msvc.tmp<br />echo ws2_32.lib >> msvc.tmp<br />echo shlwapi.lib >> msvc.tmp<br />echo strmiids.lib >> msvc.tmp<br /><br /><span style="color: #00C800;">IF</span> EXIST %<span style="color: #000000;">1</span>.res echo %<span style="color: #000000;">1</span>.res >> msvc.tmp<br /><br />@link @msvc.tmp /nologo /subsystem:<span style="color: #000000;">windows</span> /NODEFAULTLIB:<span style="color: #000000;">msvcrt</span><br /><br /><span style="color: #00C800;">IF</span> ERRORLEVEL <span style="color: #000000;">1</span> GOTO LINKERROR<br />ECHO * Application successfully built *<br />@set include=%oldinclude%<br />@set lib=%oldlib%<br />@set libpath=%oldlibpath%<br />@set oldpath=%Path%<br />@set oldinclude=<span style="color: #ff0000;">""</span><br />@set oldlib=<span style="color: #ff0000;">""</span><br />@set oldlibpath=<span style="color: #ff0000;">""</span><br />@set Path=%oldpath%<br />endlocal<br />%<span style="color: #000000;">1</span><br />GOTO EXIT<br />ECHO<br /><br />rem delete temporary files<br />@del %<span style="color: #000000;">1</span>.c<br />@del msvc.tmp<br /><br />:<span style="color: #000000;">COMPILEERROR</span><br />@type comp.log<br />@type warnings.log<br />ECHO * Compiling errors *<br />GOTO EXIT<br /><br />:<span style="color: #000000;">LINKERROR</span><br />ECHO * Linking errors *<br />GOTO EXIT<br /><br />:<span style="color: #000000;">SINTAX</span><br />ECHO SYNTAX: <span style="color: #000000;">Build</span> <span style="color: #000000;">[</span>Program<span style="color: #000000;">]</span> <span style="color: #000000;">{</span>-- No especifiques la extensi?n PRG<br />ECHO <span style="color: #000000;">{</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:2recagp7]
|
net use n: \\myserver\apps
|
Hi,
this batch file works fine:
net use n: \\dbserver\apps /user:marco mypassword
n:
cd\testprog
test.exe
c:
net use n: /delete
Is it possible to use fivewin/xHarbour program?
Thanks
marco
|
net use n: \\myserver\apps
|
Use this mode.
If after running test.exe remove the unit n, test.exe may collapse, test.exe should generate a return variable or a file flag, to establish whether test.exe terminates, then remove the unit n.
is to be tested
[code=fw:3c8ix7mr]<div class="fw" id="{CB}" style="font-family: monospace;"><br />...<br />..<br />.<br />cRVar := <span style="color: #ff0000;">" <span style="color: #000000;">\\</span>dbserver<span style="color: #000000;">\a</span>pps /user:marco mypassword"</span><br /><br /> cOrden := <span style="color: #ff0000;">"net use "</span> + cRVar<br /> cOrden := <span style="color: #ff0000;">"COMMAND.COM /C "</span> + cOrden<br /> WaitRun<span style="color: #000000;">(</span>cOrden, <span style="color: #000000;">0</span><span style="color: #000000;">)</span> <span style="color: #B900B9;">// ejecutor externo</span><br /><br />WinExec<span style="color: #000000;">(</span><span style="color: #ff0000;">"test.exe"</span><span style="color: #000000;">)</span><br /><span style="color: #00C800;">If</span> file<span style="color: #000000;">(</span><span style="color: #ff0000;">"n:oktest.flg"</span><span style="color: #000000;">)</span><br /> cOrden := <span style="color: #ff0000;">"net use n: /delete"</span><br /> cOrden := <span style="color: #ff0000;">"COMMAND.COM /C "</span> + cOrden<br /> WaitRun<span style="color: #000000;">(</span>cOrden, <span style="color: #000000;">0</span><span style="color: #000000;">)</span> <span style="color: #B900B9;">// ejecutor externo</span><br /><span style="color: #00C800;">EndIf</span><br />.<br />..<br />...<br /> </div>[/code:3c8ix7mr]
|
net use n: \\myserver\apps
|
I Log to server with this fivewin app from c:\myfolder
#include "fivewin.ch"
FUNCTION MAIN( )
Waitrun( "net use n: \\dbserver\apps /user:marco mypassword" , 0 )
lChdir( "n:\testprog" )
Winexec( "test.exe" , 1)
RETURN NIL
At the end of test.prg
lChdir( "c:\myfolder" )
WinExec( "net use n: /delete" , 0 )
RETURN NIL
thanks you all for your attention
Marco
|
net use n: \\myserver\apps
|
Another way to do the following tasks. <!-- s:) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":)" title="Smile" /><!-- s:) -->
1. Map a network drive
2. Remove a mapped network drive
3. Check whether a drive letter is already mapped or not.
[code=fw:24fasik7]<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 /><span style="color: #00C800;">Function</span> Main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">Local</span> oDlg,oBtn1,oBtn2,oBtn3 <br /> <span style="color: #00C800;">Local</span> cDriveLetter:=<span style="color: #ff0000;">"M:"</span>, cRemotePath:=<span style="color: #ff0000;">"<span style="color: #000000;">\\</span>Server<span style="color: #000000;">\S</span>hareName"</span><br /> <br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <span style="color: #0000ff;">FROM</span> <span style="color: #000000;">5</span>,<span style="color: #000000;">5</span> <span style="color: #0000ff;">to</span> <span style="color: #000000;">25</span>,<span style="color: #000000;">65</span> <span style="color: #0000ff;">TITLE</span> <span style="color: #ff0000;">"Network Drive mapping"</span><br /> <br /> @<span style="color: #000000;">3</span>,<span style="color: #000000;">2</span> <span style="color: #0000ff;">BUTTON</span> oBtn1 <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"Map a Network Drive"</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">60</span>,<span style="color: #000000;">20</span>;<br /> <span style="color: #0000ff;">ACTION</span> <span style="color: #000000;">(</span>MapDrive<span style="color: #000000;">(</span> cDriveLetter, cRemotePath<span style="color: #000000;">)</span><span style="color: #000000;">)</span><br /> <br /> @<span style="color: #000000;">3</span>,<span style="color: #000000;">15</span> <span style="color: #0000ff;">BUTTON</span> oBtn2 <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"Remove Mapped Drive"</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">60</span>,<span style="color: #000000;">20</span>;<br /> <span style="color: #0000ff;">ACTION</span> RemoveMapDrive<span style="color: #000000;">(</span> cDriveLetter<span style="color: #000000;">)</span><br /> <br /> @<span style="color: #000000;">3</span>,<span style="color: #000000;">28</span> <span style="color: #0000ff;">BUTTON</span> oBtn2 <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"Is Drive Mapped ?"</span> <span style="color: #0000ff;">SIZE</span> <span style="color: #000000;">60</span>,<span style="color: #000000;">20</span>;<br /> <span style="color: #0000ff;">ACTION</span> <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">(</span><span style="color: #00C800;">if</span><span style="color: #000000;">(</span>IsDriveMapped<span style="color: #000000;">(</span> cDriveLetter<span style="color: #000000;">)</span>,<span style="color: #ff0000;">"Mapped to "</span>+ cDriveLetter,<span style="color: #ff0000;">"Not mapped"</span><span style="color: #000000;">)</span><span style="color: #000000;">)</span> <br /> <br /> <br /> <span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">DIALOG</span> oDlg <br /><br /><span style="color: #00C800;">Return</span> <span style="color: #00C800;">NIL</span><br /><br /><span style="color: #B900B9;">//-----------------------------------------------------------------------//</span><br /><span style="color: #00C800;">Function</span> MapDrive<span style="color: #000000;">(</span>cDriveLetter,cRemotePath,lPermanent,cUserName,cPassword<span style="color: #000000;">)</span><br /> <span style="color: #00C800;">Local</span> oNetwork,oError<br /> <span style="color: #00C800;">DEFAULT</span> lPermanent:=.F.<br /> oNetwork:=CreateObject<span style="color: #000000;">(</span><span style="color: #ff0000;">"WScript.Network"</span><span style="color: #000000;">)</span> <br /> <span style="color: #00C800;">TRY</span><br /> oNetwork:<span style="color: #000000;">MapNetworkDrive</span><span style="color: #000000;">(</span>cDriveLetter, cRemotePath,lPermanent,cUserName,cPassword<span style="color: #000000;">)</span><br /> CATCH <br /> <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"Unable to map "</span>+cDriveLetter+ <span style="color: #ff0000;">" to "</span>+cRemotePath<span style="color: #000000;">)</span><br /> END<br /><span style="color: #00C800;">Return</span> <span style="color: #00C800;">NIL</span><br /><br /><span style="color: #B900B9;">//-----------------------------------------------------------------------//</span><br /><span style="color: #00C800;">Function</span> RemoveMapDrive<span style="color: #000000;">(</span>cDriveLetter<span style="color: #000000;">)</span><br /> <span style="color: #00C800;">Local</span> oNetwork<br /> oNetwork:=CreateObject<span style="color: #000000;">(</span><span style="color: #ff0000;">"WScript.Network"</span><span style="color: #000000;">)</span> <br /> <span style="color: #00C800;">TRY</span><br /> oNetwork:<span style="color: #000000;">RemoveNetworkDrive</span><span style="color: #000000;">(</span>cDriveLetter<span style="color: #000000;">)</span><br /> CATCH<br /> <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"Unable to remove "</span>+cDriveLetter<span style="color: #000000;">)</span><br /> END<br /><span style="color: #00C800;">Return</span> <span style="color: #00C800;">NIL</span><br /><br /><span style="color: #B900B9;">//-----------------------------------------------------------------------//</span><br /><span style="color: #00C800;">Function</span> IsDriveMapped<span style="color: #000000;">(</span>cDriveLetter<span style="color: #000000;">)</span><br /> <span style="color: #00C800;">Local</span> oNetwork,oNetworkDrives,i,lAlreadyConnected:=.F.<br /> oNetwork:=CreateObject<span style="color: #000000;">(</span><span style="color: #ff0000;">"WScript.Network"</span><span style="color: #000000;">)</span> <br /> oNetworkDrives:=oNetwork:<span style="color: #000000;">EnumNetworkDrives</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <br /><br /> <span style="color: #00C800;">For</span> i:=<span style="color: #000000;">0</span> <span style="color: #0000ff;">to</span> oNetworkDrives:<span style="color: #0000ff;">Count</span> - <span style="color: #000000;">1</span> STEP <span style="color: #000000;">2</span><br /> <span style="color: #00C800;">if</span> Upper<span style="color: #000000;">(</span>oNetworkDrives:<span style="color: #000000;">Item</span><span style="color: #000000;">(</span>i<span style="color: #000000;">)</span><span style="color: #000000;">)</span> == Upper<span style="color: #000000;">(</span>cDriveLetter<span style="color: #000000;">)</span><br /> lAlreadyConnected:=.T.<br /> <span style="color: #00C800;">Endif</span><br /> <span style="color: #00C800;">Next</span><br /><span style="color: #00C800;">Return</span> lAlreadyConnected</div>[/code:24fasik7]
Regards
Anser
|
net use n: \\myserver\apps
|
Thanks,
but I have this error
Application
===========
Path and name: c:\za2\connec.exe (32 bits)
Size: 1,903,616 bytes
Time from start: 0 hours 0 mins 1 secs
Error occurred at: 07/05/10, 10:39:53
Error description: Error WScript.Network/3 DISP_E_MEMBERNOTFOUND: MAPNETWORKDRIVE
Args:
[ 1] = C n:
[ 2] = C \\dbserver\apps
[ 3] = L .F.
[ 4] = U
[ 5] = U
Stack Calls
===========
Called from: source\rtl\win32ole.prg => TOLEAUTO:MAPNETWORKDRIVE(0)
Called from: connec.prg => MAPDRIVE(28)
Called from: connec.prg => (b)MAIN(11)
Called from: .\source\classes\BUTTON.PRG => TBUTTON:CLICK(176)
Called from: control.prg => TBUTTON:HANDLEEVENT(1427)
Called from: .\source\classes\WINDOW.PRG => _FWH(3347)
Called from: => SENDMESSAGE(0)
Called from: .\source\classes\DIALOG.PRG => TDIALOG:COMMAND(407)
Called from: => TWINDOW:HANDLEEVENT(0)
Called from: .\source\classes\DIALOG.PRG => TDIALOG:HANDLEEVENT(928)
Called from: => DIALOGBOXINDIRECT(0)
Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE(273)
Called from: connec.prg => MAIN(20)
|
net use n: \\myserver\apps
|
Hello Marco,
I use this code to connect to network:
[code=fw:3tiv4xy9]<div class="fw" id="{CB}" style="font-family: monospace;"> <span style="color: #00C800;">LOCAL</span> RemoteName := GetPvProfString<span style="color: #000000;">(</span> <span style="color: #ff0000;">"SETUPDATEN"</span>, <span style="color: #ff0000;">"ServerName"</span>, <span style="color: #ff0000;">"<span style="color: #000000;">\\</span>DEMO<span style="color: #000000;">\l</span>wc"</span>, <span style="color: #ff0000;">".<span style="color: #000000;">\I</span>NI<span style="color: #000000;">\T</span>OUCH.INI"</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">LOCAL</span> UserName := GetPvProfString<span style="color: #000000;">(</span> <span style="color: #ff0000;">"SETUPDATEN"</span>, <span style="color: #ff0000;">"User"</span>, <span style="color: #ff0000;">"test"</span>, <span style="color: #ff0000;">".<span style="color: #000000;">\I</span>NI<span style="color: #000000;">\T</span>OUCH.INI"</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">LOCAL</span> Password := GetPvProfString<span style="color: #000000;">(</span> <span style="color: #ff0000;">"SETUPDATEN"</span>, <span style="color: #ff0000;">"ServerPasswort"</span>,<span style="color: #ff0000;">"whdemo"</span>, <span style="color: #ff0000;">".<span style="color: #000000;">\I</span>NI<span style="color: #000000;">\T</span>OUCH.INI"</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">LOCAL</span> LocalName := GetPvProfString<span style="color: #000000;">(</span> <span style="color: #ff0000;">"SETUPDATEN"</span>, <span style="color: #ff0000;">"ServerLW"</span>, <span style="color: #ff0000;">"S:"</span>, <span style="color: #ff0000;">".<span style="color: #000000;">\I</span>NI<span style="color: #000000;">\T</span>OUCH.INI"</span> <span style="color: #000000;">)</span><br /><br /> nRetCode := WNetAddConnection2<span style="color: #000000;">(</span> RemoteName, Password, UserName, LocalName <span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">if</span> nRetCode <> <span style="color: #000000;">0</span><br /><br /> <span style="color: #00C800;">if</span> nRetCode = <span style="color: #000000;">85</span><br /> <span style="color: #B900B9;">//bereits verbunden</span><br /><br /> elseif nRetCode = <span style="color: #000000;">67</span><br /> <span style="color: #0000ff;">msginfo</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"RemoteName "</span> + RemoteName + CRLF +;<br /> <span style="color: #ff0000;">"Password "</span> + Password + CRLF +;<br /> <span style="color: #ff0000;">"UserName "</span> + UserName + CRLF +;<br /> <span style="color: #ff0000;">"LocalName "</span> + LocalName + CRLF +;<br /> CRLF +;<br /> <span style="color: #ff0000;">"System error 67 - The network name cannot be found"</span> <span style="color: #000000;">)</span><br /><br /> elseif nRetCode = <span style="color: #000000;">1219</span><br /> <span style="color: #0000ff;">msginfo</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"RemoteName "</span> + RemoteName + CRLF +;<br /> <span style="color: #ff0000;">"Password "</span> + Password + CRLF +;<br /> <span style="color: #ff0000;">"UserName "</span> + UserName + CRLF +;<br /> <span style="color: #ff0000;">"LocalName "</span> + LocalName + CRLF +;<br /> CRLF +;<br /> <span style="color: #ff0000;">"System error 1219 - Multiple connections to a server"</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">endif</span><br /><br /> <span style="color: #00C800;">endif</span><br /> </div>[/code:3tiv4xy9]
Best regards,
Otto
|
net use n: \\myserver\apps
|
Ok
Thank you Anser
Thank you Otto
It works
|
net use n: \\myserver\apps
|
MarcoBoschi,
Exist in xHarbour this:
NetRedir( <cLocal> , ;
<cServer> , ;
[<cPassword>], ;
[<lShowError>] ) --> lSuccess
Regards
|
net use n: \\myserver\apps
|
? cDrvMapToLetter( "\\desarrollo_pc\utilerias" ) // Nos muestra la Letra de la unidad de red
? cLetterToDrvMap( "Z:" ) // Nos muestra la unidad de Red de la letra
? NETREDIR( "LPT1", "\\desarrollo_pc\LX-300") // Mapeamos una unidad de red a una Letra, puede ser datos o impresoras
? NETRMTNAME( "LPT1" ) // Nos regresa la unidad de red completa en base al puerto o unidad elegido
? NETCANCEL( "LPT1" ) // eliminar puertos de red
|
net use n: \\myserver\apps
|
Thanks to all
marco
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.