23 Abr 2020 14:01
Probably many options. I'm a Linux user (currently Fedora 31, Harbour 3.2, gcc, Python 3). I've had success splitting up terminal applications into two parts:
1. Using glade and Python3 to develop a GUI front end, which calls....
2. A Harbour database "server" which does all the database heavy lifting
Item #2 can be based on the original Harbour terminal application code. Item #1 will be new. Good luck with the transition!
* SAMPLE.PRG Template Harbour 3.2 program callable from anywhere
* sample compile: hbmk2 -static hbnf.hbc xhb.hbc sample.prg
*
* Sample call from Python3: >>> import subprocess
* >>> mret = subprocess.check_output(["./sample", "open"])
*
* code as shown assumes one text parameter
* the do case statement can act on any number of predefined parameters
* and multiple parameters per call if you so choose
PROCEDURE MAIN(...)
PUBLIC mparms && passed parameters
mparms := HB_AParams() && array of parms
mparm_count := len( mparms )
msel = mparms[1] && get first parameter
do case
case msel = "open"
* code for open here
case msel = "foobar"
* code for foobar here
otherwise
* ...
endcase
RETURN
** End **
23 Abr 2020 16:11
24 Abr 2020 07:07
25 Abr 2020 11:18
25 Abr 2020 12:06
25 Abr 2020 17:52
30 Abr 2020 18:54
Vlademiro escreveu:Uma outra forma, além das que foram postas, é criar um webservice usando Harbour
30 Abr 2020 21:37
30 Abr 2020 22:19
30 Abr 2020 22:38
FUNCTION Start()
LOCAL hStruct := { => }
hStruct[ "CODCLI" ] := "0001"
hStruct[ "NOME" ] := "HELLO WORLD"
UAddHeader( "Content-Type", "application/json" ) // Json type return
RETURN HB_JsonEncode( hStruct )
30 Abr 2020 22:57
<?php
// Cria o cURL
$curl = curl_init();
// Seta algumas opções
curl_setopt_array($curl, [
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => 'http://localhost:8002'
]);
// Envia a requisição e salva a resposta
$response = curl_exec($curl);
// Fecha a requisição e limpa a memória
$response = json_decode( $response );
var_dump( $response );
curl_close($curl);
30 Abr 2020 23:00
01 Mai 2020 19:07
05 Nov 2020 09:33
Não vi o código Python. Deve ser a parte das telas. Será DBF ?
# importa do modulo de processos/subprocessos
import subprocess
# recebe na variavel 'mret' - um bloco
mret = subprocess.check_output(["./sample", "open"])
./sample
sample.exe