topic
stringlengths 1
63
| text
stringlengths 1
577k
⌀ |
---|---|
webserver using RESTFUL API and responsive | Hello,
here is another program where I would like to use Fivewin/Harbour and Fiveweb.
For me using Symfony is a step learning curve.
In Austria every bill must have a QR code.
Scanning this QR code takes automatically note of all your expenses and spendings.
I would like to program this “drivers log” in FIVEWEB. At the moment I am trying with Symfony.
Best regards,
Otto
[img:t226obmg]http://www.atzwanger-software.com/fw/driv0.jpg[/img:t226obmg]
[img:t226obmg]http://www.atzwanger-software.com/fw/driv1.jpg[/img:t226obmg]
[img:t226obmg]http://www.atzwanger-software.com/fw/driv2.jpg[/img:t226obmg]
[img:t226obmg]http://www.atzwanger-software.com/fw/driv3.jpg[/img:t226obmg] |
webserver using RESTFUL API and responsive | Dear Otto,
I have created this simple FiveWeb test for you:
qrserver.prg
[code=fw:87rjvga2]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"FiveWeb.ch"</span><br /><br /><span style="color: #00C800;">function</span> Main<span style="color: #000000;">(</span> cParams <span style="color: #000000;">)</span><br /><br /> ? cParams<br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span></div>[/code:87rjvga2]
And I have placed it at [url:87rjvga2]http://www.fivetechsoft.com/cgi-bin/qrserver?12345[/url:87rjvga2] (click it)
Please notice that the qrcode is supplied after the ?
You can supply any qrcode to it and it will simply show it in the web browser screen
As far as I remember you have a BlueHost account, so you can easily test it and modify it from your own BlueHost site too <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) -->
No need to mess with IIS settings, etc... |
webserver using RESTFUL API and responsive | Dear Antonio,
thank you. This easy it should be.
Now I have to talk with Manuel. I think the APP must be changed. We should get handyID + content of the qr code.
Maybe this should be secured in a way.
Can you explain please how I get this sample running on Bluehost.
I wish you a nice weekend.
Best regards,
Otto |
webserver using RESTFUL API and responsive | Otto,
> Can you explain please how I get this sample running on Bluehost
1. If you have an Apple computer, simply go to a terminal window and write:
ssh <!-- e --><a href="mailto:[email protected]">[email protected]</a><!-- e -->
where otto is your login name in Bluehost and ottoweb is the name of your site
you will be prompted to accept a key, choose yes. Then write your password.
2. If you don't have an Apple computer, simply download and execute "Putty" from Windows and do the same steps
[url:3m3ai2zm]https://the.earth.li/~sgtatham/putty/latest/w64/putty.exe[/url:3m3ai2zm]
Please try these steps and lets me know how far you go <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) --> |
webserver using RESTFUL API and responsive | Hi Otto,
[quote="Otto":2w8cli19]
here is another program where I would like to use Fivewin/Harbour and Fiveweb.
For me using Symfony is a step learning curve.
[/quote:2w8cli19]
Symfony is a great framework, one of the best without a doubt... but it's learning curve is a little bit heavy.
I browsed to <!-- m --><a class="postlink" href="http://www.myquickinfo.com/">http://www.myquickinfo.com/</a><!-- m --> but I wasn't able to download the QR Kibu App, neither find it in the Google Play store.
¿Can you share a link to download it?
KR |
webserver using RESTFUL API and responsive | Hello Carlos,
the Project is not released yet.
I send you an email.
Best regards,
Otto |
webserver using RESTFUL API and responsive | Hello,
I am now in the process of converting the QRCode project from SQL to DBF. Here I build an order page for the QR code signs.
[url:2pocsw9r]https://www.modharbour.club/mh_portfolioqrcode/portfolio.prg[/url:2pocsw9r]
Best regards,
Otto |
webserver using RESTFUL API and responsive | Hello,
Yesterday I bought a painting. It not only decorates our office but also serves as a background for our webpage for the new mod harbor project.
The whole web page is made with DBF files and mod harbor.
Best regards,
Otto
[img:fmq6t844]https://mybergland.com/fwforum/mistasucanvas.jpg[/img:fmq6t844]
[img:fmq6t844]https://mybergland.com/fwforum/mistasucanvas2.jpg[/img:fmq6t844] |
webservice desde FWH | Estimados amigos
Necesito acceder a un Webservice desde una aplicacion de FWH usando la WinInet.dll
El webservice solicita varios datos que deben ser pasados como parametros, un User y un Password,he probado de varias maneras y no logro hacerlo funcionar!
He usado un ejemplo que encontre en el foro que es para consultar el correo de Brasil que anda ,pero se entra en forma anonima,el codigo esta abajo.
El problema es que paso los parametros pero no se como pasar el User y Password usando estas funciones!
Alguien sabria como hacerlo?
Agradeceria cualquier ayuda al respecto
// websrvce.prg
#include "fivewin.ch"
#include "dll.ch"
static xDLL,oGet,oSay,oDlg
//............................................................
Function Main()
local oGet[4], oFont
local cCEPorigen:="23902-300",cCEPdestino:="28921-205"
local cPESO:=0 , cTOTAL := 0
DEFINE FONT oFont NAME "ARIAL" SIZE 00,-12 BOLD
SET _3DLOOK ON
DEFINE DIALOG oDlg RESOURCE "Sedex" TITLE "Correios - Sedex"
REDEFINE GET oGet[1] VAR cCEPorigen PICTURE "99999-999" ID 101 OF oDlg
REDEFINE GET oGet[2] VAR cCEPdestino PICTURE "99999-999" ID 102 OF oDlg
REDEFINE GET oGet[3] VAR cPESO PICTURE "999999999" ID 103 OF oDlg
REDEFINE GET oGet[4] VAR cTOTAL PICTURE "@E 99,999.99" ID 104 OF oDlg UPDATE
REDEFINE BUTTON ID 105 OF oDlg ACTION Consulta(cCEP1,cCEP2,cPESO,@cTotal)
REDEFINE SAY oSay ID 106 OF oDlg COLOR nRGB(255,0,0),getsyscolor(15)
ACTIVATE DIALOG oDlg CENTERED
return nil
//.......................................................
Function Consulta(cCepOrigem,cCepDestino,cPeso,cTotal)
local oRs, ws
local cXMLPreco,cXMLErros,cXMLSedex
local cUser:="usuario"
local sPass:="password"
ws := TdWebService():new()
oSay:SetText( "Aguarde, consultando la base de datos" )
cXMLSedex := ws:OpenWS( "http://www.correios.com.br/encomendas/precos/calculo.cfm?" +;
"&cepOrigem:="+cCepOrigem+;
"&cepDestino:="+cCepDestino+;
"&peso:="+alltrim(str(cPeso))+;
"&resposta:=xml" )
/*
[b:q73gnoms][color=#FF4000:q73gnoms]Se invoca el URL del webservice y se le pasan los parametros requeridos por el mismo y responde pero en el WS al que quiero acceder
es necesario agregar Usuario y Password y no se como pasarlos
Ademas el URL es <!-- m --><a class="postlink" href="htpps://www.miwebservice...">htpps://www.miwebservice...</a><!-- m -->. en lugar de <!-- m --><a class="postlink" href="htpp://www.miwebservice..">htpp://www.miwebservice..</a><!-- m -->. puede influir esto?
Por ultimo, he visto en otros ejemplos, que luego del signo ? del URL agregan WSDL alguien sabe para que es esto ?[/color:q73gnoms][/b:q73gnoms]
*/
ws:end()
oSay:SetText( "Aguarde, Grabando respuesta" )
MemoWrit( "Sedex.xml", cXMLSedex )
cXMLPreco := XMLGet( "preco_postal", cXMLResp )
cXMLErros := XMLGet( "descricao" , cXMLResp )
cTotal := transf( val( cXMLPreco ), "@E 99,999.99" )
oSay:SetText( iif( empty( cXMLErros ), "Operacion concretada OK!", cXMLErros ) )
oDlg:update()
return nil
//..................................
Function XMLGet( XMLField, XMLFile )
local XMLFieldIni,XMLFieldEnd
XMLField := alltrim( XMLField )
XMLFieldINI := rat( "<"+XMLField+">", XMLFile ) + len( "<"+XMLField+">" )
XMLFieldEND := rat( "</"+XMLField+">", XMLFile ) - XMLFieldINI
return substr( XMLFile, XMLFieldINI, XMLFieldEND )
**************************************
Function inetestaconectada( cAddress )
**************************************
LOCAL aHosts
LOCAL cName
InetInit()
IF cAddress == NIL
cAddress := "www.google.com.ar"
ENDIF
aHosts := InetGetHosts( cAddress )
IF aHosts == NIL .or. len(aHosts)=0
InetCleanup()
RETURN .f.
endif
InetCleanup()
RETURN .t.
// CLASS WEBSERVICE
/*
Classe WebService
*/
CLASS TdWebService
DATA hOpen
DATA sbuffer HIDDEN
DATA xDLL HIDDEN
METHOD New(buffersize) CONSTRUCTOR
METHOD OpenWS(url)
METHOD End()
ENDCLASS
*****************************
METHOD New(conexion,buffersize) CLASS TdWebService
DEFAULT buffersize:=3200
::sbuffer:=buffersize
xDll:=LoadLib32("wininet.dll")
::hOpen = InternetOpen("TdWebService", 1,"testwservice","testwservicepsw", 0)
RETURN Self
*****************************
METHOD OpenWS(url) CLASS TdWebService
local hFile,ret,xml
hFile = InternetOpenUrl(::hOpen, url,"",0,,0)
xml:=space(::sbuffer)
InternetReadFile(hFile, @xml, ::sbuffer, @Ret)
return XML
* return subst(alltrim(xml),1,len(alltrim(xml))-5)
*****************************
METHOD End() CLASS TdWebService
FreeLib32(xDll)
return nil
*****************************
DLL32 FUNCTION InternetOpen( cApp as LPSTR, n1 AS DWORD, n2 AS LPSTR, n3 AS LPSTR,;
n4 AS DWORD ) AS LONG PASCAL ;
FROM "InternetOpenA" LIB xdll
DLL32 Function InternetReadFile(hFile As 7, @sBuffer As 8, lNumBytesToRead As 7, @lNumberOfBytesRead As 7) As 7 PASCAL Lib xdll
DLL32 Function InternetOpenUrl(hInternetSession As 7, lpszUrl As 8, lpszHeaders As 8, dwHeadersLength As 7, dwFlags As 7, dwContext As 7) As 7 FROM "InternetOpenUrlA" PASCAL Lib xdll
DLL32 FUNCTION InternetCloseHandle( hSession AS LONG ) AS BOOL PASCAL LIB xdll |
webservice developed with mod_harbour | webservice.prg
[code=fw:2tkt72va]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00C800;">function</span> Main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> AP_SetContentType<span style="color: #000000;">(</span> <span style="color: #ff0000;">"application/json"</span> <span style="color: #000000;">)</span><br /><br /> ?? hb_jsonEncode<span style="color: #000000;">(</span> <span style="color: #000000;">{</span> <span style="color: #ff0000;">"Method"</span> => AP_Method<span style="color: #000000;">(</span><span style="color: #000000;">)</span>, <span style="color: #ff0000;">"Args"</span> => AP_Args<span style="color: #000000;">(</span><span style="color: #000000;">)</span>, <span style="color: #ff0000;">"Body"</span> => AP_Body<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">}</span> <span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span></div>[/code:2tkt72va]
live demo:
[url:2tkt72va]https://fivetechsoft.github.io/snippets?20200224184548[/url:2tkt72va]
Accessing the webservice from mod_harbour:
[code=fw:2tkt72va]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"/home/user/harbour/contrib/hbcurl/hbcurl.ch"</span><br /><br /><span style="color: #00C800;">function</span> Main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> ? UseWebService<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span> <br /><br /><span style="color: #00C800;">function</span> UseWebService<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">local</span> uValue<br /><br /> curl_global_init<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">if</span> ! empty<span style="color: #000000;">(</span> hCurl := curl_easy_init<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /> curl_easy_setopt<span style="color: #000000;">(</span> hCurl, HB_CURLOPT_POST, <span style="color: #000000;">1</span> <span style="color: #000000;">)</span><br /> curl_easy_setopt<span style="color: #000000;">(</span> hCurl, HB_CURLOPT_URL, <span style="color: #ff0000;">"http://www.modharbour.org/modharbour_samples/webservice.prg"</span> <span style="color: #000000;">)</span><br /> curl_easy_setopt<span style="color: #000000;">(</span> hCurl, HB_CURLOPT_DL_BUFF_SETUP <span style="color: #000000;">)</span><br /> curl_easy_setopt<span style="color: #000000;">(</span> hCurl, HB_CURLOPT_POSTFIELDS, hb_jsonEncode<span style="color: #000000;">(</span> <span style="color: #000000;">{</span> <span style="color: #ff0000;">"key1"</span> => <span style="color: #ff0000;">"value1"</span>, <span style="color: #ff0000;">"key2"</span> => <span style="color: #ff0000;">"value2"</span>, <span style="color: #ff0000;">"key3"</span> => <span style="color: #ff0000;">"value3"</span> <span style="color: #000000;">}</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">if</span> curl_easy_perform<span style="color: #000000;">(</span> hCurl <span style="color: #000000;">)</span> == <span style="color: #000000;">0</span><br /> uValue = curl_easy_dl_buff_get<span style="color: #000000;">(</span> hCurl <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">endif</span><br /> <span style="color: #00C800;">endif</span><br /><br /> curl_global_cleanup<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">return</span> uValue</div>[/code:2tkt72va] |
webservice implementation using php | [quote="cnavarro":7uu7fc30]You are welcome
Gabriel, explain better what you need[/quote:7uu7fc30]
I researched and only found something about importing three libraries to xHarbour in order to enable access to APIs with "https". But I can not get these libraries and I do not understand how to imbibe them.
Another solution I found was the use of this object "CreateObject ('MSXML2.ServerXMLHTTP.6.0')", which until then worked with "https", but I have my doubts about the differences between this object and the TIpClientHttp class.
Who can help me to define the best option to consume API I thank you very much. |
webservice implementation using php | Dear All ,
Is Any wrapper function exists to execute any kind of URL as given below ?
[code=fw:3mznp0nr]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><br /> <span style="color: #B900B9;">// for JSON</span><br /> jsonData := ExecuteURL<span style="color: #000000;">(</span> cURL , aParams , <span style="color: #ff0000;">"JSON"</span> <span style="color: #000000;">)</span> ;<br /> <span style="color: #B900B9;">// for Image </span><br /> oImg := ExecuteURL<span style="color: #000000;">(</span> cURL , aParams , <span style="color: #ff0000;">"IMG"</span> <span style="color: #000000;">)</span> ;<br /> <span style="color: #B900B9;">// for String</span><br /> cStr1 := ExecuteURL<span style="color: #000000;">(</span> cURL , aParams , <span style="color: #ff0000;">"STR"</span> <span style="color: #000000;">)</span> ;<br /><br /><br /> </div>[/code:3mznp0nr]
Thanks
Shridhar |
webservice implementation using php | [quote="cnavarro":1vlvgar4]Well, the best thing to do is to do it in Harbour, so you will not have trouble finding the libraries, or at least it will be easier, but in any case, doing it with CreateObject is a good solution to access a WebService.
What version of Fivewin do you use?[/quote:1vlvgar4]
I use the Fivewin 17.07.
Would I lose any function with this CreateObject? |
webservice implementation using php | Surely the best tool is CURL but my experience with CreateObject is also very good and I have not had any problems |
webservice implementation using php | Well, the best thing to do is to do it in Harbour, so you will not have trouble finding the libraries, or at least it will be easier, but in any case, doing it with CreateObject is a good solution to access a WebService.
What version of Fivewin do you use? |
webservice implementation using php | webservice.php
[code=fw:29mkmjuj]<div class="fw" id="{CB}" style="font-family: monospace;"><?php <br /> header<span style="color: #000000;">(</span><span style="color: #ff0000;">"Content-Type:application/json"</span><span style="color: #000000;">)</span>;<br /><br /> $response<span style="color: #000000;">[</span> <span style="color: #ff0000;">'status'</span> <span style="color: #000000;">]</span> = <span style="color: #ff0000;">"ready"</span>;<br /> $response<span style="color: #000000;">[</span> <span style="color: #ff0000;">'about'</span> <span style="color: #000000;">]</span> = <span style="color: #ff0000;">"FiveTech Software S.L. webservice"</span>;<br /> $response<span style="color: #000000;">[</span> <span style="color: #ff0000;">'method'</span> <span style="color: #000000;">]</span> = $_SERVER<span style="color: #000000;">[</span> <span style="color: #ff0000;">'REQUEST_METHOD'</span> <span style="color: #000000;">]</span>;<br /><br /> echo json_encode<span style="color: #000000;">(</span> $response <span style="color: #000000;">)</span>;<br />?></div>[/code:29mkmjuj]
To test it:
[url:29mkmjuj]http://www.fivetechsoft.com/webservice.php[/url:29mkmjuj] |
webservice implementation using php | Hi,
Basic code
[code=php:lxbv45jr]<div class="php" id="{CB}" style="font-family: monospace;"><span style="color: #808080; font-style: italic;">#include 'fivewin.ch'</span><br /><br /><span style="color: #808080; font-style: italic;">#define URL_ENDPOINT "http://www.fivetechsoft.com/webservice.php"</span><br /><br /><span style="color: #000000; font-weight: bold;">FUNCTION</span> Main<span style="color: #66cc66;">(</span><span style="color: #66cc66;">)</span><br /><br /> LOCAL oURL := TUrl<span style="color: #66cc66;">(</span><span style="color: #66cc66;">)</span>:<span style="color: #000000; font-weight: bold;">New</span><span style="color: #66cc66;">(</span> URL_ENDPOINT <span style="color: #66cc66;">)</span><br /> LOCAL oClient := TIpClientHttp<span style="color: #66cc66;">(</span><span style="color: #66cc66;">)</span>:<span style="color: #000000; font-weight: bold;">New</span><span style="color: #66cc66;">(</span> oUrl <span style="color: #66cc66;">)</span><br /> LOCAL hRequest := <span style="color: #66cc66;">{</span>=><span style="color: #66cc66;">}</span><br /> LOCAl cJson<br /><br /> <a href="http://www.php.net/if"><span style="color: #b1b100;">IF</span></a> oClient:<span style="color: #000000; font-weight: bold;">Open</span><span style="color: #66cc66;">(</span><span style="color: #66cc66;">)</span> <br /> <br /> cJson := oClient:ReadAll<span style="color: #66cc66;">(</span><span style="color: #66cc66;">)</span><br /><br /> hb_jsonDecode<span style="color: #66cc66;">(</span> cJson, @hRequest <span style="color: #66cc66;">)</span><br /> <br /> xBrowse<span style="color: #66cc66;">(</span> hRequest , <span style="color: #ff0000;">'Test Webservice'</span> <span style="color: #66cc66;">)</span> <br /> <br /> oClient:<span style="color: #000000; font-weight: bold;">Close</span><span style="color: #66cc66;">(</span><span style="color: #66cc66;">)</span><br /> <br /> <a href="http://www.php.net/endif"><span style="color: #b1b100;">ENDIF</span></a><br /> <br />RETU NIL<br /> </div>[/code:lxbv45jr]
[img:lxbv45jr]https://i.imgur.com/wlX409j.jpg[/img:lxbv45jr] |
webservice implementation using php | Thank you Carles! <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) -->
Now lets enhance our webservice to inspect any provided parameters:
webservice.php
[code=fw:3ki84rn3]<div class="fw" id="{CB}" style="font-family: monospace;"><?php <br /> header<span style="color: #000000;">(</span><span style="color: #ff0000;">"Content-Type:application/json"</span><span style="color: #000000;">)</span>;<br /><br /> $response<span style="color: #000000;">[</span> <span style="color: #ff0000;">'status'</span> <span style="color: #000000;">]</span> = <span style="color: #ff0000;">"ready"</span>;<br /> $response<span style="color: #000000;">[</span> <span style="color: #ff0000;">'about'</span> <span style="color: #000000;">]</span> = <span style="color: #ff0000;">"FiveTech Software S.L. webservice"</span>;<br /> $response<span style="color: #000000;">[</span> <span style="color: #ff0000;">'method'</span> <span style="color: #000000;">]</span> = $_SERVER<span style="color: #000000;">[</span> <span style="color: #ff0000;">'REQUEST_METHOD'</span> <span style="color: #000000;">]</span>;<br /> $response<span style="color: #000000;">[</span> <span style="color: #ff0000;">'params'</span> <span style="color: #000000;">]</span> = $_GET;<br /><br /> echo json_encode<span style="color: #000000;">(</span> $response <span style="color: #000000;">)</span>;<br />?></div>[/code:3ki84rn3]
We can try it this way:
[url:3ki84rn3]http://www.fivetechsoft.com/webservice.php?tablename=users[/url:3ki84rn3]
And we get this:
{"status":"ready","about":"FiveTech Software S.L. webservice","method":"GET","params":{"tablename":"users"}} |
webservice implementation using php | Lets asume that we want to open a remote database table and retrieve a SQL query:
[url:2rse3im8]http://www.fivetechsoft.com/webservice.php?database=test&tablename=users&username=fivetech&password=1234&sql=select%20*[/url:2rse3im8]
We get this:
{"status":"ready","about":"FiveTech Software S.L. webservice","method":"GET","params":{"database":"test","tablename":"users","username":"fivetech","password":"1234","sql":"select *"}} |
webservice implementation using php | Buenos días Antonio,
Interesante tema.
¿ Conectaremos con nuestro sistema fwh, al menos a nivel de datos (dbf) ?
¿ Podremos ejecutar un .exe fwh que genere un json ?
Salu2 |
webservice implementation using php | Paco,
Carles has already published the basic code to use it <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) -->
<!-- l --><a class="postlink-local" href="http://forums.fivetechsupport.com/viewtopic.php?p=219690#p219690">viewtopic.php?p=219690#p219690</a><!-- l -->
Now we are going to enhance our webservice to offer databases tables management |
webservice implementation using php | A very basic example to allow SQL queries from our webservice:
webservice.php
[code=fw:3k1z7b11]<div class="fw" id="{CB}" style="font-family: monospace;"><?php <br /> header<span style="color: #000000;">(</span><span style="color: #ff0000;">"Content-Type:application/json"</span><span style="color: #000000;">)</span>;<br /><br /> $response<span style="color: #000000;">[</span> <span style="color: #ff0000;">'status'</span> <span style="color: #000000;">]</span> = <span style="color: #ff0000;">"ready"</span>;<br /> $response<span style="color: #000000;">[</span> <span style="color: #ff0000;">'about'</span> <span style="color: #000000;">]</span> = <span style="color: #ff0000;">"FiveTech Software S.L. webservice"</span>;<br /> $response<span style="color: #000000;">[</span> <span style="color: #ff0000;">'method'</span> <span style="color: #000000;">]</span> = $_SERVER<span style="color: #000000;">[</span> <span style="color: #ff0000;">'REQUEST_METHOD'</span> <span style="color: #000000;">]</span>;<br /> $response<span style="color: #000000;">[</span> <span style="color: #ff0000;">'params'</span> <span style="color: #000000;">]</span> = $_GET;<br /><br /> $server = <span style="color: #ff0000;">"localhost"</span>;<br /> $database = $response<span style="color: #000000;">[</span> <span style="color: #ff0000;">'params'</span> <span style="color: #000000;">]</span><span style="color: #000000;">[</span> <span style="color: #ff0000;">'database'</span> <span style="color: #000000;">]</span>;<br /> $user = $response<span style="color: #000000;">[</span> <span style="color: #ff0000;">'params'</span> <span style="color: #000000;">]</span><span style="color: #000000;">[</span> <span style="color: #ff0000;">'username'</span> <span style="color: #000000;">]</span>;<br /> $password = $response<span style="color: #000000;">[</span> <span style="color: #ff0000;">'params'</span> <span style="color: #000000;">]</span><span style="color: #000000;">[</span> <span style="color: #ff0000;">'password'</span> <span style="color: #000000;">]</span>;<br /> $sql = $response<span style="color: #000000;">[</span> <span style="color: #ff0000;">'params'</span> <span style="color: #000000;">]</span><span style="color: #000000;">[</span> <span style="color: #ff0000;">'sql'</span> <span style="color: #000000;">]</span>;<br /> <br /> $conn = mysqli_connect<span style="color: #000000;">(</span> $server, $user, $password, $database <span style="color: #000000;">)</span>;<br /> <br /> <span style="color: #00C800;">if</span><span style="color: #000000;">(</span> ! $conn <span style="color: #000000;">)</span><br /> $response<span style="color: #000000;">[</span> <span style="color: #ff0000;">'error'</span> <span style="color: #000000;">]</span> = mysqli_connect_error<span style="color: #000000;">(</span><span style="color: #000000;">)</span>;<br /> <span style="color: #00C800;">else</span><br /> <span style="color: #000000;">{</span><br /> $response<span style="color: #000000;">[</span> <span style="color: #ff0000;">'result'</span> <span style="color: #000000;">]</span> = mysqli_query<span style="color: #000000;">(</span> $conn, $sql <span style="color: #000000;">)</span>;<br /> mysqli_close<span style="color: #000000;">(</span> $conn <span style="color: #000000;">)</span>;<br /> <span style="color: #000000;">}</span> <br /><br /> echo json_encode<span style="color: #000000;">(</span> $response <span style="color: #000000;">)</span>;<br />?></div>[/code:3k1z7b11] |
webservice implementation using php | Hi,
Basic code (with params)
[code=PHP:2rqr9dcf]<div class="php" id="{CB}" style="font-family: monospace;"><span style="color: #808080; font-style: italic;">#include 'fivewin.ch'</span><br /><br /><span style="color: #808080; font-style: italic;">#define URL_ENDPOINT "http://www.fivetechsoft.com/webservice.php"</span><br /><br /><span style="color: #000000; font-weight: bold;">FUNCTION</span> Main<span style="color: #66cc66;">(</span><span style="color: #66cc66;">)</span><br /><br /> LOCAL oURL := TUrl<span style="color: #66cc66;">(</span><span style="color: #66cc66;">)</span>:<span style="color: #000000; font-weight: bold;">New</span><span style="color: #66cc66;">(</span> URL_ENDPOINT <span style="color: #66cc66;">)</span><br /> LOCAL oClient := TIpClientHttp<span style="color: #66cc66;">(</span><span style="color: #66cc66;">)</span>:<span style="color: #000000; font-weight: bold;">New</span><span style="color: #66cc66;">(</span> oUrl <span style="color: #66cc66;">)</span><br /> LOCAL hRequest := <span style="color: #66cc66;">{</span>=><span style="color: #66cc66;">}</span><br /> LOCAl hParam := <span style="color: #66cc66;">{</span>=><span style="color: #66cc66;">}</span><br /> LOCAl cJson<br /><br /> <a href="http://www.php.net/if"><span style="color: #b1b100;">IF</span></a> oClient:<span style="color: #000000; font-weight: bold;">Open</span><span style="color: #66cc66;">(</span><span style="color: #66cc66;">)</span> <br /> <br /> hParam<span style="color: #66cc66;">[</span> <span style="color: #ff0000;">'database'</span> <span style="color: #66cc66;">]</span> = <span style="color: #ff0000;">'test'</span><br /> hParam<span style="color: #66cc66;">[</span> <span style="color: #ff0000;">'tablename'</span><span style="color: #66cc66;">]</span> = <span style="color: #ff0000;">'users'</span><br /> hParam<span style="color: #66cc66;">[</span> <span style="color: #ff0000;">'username'</span> <span style="color: #66cc66;">]</span> = <span style="color: #ff0000;">'fivetech'</span><br /> hParam<span style="color: #66cc66;">[</span> <span style="color: #ff0000;">'password'</span> <span style="color: #66cc66;">]</span> = <span style="color: #ff0000;">'1234'</span><br /> hParam<span style="color: #66cc66;">[</span> <span style="color: #ff0000;">'sql'</span> <span style="color: #66cc66;">]</span> = <span style="color: #ff0000;">'select *'</span><br /> <br /> oClient:oURL:addGetForm<span style="color: #66cc66;">(</span> hParam <span style="color: #66cc66;">)</span> <br /> <br /> cJson := oClient:ReadAll<span style="color: #66cc66;">(</span> hParam <span style="color: #66cc66;">)</span><br /><br /> hb_jsonDecode<span style="color: #66cc66;">(</span> cJson, @hRequest <span style="color: #66cc66;">)</span><br /> <br /> xBrowse<span style="color: #66cc66;">(</span> hRequest, <span style="color: #ff0000;">'Test WebService'</span> <span style="color: #66cc66;">)</span> <br /> <br /> oClient:<span style="color: #000000; font-weight: bold;">Close</span><span style="color: #66cc66;">(</span><span style="color: #66cc66;">)</span><br /> <br /> <a href="http://www.php.net/endif"><span style="color: #b1b100;">ENDIF</span></a><br /> <br /><a href="http://www.php.net/return"><span style="color: #b1b100;">RETURN</span></a> NIL</div>[/code:2rqr9dcf]
[img:2rqr9dcf]https://i.imgur.com/XQLnlrc.png[/img:2rqr9dcf] |
webservice implementation using php | <!-- s:shock: --><img src="{SMILIES_PATH}/icon_eek.gif" alt=":shock:" title="Shocked" /><!-- s:shock: --> <!-- s:shock: --><img src="{SMILIES_PATH}/icon_eek.gif" alt=":shock:" title="Shocked" /><!-- s:shock: --> |
webservice implementation using php | [quote="Antonio Linares":kprex47h]Lets asume that we want to open a remote database table and retrieve a SQL query:
[url:kprex47h]http://www.fivetechsoft.com/webservice.php?database=test&tablename=users&username=fivetech&password=1234&sql=select%20*[/url:kprex47h]
We get this:
{"status":"ready","about":"FiveTech Software S.L. webservice","method":"GET","params":{"database":"test","tablename":"users","username":"fivetech","password":"1234","sql":"select *"}}[/quote:kprex47h]
Also
[code=fw:kprex47h]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><span style="color: #B900B9;">// Acceso básico a un webservice</span><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"Fivewin.ch"</span><br /><br /><span style="color: #00C800;">Static</span> cAuthoriza := <span style="color: #ff0000;">""</span><br /><span style="color: #00C800;">Static</span> cBaseUrl := <span style="color: #ff0000;">"http://www.fivetechsoft.com/"</span><br /><span style="color: #00C800;">Static</span> cUrlAccess := <span style="color: #ff0000;">"webservice.php"</span><br /><span style="color: #00C800;">Static</span> cResponse := <span style="color: #ff0000;">""</span><br /><span style="color: #00C800;">Static</span> aHeaderResp := <span style="color: #000000;">{</span><span style="color: #000000;">}</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><span style="color: #00C800;">Function</span> Main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">local</span> hResponse<br /> <span style="color: #00C800;">local</span> cTextSend<br /> <span style="color: #00C800;">local</span> cUrl<br /><br /> cTextSend := <span style="color: #ff0000;">"?database=test&tablename=users&username=fivetech&password=1234&sql=select *"</span><br /> cUrl := cBaseUrl + cUrlAccess + cTextSend<br /> cResponse := HRequest<span style="color: #000000;">(</span> cUrl, , <span style="color: #ff0000;">"application/json"</span>, , <span style="color: #ff0000;">"GET"</span> <span style="color: #000000;">)</span><br /> hb_jsonDecode<span style="color: #000000;">(</span> cResponse, @hResponse <span style="color: #000000;">)</span><br /> <span style="color: #0000ff;">XBrowse</span><span style="color: #000000;">(</span> hResponse <span style="color: #000000;">)</span><br /> <span style="color: #0000ff;">XBrowse</span><span style="color: #000000;">(</span> aHeaderResp <span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">Return</span> <span style="color: #00C800;">nil</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><span style="color: #00C800;">Function</span> HRequest<span style="color: #000000;">(</span> cUrl, cParams, cContentType, cAuthorization, cType <span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">local</span> oOle<br /> <span style="color: #00C800;">local</span> cRet := <span style="color: #ff0000;">""</span><br /><br /> <span style="color: #00C800;">DEFAULT</span> cUrl := cBaseUrl + cUrlAccess<br /> <span style="color: #00C800;">DEFAULT</span> cParams := <span style="color: #ff0000;">""</span><br /> <span style="color: #00C800;">DEFAULT</span> cContentType := <span style="color: #ff0000;">"application/x-www-form-urlencoded"</span><br /> <span style="color: #00C800;">DEFAULT</span> cAuthorization := cAuthoriza<br /> <span style="color: #00C800;">DEFAULT</span> cType := <span style="color: #ff0000;">"POST"</span><br /><br /> <span style="color: #B900B9;">// Metodo A</span><br /> <span style="color: #00C800;">TRY</span><br /> oOle := CreateObject<span style="color: #000000;">(</span> <span style="color: #ff0000;">"MSXML2.ServerXMLHTTP.6.0"</span> <span style="color: #000000;">)</span><br /> CATCH<br /> oOle := CreateObject<span style="color: #000000;">(</span> <span style="color: #ff0000;">"Microsoft.XMLHTTP"</span> <span style="color: #000000;">)</span><br /> END<br /><br /> <span style="color: #00C800;">if</span> !Empty<span style="color: #000000;">(</span> oOle <span style="color: #000000;">)</span><br /> CursorWait<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oOle:<span style="color: #000000;">Open</span><span style="color: #000000;">(</span> cType, cUrl, .F. <span style="color: #000000;">)</span><br /> oOle:<span style="color: #000000;">SetRequestHeader</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"Content-Type"</span>, cContentType <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">if</span> !Empty<span style="color: #000000;">(</span> cAuthorization <span style="color: #000000;">)</span><br /> oOle:<span style="color: #000000;">SetRequestHeader</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"Authorization"</span>, cAuthorization <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">endif</span><br /> <span style="color: #00C800;">TRY</span><br /> oOle:<span style="color: #000000;">Send</span><span style="color: #000000;">(</span> cParams <span style="color: #000000;">)</span><br /> oOle:<span style="color: #000000;">WaitForResponse</span><span style="color: #000000;">(</span> <span style="color: #000000;">1000</span> <span style="color: #000000;">)</span><br /> cRet := oOle:<span style="color: #000000;">ResponseText</span><br /> aHeaderResp := Hb_ATokens<span style="color: #000000;">(</span> oOle:<span style="color: #000000;">getAllResponseHeaders</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>, CRLF <span style="color: #000000;">)</span><br /> CATCH<br /> END<br /> CursorArrow<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">endif</span><br /><br /><span style="color: #00C800;">Return</span> cRet<br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /> </div>[/code:kprex47h] |
webservice implementation using php | Enhanced webservice:
webservice.php
[code=fw:110gvtg4]<div class="fw" id="{CB}" style="font-family: monospace;"><?php <br /> header<span style="color: #000000;">(</span><span style="color: #ff0000;">"Content-Type:application/json"</span><span style="color: #000000;">)</span>;<br /><br /> $response<span style="color: #000000;">[</span> <span style="color: #ff0000;">'status'</span> <span style="color: #000000;">]</span> = <span style="color: #ff0000;">"ready"</span>;<br /> $response<span style="color: #000000;">[</span> <span style="color: #ff0000;">'about'</span> <span style="color: #000000;">]</span> = <span style="color: #ff0000;">"FiveTech Software S.L. webservice"</span>;<br /> $response<span style="color: #000000;">[</span> <span style="color: #ff0000;">'method'</span> <span style="color: #000000;">]</span> = $_SERVER<span style="color: #000000;">[</span> <span style="color: #ff0000;">'REQUEST_METHOD'</span> <span style="color: #000000;">]</span>;<br /> $response<span style="color: #000000;">[</span> <span style="color: #ff0000;">'params'</span> <span style="color: #000000;">]</span> = $_GET;<br /><br /> $server = <span style="color: #ff0000;">"localhost"</span>;<br /> $database = $response<span style="color: #000000;">[</span> <span style="color: #ff0000;">'params'</span> <span style="color: #000000;">]</span><span style="color: #000000;">[</span> <span style="color: #ff0000;">'database'</span> <span style="color: #000000;">]</span>;<br /> $user = $response<span style="color: #000000;">[</span> <span style="color: #ff0000;">'params'</span> <span style="color: #000000;">]</span><span style="color: #000000;">[</span> <span style="color: #ff0000;">'username'</span> <span style="color: #000000;">]</span>;<br /> $password = $response<span style="color: #000000;">[</span> <span style="color: #ff0000;">'params'</span> <span style="color: #000000;">]</span><span style="color: #000000;">[</span> <span style="color: #ff0000;">'password'</span> <span style="color: #000000;">]</span>;<br /> $sql = $response<span style="color: #000000;">[</span> <span style="color: #ff0000;">'params'</span> <span style="color: #000000;">]</span><span style="color: #000000;">[</span> <span style="color: #ff0000;">'sql'</span> <span style="color: #000000;">]</span>;<br /> <br /> $conn = mysqli_connect<span style="color: #000000;">(</span> $server, $user, $password, $database <span style="color: #000000;">)</span>;<br /> <br /> <span style="color: #00C800;">if</span><span style="color: #000000;">(</span> ! $conn <span style="color: #000000;">)</span><br /> $response<span style="color: #000000;">[</span> <span style="color: #ff0000;">'error'</span> <span style="color: #000000;">]</span> = mysqli_connect_error<span style="color: #000000;">(</span><span style="color: #000000;">)</span>;<br /> <span style="color: #00C800;">else</span><br /> <span style="color: #000000;">{</span><br /> $result = mysqli_query<span style="color: #000000;">(</span> $conn, $sql <span style="color: #000000;">)</span>;<br /> $response<span style="color: #000000;">[</span> <span style="color: #ff0000;">'result'</span> <span style="color: #000000;">]</span> = array<span style="color: #000000;">(</span><span style="color: #000000;">)</span>;<br /> <span style="color: #00C800;">while</span><span style="color: #000000;">(</span> $row = mysqli_fetch_array<span style="color: #000000;">(</span> $result, MYSQLI_ASSOC <span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /> array_push<span style="color: #000000;">(</span> $response<span style="color: #000000;">[</span> <span style="color: #ff0000;">'result'</span> <span style="color: #000000;">]</span>, $row <span style="color: #000000;">)</span>; <br /> mysqli_close<span style="color: #000000;">(</span> $conn <span style="color: #000000;">)</span>;<br /> <span style="color: #000000;">}</span> <br /><br /> echo json_encode<span style="color: #000000;">(</span> $response <span style="color: #000000;">)</span>;<br />?></div>[/code:110gvtg4]
To test it:
[quote:110gvtg4]www.fivetechsoft.com/webservice.php?database=fivetech_webservice&username=fivetech_test&password=webservice&sql=SELECT * FROM `users`[/quote:110gvtg4]
Result
[code=fw:110gvtg4]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #000000;">{</span><br /> <span style="color: #ff0000;">"status"</span>: <span style="color: #ff0000;">"ready"</span>,<br /> <span style="color: #ff0000;">"about"</span>: <span style="color: #ff0000;">"FiveTech Software S.L. webservice"</span>,<br /> <span style="color: #ff0000;">"method"</span>: <span style="color: #ff0000;">"POST"</span>,<br /> <span style="color: #ff0000;">"params"</span>: <span style="color: #000000;">{</span><br /> <span style="color: #ff0000;">"database"</span>: <span style="color: #ff0000;">"fivetech_webservice"</span>,<br /> <span style="color: #ff0000;">"username"</span>: <span style="color: #ff0000;">"fivetech_test"</span>,<br /> <span style="color: #ff0000;">"password"</span>: <span style="color: #ff0000;">"webservice"</span>,<br /> <span style="color: #ff0000;">"sql"</span>: <span style="color: #ff0000;">"SELECT * FROM `users`"</span><br /> <span style="color: #000000;">}</span>,<br /> <span style="color: #ff0000;">"result"</span>: <span style="color: #000000;">[</span><br /> <span style="color: #000000;">{</span><br /> <span style="color: #ff0000;">"name"</span>: <span style="color: #ff0000;">"Hello world!"</span>,<br /> <span style="color: #ff0000;">"surname"</span>: <span style="color: #ff0000;">""</span><br /> <span style="color: #000000;">}</span>,<br /> <span style="color: #000000;">{</span><br /> <span style="color: #ff0000;">"name"</span>: <span style="color: #ff0000;">"second row"</span>,<br /> <span style="color: #ff0000;">"surname"</span>: <span style="color: #ff0000;">""</span><br /> <span style="color: #000000;">}</span>,<br /> <span style="color: #000000;">{</span><br /> <span style="color: #ff0000;">"name"</span>: <span style="color: #ff0000;">"third name"</span>,<br /> <span style="color: #ff0000;">"surname"</span>: <span style="color: #ff0000;">"third surname"</span><br /> <span style="color: #000000;">}</span><br /> <span style="color: #000000;">]</span><br /><span style="color: #000000;">}</span></div>[/code:110gvtg4]
webservice.prg
[code=fw:110gvtg4]<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: #00C800;">function</span> Main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">LOCAL</span> oClient := TIpClientHttp<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;">"http://www.fivetechsoft.com/webservice.php"</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">LOCAL</span> hRequest := <span style="color: #000000;">{</span>=><span style="color: #000000;">}</span><br /> <span style="color: #00C800;">LOCAl</span> hParams := <span style="color: #000000;">{</span>=><span style="color: #000000;">}</span><br /> <span style="color: #00C800;">LOCAl</span> cJson<br /><br /> <span style="color: #00C800;">if</span> oClient:<span style="color: #000000;">Open</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <br /> <br /> hParams<span style="color: #000000;">[</span> <span style="color: #ff0000;">"database"</span> <span style="color: #000000;">]</span> = <span style="color: #ff0000;">"fivetech_webservice"</span><br /> hParams<span style="color: #000000;">[</span> <span style="color: #ff0000;">"username"</span> <span style="color: #000000;">]</span> = <span style="color: #ff0000;">"fivetech_test"</span><br /> hParams<span style="color: #000000;">[</span> <span style="color: #ff0000;">"password"</span> <span style="color: #000000;">]</span> = <span style="color: #ff0000;">"webservice"</span><br /> hParams<span style="color: #000000;">[</span> <span style="color: #ff0000;">"sql"</span> <span style="color: #000000;">]</span> = <span style="color: #ff0000;">"SELECT * FROM `users`"</span><br /> <br /> oClient:<span style="color: #000000;">oUrl</span>:<span style="color: #000000;">AddGetForm</span><span style="color: #000000;">(</span> hParams <span style="color: #000000;">)</span><br /><br /> cJson = oClient:<span style="color: #000000;">ReadAll</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> hb_jsonDecode<span style="color: #000000;">(</span> cJson, @hRequest <span style="color: #000000;">)</span><br /> <span style="color: #0000ff;">xBrowse</span><span style="color: #000000;">(</span> hRequest, <span style="color: #ff0000;">'Test WebService'</span> <span style="color: #000000;">)</span><br /> <br /> oClient:<span style="color: #000000;">Close</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">endif</span><br /> <br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span></div>[/code:110gvtg4] |
webservice implementation using php | Also
[code=fw:2ijam6bc]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><span style="color: #00C800;">Function</span> Main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">local</span> hResponse<br /> <span style="color: #00C800;">local</span> cTextSend<br /> <span style="color: #00C800;">local</span> cUrl<br /><br /> cTextSend := <span style="color: #ff0000;">"?database=fivetech_webservice&username=fivetech_test&password=webservice&sql=SELECT * FROM `users`"</span><br /> cUrl := cBaseUrl + cUrlAccess + cTextSend<br /> cResponse := HRequest<span style="color: #000000;">(</span> cUrl, , <span style="color: #ff0000;">"application/json"</span>, , <span style="color: #ff0000;">"GET"</span> <span style="color: #000000;">)</span><br /> hb_jsonDecode<span style="color: #000000;">(</span> cResponse, @hResponse <span style="color: #000000;">)</span><br /> <span style="color: #0000ff;">XBrowse</span><span style="color: #000000;">(</span> hResponse<span style="color: #000000;">[</span> <span style="color: #ff0000;">"result"</span> <span style="color: #000000;">]</span> <span style="color: #000000;">)</span><br /> <span style="color: #0000ff;">XBrowse</span><span style="color: #000000;">(</span> hResponse <span style="color: #000000;">)</span><br /> <span style="color: #0000ff;">XBrowse</span><span style="color: #000000;">(</span> aHeaderResp <span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">Return</span> <span style="color: #00C800;">nil</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /> </div>[/code:2ijam6bc]
[img:2ijam6bc]https://i.postimg.cc/PJwq2fSf/web1.gif[/img:2ijam6bc] |
webservice implementation using php | With Curl
[code=fw:1csjzj80]<div class="fw" id="{CB}" style="font-family: monospace;"><br />#ifndef HBCURL_CH_<br /><br /><span style="color: #00D7D7;">#define</span> HB_CURLOPT_URL <span style="color: #000000;">2</span><br /><span style="color: #00D7D7;">#define</span> HB_CURLOPT_HEADER <span style="color: #000000;">42</span><br /><span style="color: #00D7D7;">#define</span> HB_CURLOPT_HTTPHEADER <span style="color: #000000;">23</span><br /><span style="color: #00D7D7;">#define</span> HB_CURLOPT_ACCEPT_ENCODING <span style="color: #000000;">102</span><br /><span style="color: #00D7D7;">#define</span> HB_CURLOPT_DL_BUFF_SETUP <span style="color: #000000;">1008</span><br /><span style="color: #00D7D7;">#define</span> HB_CURLOPT_ENCODING HB_CURLOPT_ACCEPT_ENCODING<br /><br />#endif<br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><span style="color: #00C800;">Function</span> WebWithCurl<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">local</span> hResponse<br /> <span style="color: #00C800;">local</span> cUrl := cBaseUrl + cUrlAccess<br /> <span style="color: #00C800;">local</span> cResponse<br /><br /> cResponse := CurlRequest<span style="color: #000000;">(</span> cUrl <span style="color: #000000;">)</span><br /> hb_jsonDecode<span style="color: #000000;">(</span> cResponse, @hResponse <span style="color: #000000;">)</span><br /> <span style="color: #0000ff;">XBrowse</span><span style="color: #000000;">(</span> hResponse <span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">Return</span> <span style="color: #00C800;">nil</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><span style="color: #00C800;">Function</span> CurlRequest<span style="color: #000000;">(</span> cUrl <span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">local</span> oCurl<br /> <span style="color: #00C800;">local</span> cResult<br /> <span style="color: #00C800;">local</span> cTextSend<br /><br /> curl_global_init<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oCurl := curl_easy_init<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">if</span> !empty<span style="color: #000000;">(</span> oCurl <span style="color: #000000;">)</span><br /> curl_easy_setopt<span style="color: #000000;">(</span> oCurl, HB_CURLOPT_HEADER, <span style="color: #000000;">0</span> <span style="color: #000000;">)</span><br /> curl_easy_setopt<span style="color: #000000;">(</span> oCurl, HB_CURLOPT_ENCODING, <span style="color: #ff0000;">"UTF-8"</span> <span style="color: #000000;">)</span><br /> curl_easy_setopt<span style="color: #000000;">(</span> oCurl, HB_CURLOPT_HTTPHEADER, <span style="color: #ff0000;">'Content-Type: application/json'</span> <span style="color: #000000;">)</span><br /> curl_easy_setopt<span style="color: #000000;">(</span> oCurl, HB_CURLOPT_DL_BUFF_SETUP <span style="color: #000000;">)</span><br /> cTextSend := <span style="color: #ff0000;">"database="</span> + curl_easy_escape<span style="color: #000000;">(</span> oCurl, <span style="color: #ff0000;">"fivetech_webservice"</span> <span style="color: #000000;">)</span> + <span style="color: #ff0000;">"&"</span><br /> cTextSend += <span style="color: #ff0000;">"username="</span> + curl_easy_escape<span style="color: #000000;">(</span> oCurl, <span style="color: #ff0000;">"fivetech_test"</span> <span style="color: #000000;">)</span> + <span style="color: #ff0000;">"&"</span><br /> cTextSend += <span style="color: #ff0000;">"password="</span> + curl_easy_escape<span style="color: #000000;">(</span> oCurl, <span style="color: #ff0000;">"webservice"</span> <span style="color: #000000;">)</span> + <span style="color: #ff0000;">"&"</span><br /> cTextSend += <span style="color: #ff0000;">"sql="</span> + curl_easy_escape<span style="color: #000000;">(</span> oCurl, <span style="color: #ff0000;">"SELECT * FROM `users`"</span> <span style="color: #000000;">)</span><br /> curl_easy_setopt<span style="color: #000000;">(</span> oCurl, HB_CURLOPT_URL, cUrl + <span style="color: #ff0000;">"?"</span> + cTextSend <span style="color: #000000;">)</span><br /> cResult := curl_easy_perform<span style="color: #000000;">(</span> oCurl <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">if</span> Empty<span style="color: #000000;">(</span> cResult <span style="color: #000000;">)</span><br /> cRet := curl_easy_dl_buff_get<span style="color: #000000;">(</span> oCurl <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">else</span><br /> cRet := StrZero<span style="color: #000000;">(</span> cResult, <span style="color: #000000;">5</span> <span style="color: #000000;">)</span> + <span style="color: #ff0000;">" "</span> + curl_easy_strerror<span style="color: #000000;">(</span> cResult <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">endif</span><br /> curl_easy_reset<span style="color: #000000;">(</span> oCurl <span style="color: #000000;">)</span><br /> curl_easy_cleanup<span style="color: #000000;">(</span> oCurl <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">endif</span><br /> curl_global_cleanup<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">Return</span> cRet<br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /> </div>[/code:1csjzj80] |
webservice implementation using php | Hello, good afternoon!
I am new here and i wanted to know what i need to access "https"?
I have the Fivewin 17.07 and xHarbour 1.2.3 and BCC 7 |
webservice implementation using php | You are welcome
Gabriel, explain better what you need |
webservice implementation using php | If your question is how to access HTTPS with curl,
If you HTTPS is an invalid certificate then you need set this:
[code=fw:c6rufijr]<div class="fw" id="{CB}" style="font-family: monospace;">curl_easy_setopt<span style="color: #000000;">(</span>curl, CURLOPT_SSL_VERIFYHOST, <span style="color: #000000;">0</span><span style="color: #000000;">)</span>;<br />curl_easy_setopt<span style="color: #000000;">(</span>curl, CURLOPT_SSL_VERIFYPEER, <span style="color: #000000;">0</span><span style="color: #000000;">)</span>;</div>[/code:c6rufijr]
Otherwise you dont need change anything and it will works.
<!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D --> |
webservice implementation using php | Good Morning
Thank you for your attention
What I need is to use a webservice that works only with "https".
I'm testing with the TIpClientHttp class and with it I'm only able to access "http" webservices.
the error you present is this:
[code=fw:305jwkhs]<div class="fw" id="{CB}" style="font-family: monospace;"><br />Error description: <span style="color: #000000;">BASE</span> / <span style="color: #000000;">1081</span> error Operation not supported: <span style="color: #000000;">TIPCLIENTHTTP</span>: <span style="color: #00C800;">New</span> <span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> Args:<br /> <span style="color: #000000;">[</span><span style="color: #000000;">1</span><span style="color: #000000;">]</span> = O TIPCLIENTHTTP<br /> <span style="color: #000000;">[</span><span style="color: #000000;">2</span><span style="color: #000000;">]</span> = C https<br /> </div>[/code:305jwkhs] |
webservices sending the JPK_V7 file | maybe someone has an example of sending the JPK_V7 file to the gate of the Ministry of Finance in Poland
best regard
KAJOT |
website 2.0 | Hola
Alguien tendra de casualida el website de o'reilly version 2.0 ya que me comentaron que esta mas estable el la verison 1.0, agradeceria si me la pudieran pasar o donde la consigo
Gracias Elias |
website 2.0 | Yo lo tengo, pero como te comente, tu problema no es el WebSite, tu problmea es que te tienes que pasar tu aplicacion a 32 bits, sino vas a seguir teniendo los mismos problemas que teines actualmente con tu aplicacion Clipper. |
website 2.0 | de hecho ya tengo un 50% de cambio por eso quiero probrar con la v2.0
Gracias. |
webview - como brush? | Antonio buenas tardes como estas?
Se puede colocar webview como fondo de escritorio de la aplicación? o toca hacerlo con una ventana child al inicio?
De antemano gracias |
webview - como brush? | Estimado Leandro,
Cuando se construye el objeto TWebView si al método New() se le pasa como segundo parámetro oWnd:hWnd, webview se situa sobre esa ventana sin crear una nueva:
TWebView():New( lDebug, oWnd:hWnd ) |
webview - como brush? | Ok, intento y comento. |
webview - desde FW al navegador como? | Antonio buenos días como estas?
Logramos montar un ejemplo para poder validar el acceso de los usuarios a la aplicación, podemos recoger la variables desde el navegador y enviarlas a FW para que se haga el proceso de validación mediante una dbf. Aunque ya es funcional, ahora nos gustaría poder enviar información al navegador desde FW, por ejemplo, mostrar un [color=#FF0000:hp48v4xt]alert[/color:hp48v4xt] desde el navegador, informando que el usuario no esta registrado o la contraseña esta mal. No mediante un msginfo() directo desde fw como esta en el ejemplo.
Espero haberme hecho entender, de antemano gracias
Mirar al final de código
webviewval.prg
[code=fw:hp48v4xt]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"FiveWin.ch"</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><span style="color: #00C800;">function</span> Main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">local</span> oWebView := TWebView<span style="color: #000000;">(</span><span style="color: #000000;">)</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">local</span> aEstru := <span style="color: #000000;">{</span> <span style="color: #000000;">{</span> <span style="color: #ff0000;">"user"</span>,<span style="color: #ff0000;">"C"</span>,<span style="color: #000000;">10</span>,<span style="color: #000000;">0</span> <span style="color: #000000;">}</span>,;<br /> <span style="color: #000000;">{</span> <span style="color: #ff0000;">"pass"</span>,<span style="color: #ff0000;">"C"</span>,<span style="color: #000000;">10</span>,<span style="color: #000000;">0</span> <span style="color: #000000;">}</span>,;<br /> <span style="color: #000000;">{</span> <span style="color: #ff0000;">"acti"</span>,<span style="color: #ff0000;">"L"</span>, <span style="color: #000000;">1</span>,<span style="color: #000000;">0</span> <span style="color: #000000;">}</span> <span style="color: #000000;">}</span><br /><br /> <span style="color: #00C800;">public</span> d_user<br /><br /> <span style="color: #00C800;">IF</span> !FILE <span style="color: #000000;">(</span><span style="color: #ff0000;">".<span style="color: #000000;">\u</span>suarios.dbf"</span><span style="color: #000000;">)</span><br /> FERASE<span style="color: #000000;">(</span><span style="color: #ff0000;">".<span style="color: #000000;">\u</span>suarios.dbf"</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">ENDIF</span><br /> <br /> DbCreate<span style="color: #000000;">(</span> <span style="color: #ff0000;">".<span style="color: #000000;">\u</span>suarios.dbf"</span>, aEstru <span style="color: #000000;">)</span><br /> <br /> USE <span style="color: #ff0000;">".<span style="color: #000000;">\u</span>suarios.dbf"</span> <span style="color: #0000ff;">ALIAS</span> d_user <span style="color: #00C800;">NEW</span> EXCLUSIVE <br /> <span style="color: #0000ff;">SELECT</span> d_user<br /> dbappend<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> d_user->user := <span style="color: #ff0000;">"root"</span><br /> d_user->pass := <span style="color: #ff0000;">"123"</span><br /> d_user->acti := .T.<br /><br /> oWebView:<span style="color: #000000;">bOnBind</span> = <span style="color: #000000;">{</span> | cJson, nCalls | validating<span style="color: #000000;">(</span> cJson, nCalls <span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /> oWebView:<span style="color: #000000;">Bind</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"SendToFWH"</span> <span style="color: #000000;">)</span><br /> oWebView:<span style="color: #000000;">Navigate</span><span style="color: #000000;">(</span> Html<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /> oWebView:<span style="color: #000000;">SetTitle</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"Validando formulario"</span> <span style="color: #000000;">)</span><br /> <span style="color: #0000ff;">Sleep</span><span style="color: #000000;">(</span> <span style="color: #000000;">200</span> <span style="color: #000000;">)</span><br /> oWebView:<span style="color: #000000;">Run</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oWebView:<span style="color: #000000;">Destroy</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <br /> <br /> d_user-><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: #00C800;">return</span> <span style="color: #00C800;">nil</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><span style="color: #00C800;">function</span> Html<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">local</span> cHtml<br /> <br /> <span style="color: #0000ff;">TEXT</span> INTO cHtml<br /> <span style="color: #00C800;">data</span>:<span style="color: #0000ff;">text</span>/html,<br /> <html><br /> <head><br /> </head><br /> <body <span style="color: #0000ff;">style</span>=<span style="color: #ff0000;">"background-color:cyan"</span>><br /> <h2>Validando Formulario</h2><br /> <small><strong>Usuario</strong></small><br /> <br><br /> <input type=<span style="color: #ff0000;">"text"</span> <span style="color: #0000ff;">id</span>=<span style="color: #ff0000;">"txt_user"</span> placeholder=<span style="color: #ff0000;">"root"</span>></input><br /> <br><br /> <small <span style="color: #0000ff;">id</span>=<span style="color: #ff0000;">"sml_user"</span>></small><br /> <br><br /> <small><strong>Contraseña</strong></small><br /> <br><br /> <input type=<span style="color: #ff0000;">"password"</span> <span style="color: #0000ff;">id</span>=<span style="color: #ff0000;">"txt_pass"</span> placeholder=<span style="color: #ff0000;">"123"</span>></input><br /> <br><br /> <small <span style="color: #0000ff;">id</span>=<span style="color: #ff0000;">"sml_pass"</span>></small><br /> <br><br /> <button onclick=<span style="color: #ff0000;">"validateInfo();"</span> <span style="color: #0000ff;">id</span>=<span style="color: #ff0000;">"btn_val"</span>>Ingresar</button><br /><br /> </body><br /> </html><br /> <script><br /> <span style="color: #00C800;">function</span> validateInfo<span style="color: #000000;">(</span><span style="color: #000000;">)</span><span style="color: #000000;">{</span><br /> <span style="color: #0000ff;">var</span> aError = <span style="color: #00C800;">new</span> Array<span style="color: #000000;">(</span><span style="color: #000000;">)</span>;<br /> <span style="color: #00C800;">if</span><span style="color: #000000;">(</span>document.getElementById<span style="color: #000000;">(</span><span style="color: #ff0000;">"txt_pass"</span><span style="color: #000000;">)</span>.value==<span style="color: #ff0000;">""</span><span style="color: #000000;">)</span><span style="color: #000000;">{</span><br /> document.getElementById<span style="color: #000000;">(</span><span style="color: #ff0000;">"sml_pass"</span><span style="color: #000000;">)</span>.innerHTML = <span style="color: #ff0000;">"Ingrese contraseña"</span>;<br /> aError.push<span style="color: #000000;">(</span><span style="color: #ff0000;">"Error usuario"</span><span style="color: #000000;">)</span>;<br /> <span style="color: #000000;">}</span><span style="color: #00C800;">else</span><span style="color: #000000;">{</span><br /> document.getElementById<span style="color: #000000;">(</span><span style="color: #ff0000;">"sml_pass"</span><span style="color: #000000;">)</span>.innerHTML = <span style="color: #ff0000;">""</span>;<br /> <span style="color: #000000;">}</span><br /> <span style="color: #00C800;">if</span><span style="color: #000000;">(</span>document.getElementById<span style="color: #000000;">(</span><span style="color: #ff0000;">"txt_user"</span><span style="color: #000000;">)</span>.value==<span style="color: #ff0000;">""</span><span style="color: #000000;">)</span><span style="color: #000000;">{</span><br /> document.getElementById<span style="color: #000000;">(</span><span style="color: #ff0000;">"sml_user"</span><span style="color: #000000;">)</span>.innerHTML = <span style="color: #ff0000;">"Ingrese usuario"</span>;<br /> aError.push<span style="color: #000000;">(</span><span style="color: #ff0000;">"Error usuario"</span><span style="color: #000000;">)</span>;<br /> <span style="color: #000000;">}</span><span style="color: #00C800;">else</span><span style="color: #000000;">{</span><br /> document.getElementById<span style="color: #000000;">(</span><span style="color: #ff0000;">"sml_user"</span><span style="color: #000000;">)</span>.innerHTML = <span style="color: #ff0000;">""</span>;<br /> <span style="color: #000000;">}</span><br /> <span style="color: #00C800;">if</span><span style="color: #000000;">(</span>aError.length==<span style="color: #000000;">0</span><span style="color: #000000;">)</span><span style="color: #000000;">{</span><br /> <span style="color: #0000ff;">var</span> cUse = document.getElementById<span style="color: #000000;">(</span><span style="color: #ff0000;">"txt_user"</span><span style="color: #000000;">)</span>.value;<br /> <span style="color: #0000ff;">var</span> cPas = document.getElementById<span style="color: #000000;">(</span><span style="color: #ff0000;">"txt_pass"</span><span style="color: #000000;">)</span>.value;<br /> document.getElementById<span style="color: #000000;">(</span><span style="color: #ff0000;">"btn_val"</span><span style="color: #000000;">)</span>.setAttribute<span style="color: #000000;">(</span><span style="color: #ff0000;">"onclick"</span>, <span style="color: #ff0000;">"SendToFWH( '"</span>+cUse+<span style="color: #ff0000;">"','"</span>+cPas+<span style="color: #ff0000;">"' );"</span><span style="color: #000000;">)</span>;<br /> document.getElementById<span style="color: #000000;">(</span><span style="color: #ff0000;">"btn_val"</span><span style="color: #000000;">)</span>.<span style="color: #0000ff;">click</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>;<br /> document.getElementById<span style="color: #000000;">(</span><span style="color: #ff0000;">"btn_val"</span><span style="color: #000000;">)</span>.setAttribute<span style="color: #000000;">(</span><span style="color: #ff0000;">"onclick"</span>, <span style="color: #ff0000;">"validateInfo();"</span><span style="color: #000000;">)</span>;<br /> <span style="color: #000000;">}</span><br /> <span style="color: #000000;">}</span><br /> </script> <br /> <br /> ENDTEXT <br /><br /><span style="color: #00C800;">return</span> cHtml<br /><br /><br /><span style="color: #00C800;">function</span> validating<span style="color: #000000;">(</span>cJson, nCalls<span style="color: #000000;">)</span><br /><span style="color: #00C800;">Local</span> hRspn := hash<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br />hb_jsondecode<span style="color: #000000;">(</span>cJson ,@hRspn <span style="color: #000000;">)</span> <br /><br /><span style="color: #0000ff;">SELECT</span> d_user <br />Dbgotop<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br />locate <span style="color: #00C800;">for</span> alltrim<span style="color: #000000;">(</span>d_user->user<span style="color: #000000;">)</span>=alltrim<span style="color: #000000;">(</span>hRspn<span style="color: #000000;">[</span><span style="color: #000000;">1</span><span style="color: #000000;">]</span><span style="color: #000000;">)</span> .AND. alltrim<span style="color: #000000;">(</span>d_user->pass<span style="color: #000000;">)</span>=alltrim<span style="color: #000000;">(</span>hRspn<span style="color: #000000;">[</span><span style="color: #000000;">2</span><span style="color: #000000;">]</span><span style="color: #000000;">)</span><br /><span style="color: #00C800;">if</span> found<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #0000ff;">msginfo</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"ingreso correcto"</span><span style="color: #000000;">)</span><br /><span style="color: #00C800;">else</span><br /> <span style="color: #0000ff;">msginfo</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"usuario o contraseña errados"</span><span style="color: #000000;">)</span> <span style="color: #B900B9;">//LA IDEA ES ENVIAR ESTE ERROR AL NAVEGADOR PARA QUE MUESTRE MEDIANTE UN ALERT</span><br /><span style="color: #00C800;">endif</span><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span> <br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /> </div>[/code:hp48v4xt] |
webview - desde FW al navegador como? | <!-- l --><a class="postlink-local" href="https://forums.fivetechsupport.com/viewtopic.php?f=3&t=43397&p=261297#p261297">viewtopic.php?f=3&t=43397&p=261297#p261297</a><!-- l --> |
webview - desde FW al navegador como? | Para eso es para lo que existe WebView_Return |
webview - desde FW al navegador como? | Estimado Leandro,
Resuelto! <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) -->
oWebView:Eval( "alert( 'from javascript' )" )
Ya lo teniamos, pero lo olvidé <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) -->
Aqui tienes un ejemplo:
[code=fw:1ue5uveg]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #B900B9;">// Please install <!-- m --><a class="postlink" href="https://developer.microsoft.com/en-us/microsoft-edge/webview2/">https://developer.microsoft.com/en-us/m ... /webview2/</a><!-- m --> x86 version before using it</span><br /><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"FiveWin.ch"</span><br /><br /><span style="color: #00C800;">static</span> oWebView<br /><br /><span style="color: #00C800;">function</span> Main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">local</span> oWnd<br /><br /> <span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">WINDOW</span> oWnd <span style="color: #0000ff;">TITLE</span> <span style="color: #ff0000;">"Using a webview from an existing window"</span> <span style="color: #0000ff;">MENU</span> BuildMenu<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> oWnd:<span style="color: #0000ff;">Center</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oWebView = TWebView<span style="color: #000000;">(</span><span style="color: #000000;">)</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> owebView:<span style="color: #000000;">SetParent</span><span style="color: #000000;">(</span> oWnd <span style="color: #000000;">)</span><br /><br /> oWebView:<span style="color: #000000;">Navigate</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"http://www.google.com"</span> <span style="color: #000000;">)</span><br /> oWebView:<span style="color: #000000;">SetUserAgent</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.53 Mobile Safari/537.36"</span> <span style="color: #000000;">)</span><br /><br /> <span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">WINDOW</span> oWnd <span style="color: #0000ff;">CENTER</span> ;<br /> <span style="color: #0000ff;">ON</span> RESIZE SetWindowPos<span style="color: #000000;">(</span> oWebView:<span style="color: #000000;">GetWindow</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>, <span style="color: #000000;">0</span>, <span style="color: #000000;">20</span>, <span style="color: #000000;">20</span>, oWnd:<span style="color: #000000;">nWidth</span> - <span style="color: #000000;">40</span>, oWnd:<span style="color: #000000;">nHeight</span> - <span style="color: #000000;">40</span> <span style="color: #000000;">)</span><br /><br /> oWebView:<span style="color: #000000;">Destroy</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br /><br /><span style="color: #00C800;">function</span> BuildMenu<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">local</span> oMenu<br /><br /> <span style="color: #0000ff;">MENU</span> oMenu <br /> <span style="color: #0000ff;">MENUITEM</span> <span style="color: #ff0000;">"Eval ."</span> <span style="color: #0000ff;">ACTION</span> oWebView:<span style="color: #000000;">Eval</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"alert( 'from javascript' )"</span> <span style="color: #000000;">)</span><br /> <span style="color: #0000ff;">MENUITEM</span> <span style="color: #ff0000;">"About ."</span> <span style="color: #0000ff;">ACTION</span> MsgAbout<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #0000ff;">ENDMENU</span><br /> <br /><span style="color: #00C800;">return</span> oMenu </div>[/code:1ue5uveg] |
webview - desde FW al navegador como? | oWebView:Return() se usa para devolver un valor desde el oWebView:bOnBind
Nuevo ejemplo webviewuni2.prg
[code=fw:2u9iu47i]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"FiveWin.ch"</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><span style="color: #00C800;">function</span> Main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">local</span> oWebView := TWebView<span style="color: #000000;">(</span><span style="color: #000000;">)</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> oWebView:<span style="color: #0000ff;">Center</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <br /> oWebView:<span style="color: #000000;">bOnBind</span> = <span style="color: #000000;">{</span> | cJson, cCalls | <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">(</span> cJson, cCalls <span style="color: #000000;">)</span>,;<br /> oWebView:<span style="color: #00C800;">Return</span><span style="color: #000000;">(</span> cCalls, <span style="color: #000000;">0</span>, <span style="color: #ff0000;">"{ 'result': 'Hello from PRG' }"</span> <span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /> oWebView:<span style="color: #000000;">Bind</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"SendToFWH"</span> <span style="color: #000000;">)</span><br /> oWebView:<span style="color: #000000;">Navigate</span><span style="color: #000000;">(</span> Html<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /> <span style="color: #0000ff;">Sleep</span><span style="color: #000000;">(</span> <span style="color: #000000;">200</span> <span style="color: #000000;">)</span><br /> oWebView:<span style="color: #000000;">Run</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oWebView:<span style="color: #000000;">Destroy</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><span style="color: #00C800;">function</span> Html<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">local</span> cHtml<br /><br /> <span style="color: #0000ff;">TEXT</span> INTO cHtml<br /> <span style="color: #00C800;">data</span>:<span style="color: #0000ff;">text</span>/html,<br /> <head><body> <br /> <button <span style="color: #0000ff;">id</span>=<span style="color: #ff0000;">'btn-test'</span> >Click Me</button><br /> <script> <br /> <span style="color: #00C800;">function</span> test<span style="color: #000000;">(</span>evt<span style="color: #000000;">)</span> <span style="color: #000000;">{</span> <br /> <span style="color: #0000ff;">var</span> someData = <span style="color: #000000;">{</span> <span style="color: #ff0000;">'param1'</span>: <span style="color: #ff0000;">'Hello from JS'</span> <span style="color: #000000;">}</span>; <br /> <span style="color: #0000ff;">var</span> s = SendToFWH<span style="color: #000000;">(</span> evt.target.<span style="color: #0000ff;">id</span>, evt.type, someData <span style="color: #000000;">)</span> <br /> .then<span style="color: #000000;">(</span>s => <span style="color: #000000;">{</span> <br /> alert<span style="color: #000000;">(</span>s.result<span style="color: #000000;">)</span>; <br /> <span style="color: #000000;">}</span><span style="color: #000000;">)</span> <br /> <span style="color: #000000;">}</span> <br /> document.getElementById<span style="color: #000000;">(</span><span style="color: #ff0000;">'btn-test'</span><span style="color: #000000;">)</span>.addEventListener<span style="color: #000000;">(</span><span style="color: #ff0000;">'click'</span>, test<span style="color: #000000;">)</span>; <br /> </script><br /> </head></body><br /> ENDTEXT <br /><br /><span style="color: #00C800;">return</span> cHtml<br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span></div>[/code:2u9iu47i]
En la clase TWebView() es preciso añadir este nuevo método:
[code=fw:2u9iu47i]<div class="fw" id="{CB}" style="font-family: monospace;"> <span style="color: #00C800;">METHOD</span> <span style="color: #00C800;">Return</span><span style="color: #000000;">(</span> cRequest, nBindResult, cFromPrgToJS <span style="color: #000000;">)</span> <span style="color: #00C800;">INLINE</span> ;<br /> WebView_Return<span style="color: #000000;">(</span> ::<span style="color: #000000;">hWebView</span>, cRequest, nBindResult, cFromPrgToJS <span style="color: #000000;">)</span></div>[/code:2u9iu47i]
nBindResult debe ser cero para indicar que no hay error y 1 para indicar error |
webview - desde FW al navegador como? | Excelente Antonio, muchas gracias por el ejemplo <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D -->, hace lo que queremos.
[quote:pfxo7kyz]oWebView:Eval( "alert( 'from javascript' )" )[/quote:pfxo7kyz]
Por otro lado, será que nos puedes actualizar las lib para xharbour 2304 y enviármelas, con el cambio de clase que acabas de hacer <!-- s:oops: --><img src="{SMILIES_PATH}/icon_redface.gif" alt=":oops:" title="Embarassed" /><!-- s:oops: --> , para revisar el compartemiento de webview.return(). De paso si nos puedes explicar cual es la diferencia entre los dos métodos, y en que momento es mas conveniente usar uno u otro.
De antemano gracias |
webview - desde FW al navegador como? | Estimado Leandro,
Por favor envíame un email para asegurarme que te las envío al correcto, gracias |
webview - desde FW al navegador como? | <!-- l --><a class="postlink-local" href="https://forums.fivetechsupport.com/viewtopic.php?p=261337&sid=1934e473c91385f3ae5b2619e2bcaedc#p261337">viewtopic.php?p=261337&sid=1934e473c91385f3ae5b2619e2bcaedc#p261337</a><!-- l --> |
webview - desde FW al navegador como? | Librerías recibidas.
Voy a compilar el ejemplo y te molesto si salen dudas. |
webview - how to get values from js to FWH | Dear Antonio,
can you please show again an example of how to bring the values from JavaScript to Fivewin.
With kind regards,
Otto |
webview - how to get values from js to FWH | Dear Otto,
Please review FWH\samples\webviewuni2.prg
webviewuni2.prg
[code=fw:2xt0bktb]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"FiveWin.ch"</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><span style="color: #00C800;">function</span> Main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">local</span> oWebView := TWebView<span style="color: #000000;">(</span><span style="color: #000000;">)</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> oWebView:<span style="color: #0000ff;">Center</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <br /> oWebView:<span style="color: #000000;">bOnBind</span> = <span style="color: #000000;">{</span> | cJson, cCalls | <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">(</span> cJson, cCalls <span style="color: #000000;">)</span>,;<br /> oWebView:<span style="color: #00C800;">Return</span><span style="color: #000000;">(</span> cCalls, <span style="color: #000000;">0</span>, <span style="color: #ff0000;">"{ 'result': 'Hello from PRG' }"</span> <span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /> oWebView:<span style="color: #000000;">Bind</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"SendToFWH"</span> <span style="color: #000000;">)</span><br /> oWebView:<span style="color: #000000;">Navigate</span><span style="color: #000000;">(</span> Html<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /> <span style="color: #0000ff;">Sleep</span><span style="color: #000000;">(</span> <span style="color: #000000;">200</span> <span style="color: #000000;">)</span><br /> oWebView:<span style="color: #000000;">Run</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oWebView:<span style="color: #000000;">Destroy</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /><span style="color: #00C800;">function</span> Html<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">local</span> cHtml<br /><br /> <span style="color: #0000ff;">TEXT</span> INTO cHtml<br /> <span style="color: #00C800;">data</span>:<span style="color: #0000ff;">text</span>/html,<br /> <head><body> <br /> <button <span style="color: #0000ff;">id</span>=<span style="color: #ff0000;">'btn-test'</span> >Click Me</button><br /> <script> <br /> <span style="color: #00C800;">function</span> test<span style="color: #000000;">(</span>evt<span style="color: #000000;">)</span> <span style="color: #000000;">{</span> <br /> <span style="color: #0000ff;">var</span> someData = <span style="color: #000000;">{</span> <span style="color: #ff0000;">'param1'</span>: <span style="color: #ff0000;">'Hello from JS'</span> <span style="color: #000000;">}</span>; <br /> <span style="color: #0000ff;">var</span> s = SendToFWH<span style="color: #000000;">(</span> evt.target.<span style="color: #0000ff;">id</span>, evt.type, someData <span style="color: #000000;">)</span> <br /> .then<span style="color: #000000;">(</span>s => <span style="color: #000000;">{</span> <br /> alert<span style="color: #000000;">(</span>s.result<span style="color: #000000;">)</span>; <br /> <span style="color: #000000;">}</span><span style="color: #000000;">)</span> <br /> <span style="color: #000000;">}</span> <br /> document.getElementById<span style="color: #000000;">(</span><span style="color: #ff0000;">'btn-test'</span><span style="color: #000000;">)</span>.addEventListener<span style="color: #000000;">(</span><span style="color: #ff0000;">'click'</span>, test<span style="color: #000000;">)</span>; <br /> </script><br /> </head></body><br /> ENDTEXT <br /><br /><span style="color: #00C800;">return</span> cHtml<br /><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span></div>[/code:2xt0bktb] |
webview - how to get values from js to FWH | Dear Antonio,
thank you.
Best regards,
Otto |
webview - how to get values from js to FWH | Dear Antonio,
thank you.
Best regards,
Otto
BTN-ADD
[img:38zi6gd6]https://mybergland.com/fwforum/sendtofwhclip1.jpg[/img:38zi6gd6]
BTN - Read
[img:38zi6gd6]https://mybergland.com/fwforum/sendtofwhclip2.jpg[/img:38zi6gd6]
[img:38zi6gd6]https://mybergland.com/fwforum/sendtofwhclip3.jpg[/img:38zi6gd6]
[img:38zi6gd6]https://mybergland.com/fwforum/sendtofwhclip4.jpg[/img:38zi6gd6]
[img:38zi6gd6]https://mybergland.com/fwforum/sendtofwhclip7.jpg[/img:38zi6gd6]
[img:38zi6gd6]https://mybergland.com/fwforum/sendtofwhclip8.jpg[/img:38zi6gd6]
[code=fw:38zi6gd6]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><br /><br /><br /> <span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"FiveWin.ch"</span><br /><br /> <span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /><br /> <span style="color: #00C800;">static</span> csend2js := <span style="color: #ff0000;">"send from Harbour"</span><br /> <span style="color: #00C800;">static</span> oWebView<br /><br /> <span style="color: #00C800;">function</span> Main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <br /> <span style="color: #00C800;">local</span> hPost := <span style="color: #000000;">{</span><span style="color: #000000;">}</span><br /><br /> oWebView := TWebView<span style="color: #000000;">(</span><span style="color: #000000;">)</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">(</span> <span style="color: #000000;">1</span>, <span style="color: #000000;">)</span> <br /> oWebView:<span style="color: #000000;">bOnBind</span> = <span style="color: #000000;">{</span> | cJson, cCalls | <span style="color: #0000ff;">msginfo</span><span style="color: #000000;">(</span>cJson<span style="color: #000000;">)</span> ,;<br /> hb_jsondecode<span style="color: #000000;">(</span> cJson, @hPost <span style="color: #000000;">)</span>, fromjavascirpt<span style="color: #000000;">(</span>hPost<span style="color: #000000;">)</span> , ;<br /> oWebView:<span style="color: #00C800;">Return</span><span style="color: #000000;">(</span> cCalls, <span style="color: #000000;">0</span>, <span style="color: #ff0000;">"{ 'result': '"</span> + csend2js + <span style="color: #ff0000;">"' }"</span> <span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /> oWebView:<span style="color: #000000;">Bind</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"SendToFWH"</span> <span style="color: #000000;">)</span><br /> oWebView:<span style="color: #000000;">Navigate</span><span style="color: #000000;">(</span> Html<span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span><br /> oWebView:<span style="color: #000000;">SetTitle</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"This is Fivewin 2024"</span> <span style="color: #000000;">)</span><br /> <span style="color: #0000ff;">Sleep</span><span style="color: #000000;">(</span> <span style="color: #000000;">200</span> <span style="color: #000000;">)</span><br /> oWebView:<span style="color: #000000;">Run</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> oWebView:<span style="color: #000000;">Destroy</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <br /> <span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br /> <br /> <span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /> <br /><span style="color: #00C800;">function</span> fromjavascirpt<span style="color: #000000;">(</span>hPost<span style="color: #000000;">)</span><br /> <span style="color: #00C800;">local</span> hTemp, aTemp<br /><br /><br /> <span style="color: #0000ff;">xbrowse</span><span style="color: #000000;">(</span>hPost<span style="color: #000000;">)</span><br /><br /><br /> aTemp := hPost<span style="color: #000000;">[</span><span style="color: #000000;">3</span><span style="color: #000000;">]</span><br /><br /><br /> <span style="color: #0000ff;">xbrowse</span><span style="color: #000000;">(</span>aTemp<span style="color: #000000;">)</span><br /><br /><br /> hTemp := aTemp<span style="color: #000000;">[</span><span style="color: #ff0000;">'param1'</span><span style="color: #000000;">]</span><br /><br /> csend2js := <span style="color: #ff0000;">"gelesen in FWH "</span> + time<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /><br /> <span style="color: #00C800;">if</span> hTemp<span style="color: #000000;">[</span><span style="color: #ff0000;">'btn'</span><span style="color: #000000;">]</span> = <span style="color: #ff0000;">'read-btn'</span><br /> <span style="color: #0000ff;">xbrowse</span><span style="color: #000000;">(</span>hTemp<span style="color: #000000;">)</span><br /> ? hTemp<span style="color: #000000;">[</span><span style="color: #ff0000;">'demotext'</span><span style="color: #000000;">]</span><br /> <span style="color: #00C800;">endif</span><br /><br /> <span style="color: #00C800;">if</span> hTemp<span style="color: #000000;">[</span><span style="color: #ff0000;">'btn'</span><span style="color: #000000;">]</span> = <span style="color: #ff0000;">'add-btn'</span><br /> csend2js := <span style="color: #ff0000;">"Add button clicked - time from FWH"</span> + time<span style="color: #000000;">(</span><span style="color: #000000;">)</span> + <span style="color: #ff0000;">":"</span><br /> <span style="color: #00C800;">endif</span><br /><br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br /><span style="color: #B900B9;">//----------------------------------------------------------------------------//</span><br /> <br /> <span style="color: #00C800;">function</span> Html<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> <span style="color: #00C800;">local</span> cHtml<br /> <br /> <br /> <span style="color: #0000ff;">TEXT</span> INTO cHtml<br /> <br /> <head><br /> <br /> <meta charset=<span style="color: #ff0000;">"UTF-8"</span>><br /> <meta <span style="color: #0000ff;">name</span>=<span style="color: #ff0000;">"viewport"</span> content=<span style="color: #ff0000;">"width=device-width, initial-scale=1"</span>><br /> <title>Tischplan</title><br /> <!-- Bootstrap CSS --><br /> <link rel=<span style="color: #ff0000;">"stylesheet"</span> href=<span style="color: #ff0000;">"https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"</span>><br /> <!-- jQuery --><br /> <script src=<span style="color: #ff0000;">"https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"</span>></script><br /> <!-- jQuery UI --><br /> <script src=<span style="color: #ff0000;">"https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"</span>></script><br /> <!-- Bootstrap JS --><br /> <script src=<span style="color: #ff0000;">"https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"</span>></script><br /> <br /> <link rel=<span style="color: #ff0000;">"stylesheet"</span> href=<span style="color: #ff0000;">"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css"</span> /><br /> </head><br /><br /> <body><br /> <style><br /> .navbar <span style="color: #000000;">{</span><br /> <span style="color: #00C800;">display</span>: <span style="color: #000000;">flex</span>;<br /> justify-content: <span style="color: #000000;">space</span>-between;<br /> <span style="color: #000000;">}</span><br /> <br /> .navbar-nav <span style="color: #000000;">{</span><br /> <span style="color: #00C800;">display</span>: <span style="color: #000000;">flex</span>;<br /> flex-direction: <span style="color: #000000;">row</span>;<br /> <span style="color: #000000;">}</span><br /> </style> <br /> <br /> <nav <span style="color: #00C800;">class</span>=<span style="color: #ff0000;">"navbar"</span>><br /> <ul <span style="color: #00C800;">class</span>=<span style="color: #ff0000;">"navbar-nav"</span>><br /> <form <span style="color: #00C800;">class</span>=<span style="color: #ff0000;">"d-flex"</span>><br /> <input <span style="color: #00C800;">class</span>=<span style="color: #ff0000;">"form-control me-2"</span> type=<span style="color: #ff0000;">"search"</span> placeholder=<span style="color: #ff0000;">"Search"</span> aria-label=<span style="color: #ff0000;">"Search"</span>><br /> <button <span style="color: #00C800;">class</span>=<span style="color: #ff0000;">"btn btn-outline-success"</span> type=<span style="color: #ff0000;">"submit"</span>>Search</button><br /> </form><br /> <br /> <li <span style="color: #00C800;">class</span>=<span style="color: #ff0000;">"nav-item"</span>><br /> <button <span style="color: #0000ff;">id</span>=<span style="color: #ff0000;">"add-btn"</span> <span style="color: #00C800;">class</span>=<span style="color: #ff0000;">"btn btn-outline-success"</span> >Add time<span style="color: #000000;">(</span><span style="color: #000000;">)</span></button><br /> </li><br /> <br /> <li <span style="color: #00C800;">class</span>=<span style="color: #ff0000;">"nav-item"</span>><br /> <button <span style="color: #0000ff;">id</span>=<span style="color: #ff0000;">"read-btn"</span> <span style="color: #00C800;">class</span>=<span style="color: #ff0000;">"btn btn-outline-success"</span>>Read-<span style="color: #000000;">(</span><span style="color: #000000;">1</span><span style="color: #000000;">)</span></button><br /> </li><br /> <br /> <li <span style="color: #00C800;">class</span>=<span style="color: #ff0000;">"nav-item"</span>><br /> <button <span style="color: #0000ff;">id</span>=<span style="color: #ff0000;">"edit-btn"</span> <span style="color: #00C800;">class</span>=<span style="color: #ff0000;">"btn btn-outline-success"</span> >Edit</button><br /> </li><br /> <br /> <li <span style="color: #00C800;">class</span>=<span style="color: #ff0000;">"nav-item"</span>><br /> <button <span style="color: #0000ff;">id</span>=<span style="color: #ff0000;">"delete-btn"</span> <span style="color: #00C800;">class</span>=<span style="color: #ff0000;">"btn btn-outline-success"</span>>Delete</button><br /> </li><br /> <br /> </ul><br /> </nav><br /> <br /> <br /> <div <span style="color: #00C800;">class</span>=<span style="color: #ff0000;">"container mt-5"</span>><br /> <div <span style="color: #00C800;">class</span>=<span style="color: #ff0000;">"accordion"</span> <span style="color: #0000ff;">id</span>=<span style="color: #ff0000;">"accordionExample"</span>><br /> <!-- Accordion item <span style="color: #000000;">1</span> --><br /> <div <span style="color: #00C800;">class</span>=<span style="color: #ff0000;">"accordion-item"</span>><br /> <h2 <span style="color: #00C800;">class</span>=<span style="color: #ff0000;">"accordion-header"</span> <span style="color: #0000ff;">id</span>=<span style="color: #ff0000;">"headingOne"</span>><br /> <button <span style="color: #00C800;">class</span>=<span style="color: #ff0000;">"accordion-button"</span> type=<span style="color: #ff0000;">"button"</span> data-bs-toggle=<span style="color: #ff0000;">"collapse"</span> data-bs-target=<span style="color: #ff0000;">"#collapseOne"</span> aria-expanded=<span style="color: #ff0000;">"true"</span> aria-controls=<span style="color: #ff0000;">"collapseOne"</span>><br /> Accordion Item #<span style="color: #000000;">1</span> <i <span style="color: #00C800;">class</span>=<span style="color: #ff0000;">"fas fa-angle-down"</span>></i><br /> </button><br /> </h2><br /> <div <span style="color: #0000ff;">id</span>=<span style="color: #ff0000;">"collapseOne"</span> <span style="color: #00C800;">class</span>=<span style="color: #ff0000;">"accordion-collapse collapse show"</span> aria-labelledby=<span style="color: #ff0000;">"headingOne"</span> data-bs-parent=<span style="color: #ff0000;">"#accordionExample"</span>><br /> <div <span style="color: #00C800;">class</span>=<span style="color: #ff0000;">"accordion-body"</span>><br /> <strong>This is the first item<span style="color: #ff0000;">'s accordion body.</strong> It is shown by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions.<br /> <H1><p id="txtContent"> </p></H1><br /> <br /> </div><br /> </div><br /> </div><br /> <!-- Accordion item 2 --><br /> <div class="accordion-item"><br /> <h2 class="accordion-header" id="headingTwo"><br /> <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo"><br /> Accordion Item #2 <i class="fas fa-angle-down"></i><br /> </button><br /> </h2><br /> <div id="collapseTwo" class="accordion-collapse collapse" aria-labelledby="headingTwo" data-bs-parent="#accordionExample"><br /> <div class="accordion-body"><br /> <strong>This is the second item'</span>s accordion body.</strong> It is hidden by <span style="color: #00C800;">default</span> until its collapse is toggled.<br /> </div><br /> </div><br /> </div><br /> <!-- Accordion item <span style="color: #000000;">3</span> --><br /> <div <span style="color: #00C800;">class</span>=<span style="color: #ff0000;">"accordion-item"</span>><br /> <h2 <span style="color: #00C800;">class</span>=<span style="color: #ff0000;">"accordion-header"</span> <span style="color: #0000ff;">id</span>=<span style="color: #ff0000;">"headingThree"</span>><br /> <button <span style="color: #00C800;">class</span>=<span style="color: #ff0000;">"accordion-button collapsed"</span> type=<span style="color: #ff0000;">"button"</span> data-bs-toggle=<span style="color: #ff0000;">"collapse"</span> data-bs-target=<span style="color: #ff0000;">"#collapseThree"</span> aria-expanded=<span style="color: #ff0000;">"false"</span> aria-controls=<span style="color: #ff0000;">"collapseThree"</span>><br /> Accordion Item #<span style="color: #000000;">3</span> <i <span style="color: #00C800;">class</span>=<span style="color: #ff0000;">"fas fa-angle-down"</span>></i><br /> </button><br /> </h2><br /> <div <span style="color: #0000ff;">id</span>=<span style="color: #ff0000;">"collapseThree"</span> <span style="color: #00C800;">class</span>=<span style="color: #ff0000;">"accordion-collapse collapse"</span> aria-labelledby=<span style="color: #ff0000;">"headingThree"</span> data-bs-parent=<span style="color: #ff0000;">"#accordionExample"</span>><br /> <div <span style="color: #00C800;">class</span>=<span style="color: #ff0000;">"accordion-body"</span>><br /> <strong>This is the third item<span style="color: #ff0000;">'s accordion body.</strong> It is hidden by default until its collapse is toggled.<br /> </div><br /> </div><br /> </div><br /> </div><br /> </div><br /> <script><br /> <br /> function test(evt) { <br /> var content = document.getElementById('</span>txtContent<span style="color: #ff0000;">').value;<br /> <br /> const data = {<br /> text: content,<br /> demotext: '</span>Hallo nice<span style="color: #ff0000;">',<br /> btn: '</span>read-btn<span style="color: #ff0000;">'<br /> };<br /> <br /> var someData = {<br /> '</span>param1<span style="color: #ff0000;">': data,<br /> '</span>param2<span style="color: #ff0000;">': '</span>value2<span style="color: #ff0000;">',<br /> '</span>param3<span style="color: #ff0000;">': 123,<br /> '</span>param4<span style="color: #ff0000;">': true<br /> };<br /> <br /> <br /> var s = SendToFWH( evt.target.id, evt.type, someData )<br /> .then(s => { <br /> alert(s.result); <br /> }) <br /> } <br /> document.getElementById('</span>read-btn<span style="color: #ff0000;">').addEventListener('</span><span style="color: #0000ff;">click</span><span style="color: #ff0000;">', test); <br /> <br /> <br /> document.getElementById('</span>add-btn<span style="color: #ff0000;">').addEventListener('</span><span style="color: #0000ff;">click</span><span style="color: #ff0000;">', addbtn); <br /> function addbtn(evt) {<br /> const data = {<br /> text: '</span>Add <span style="color: #0000ff;">button</span> clicked<span style="color: #ff0000;">',<br /> btn: '</span>add-btn<span style="color: #ff0000;">'<br /> };<br /> var someData = { '</span>param1<span style="color: #ff0000;">': data }; <br /> var s = SendToFWH( evt.target.id, evt.type, someData )<br /> .then(s => { <br /> document.getElementById('</span>txtContent<span style="color: #ff0000;">').innerHTML = s.result; <br /> }) <br /> }<br /> <br /> <br /> <br /> document.getElementById('</span>edit-btn<span style="color: #ff0000;">').addEventListener('</span><span style="color: #0000ff;">click</span><span style="color: #ff0000;">', editbtn); <br /> function editbtn(evt) {<br /> <br /> const data = {<br /> text: '</span>editbtn <span style="color: #0000ff;">button</span> clicked<span style="color: #ff0000;">',<br /> btn: '</span><span style="color: #ff0000;">'<br /> };<br /> var someData = { '</span>param1<span style="color: #ff0000;">': data }; <br /> var s = SendToFWH( evt.target.id, evt.type, someData )<br /> .then(s => { <br /> alert(s.result); <br /> }) <br /> <br /> }<br /> <br /> document.getElementById('</span>delete-btn<span style="color: #ff0000;">').addEventListener('</span><span style="color: #0000ff;">click</span><span style="color: #ff0000;">', deletebtn); <br /> function deletebtn() {<br /> alert('</span>delete <span style="color: #0000ff;">button</span> clicked<span style="color: #ff0000;">');<br /> }<br /> <br /> </script><br /> <br /> <br /> </body><br /> <br /> <br /> <br /> <br /> <br /> ENDTEXT <br /> cHtml := STRTRAN(cHtml, CRLF, '</span><span style="color: #ff0000;">')<br /> cHtml := URLEncode( ALLTRIM( cHtml ) )<br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> return cHtml<br /> //----------------------------------------------------------------------------// <br /> <br /> <br /> FUNCTION URLEncode(cString)<br /> LOCAL cEncodedString := ""<br /> LOCAL nLen := LEN(cString)<br /> LOCAL nAscii, nPos<br /><br /> FOR nPos = 1 TO nLen<br /> nAscii := ASC(SUBSTR(cString, nPos, 1))<br /> DO CASE<br /> CASE nAscii >= 48 .AND. nAscii <= 57 // 0-9<br /> cEncodedString += CHR(nAscii)<br /> CASE nAscii >= 65 .AND. nAscii <= 90 // A-Z<br /> cEncodedString += CHR(nAscii)<br /> CASE nAscii >= 97 .AND. nAscii <= 122 // a-z<br /> cEncodedString += CHR(nAscii)<br /> CASE nAscii == 45 .OR. nAscii == 46 .OR. nAscii == 95 .OR. nAscii == 126 // - . _ ~<br /> cEncodedString += CHR(nAscii)<br /> CASE nAscii == 10<br /> cEncodedString += "%0A"<br /> OTHERWISE<br /> cEncodedString += "%" + NumToHex(nAscii, 2)<br /> ENDCASE<br /> NEXT<br /> <br /> cEncodedString := "data:text/html, " + cEncodedString<br /> RETURN cEncodedString<br /><br />//----------------------------------------------------------------------------// <br /><br /><br /><br /><br /><br /><br /><br /></span></div>[/code:38zi6gd6] |
webview - how to get values from js to FWH | 1. Create the WebView Object
2. Interoperability Bridge (from JavaScript)
Function for communication and data transfer between the two different programming languages JavaScript and Harbour
3. WebView Layer:
Part of the program that uses web technologies (HTML, CSS, JavaScript) within a WebView to implement user interfaces and frontend logic. |
webview - how to get values from js to FWH | [img:189u7va7]https://mybergland.com/fwforum/sendtofwhharbourino.jpg[/img:189u7va7] |
webview2 object WINDOW/DIALOG | Dear Antonio,
Can you show us how to display a webview2 object inside a control on a window or dialog?
Best regards,
Otto |
webview2 object WINDOW/DIALOG | [quote="Otto":1np7xo9p]Dear Antonio,
Can you show us how to display a webview2 object inside a control on a window or dialog?
Best regards,
Otto[/quote:1np7xo9p]
Hi Mr. Otto.
You can look at the last example. [url:1np7xo9p]http://forums.fivetechsupport.com/viewtopic.php?f=3&t=42010&start=30&sid=8b9b5df0c5c1881b0fda1306ebcce562[/url:1np7xo9p] |
webview2 object WINDOW/DIALOG | Dear Otto,
oWebView:SetParent( oWnd ) |
webview2 object WINDOW/DIALOG | Hi Hakan,
thank you.
I will run all the samples of the post you mentioned.
I tested with:
METHOD SetParent( oWnd ).
I will try to extend the method and pass width and height and top.
This is such a great class.
Here is a test with bootstrap button. I think now HTML for reports is perfect.
[img:2jmjehbv]https://mybergland.com/fwforum/webview2print.gif[/img:2jmjehbv]
Best regards,
Otto |
what LIB Type does Fivewin use : | hi,
i found in ReadMe.TXT to build hbpgsql.lib
[quote:1gzbd5cg]Script makelib.bat creates PostgreSQL wrapper lib for Harbour (../Harbour/lib/hbpgsql.lib)
and transforms original libpq.lib in this map (MSVC COFF type) to Borland OMF type (../Harbour/lib/libpq.lib)[/quote:1gzbd5cg]
it seem that CODE and *.BAT was Original for MiniGUI Extended Version which use BCC
can i use those LIB for Fivewin and BCC <!-- s:?: --><img src="{SMILIES_PATH}/icon_question.gif" alt=":?:" title="Question" /><!-- s:?: -->
how to change to MSVC <!-- s:?: --><img src="{SMILIES_PATH}/icon_question.gif" alt=":?:" title="Question" /><!-- s:?: -->
MakeLib.bat
[code=fw:1gzbd5cg]<div class="fw" id="{CB}" style="font-family: monospace;">@echo off<br /><br />rem Builds Harbour <span style="color: #0000ff;">library</span> hbpgsql.lib and converts original POstgreSQL libpq.lib <span style="color: #000000;">(</span>COFF<span style="color: #000000;">)</span> <span style="color: #0000ff;">to</span> OMF format <span style="color: #000000;">(</span><span style="color: #00C800;">for</span> Borland<span style="color: #000000;">)</span><br />set PQ_VER=<span style="color: #000000;">9.5</span><br /><br />:<span style="color: #000000;">OPT</span><br /> call ..\..\batch\makelibopt.bat hbpgsql h %<span style="color: #000000;">1</span> %<span style="color: #000000;">2</span> %<span style="color: #000000;">3</span> %<span style="color: #000000;">4</span> %<span style="color: #000000;">5</span> %<span style="color: #000000;">6</span> %<span style="color: #000000;">7</span> %<span style="color: #000000;">8</span> %<span style="color: #000000;">9</span><br /> <span style="color: #00C800;">if</span> %MV_EXIT%==Y goto END<br /> <span style="color: #00C800;">if</span> %MV_DODONLY%==Y goto CLEANUP<br /> <span style="color: #00C800;">if</span> %MV_USEXHRB%==N goto BUILD<br /> echo hbpgsql.lib is not compatible with xHarbour.<br /> goto END<br /><br /><br />:<span style="color: #000000;">BUILD</span><br /> <span style="color: #00C800;">if</span> exist %MV_BUILD%\hbpgsql.lib del %MV_BUILD%\hbpgsql.lib<br /> %MV_HRB%\bin\harbour.exe tpostgre.prg -n -w3 -es2 -gc0 -i%MV_HRB%\include<br /> %MG_BCC%\bin\bcc32 -c -O2 -I%MG_HRB%\include -I.\%PQ_VER% postgres.c rddcopy.c tpostgre.c<br /> %MG_BCC%\bin\tlib %MV_BUILD%\hbpgsql.lib +postgres.obj +rddcopy.obj +tpostgre.obj<br /> <span style="color: #00C800;">if</span> exist %MV_BUILD%\hbpgsql.bak del %MV_BUILD%\hbpgsql.bak<br /><br /> <span style="color: #00C800;">if</span> exist .\%PQ_VER%\libpq.lib coffimplib .\%PQ_VER%\libpq.lib %MV_BUILD%\libpq.lib<br /> <span style="color: #00C800;">if</span> not exist .\%PQ_VER%\libpq.lib echo original libpq.lib <span style="color: #000000;">(</span>COFF<span style="color: #000000;">)</span> is MISSING: %MV_BUILD%\libpq.lib <span style="color: #000000;">(</span>OMF<span style="color: #000000;">)</span> is not created!<br /><br /><br />:<span style="color: #000000;">CLEANUP</span><br /> <span style="color: #00C800;">if</span> exist postgres.obj del postgres.obj<br /> <span style="color: #00C800;">if</span> exist rddcopy.obj del rddcopy.obj<br /> <span style="color: #00C800;">if</span> exist tpostgre.obj del tpostgre.obj<br /> <span style="color: #00C800;">if</span> exist tpostgre.c del tpostgre.c<br /><br />:<span style="color: #000000;">END</span><br /> call ..\..\batch\makelibend.bat</div>[/code:1gzbd5cg]
MakeLibOpt.bat
[code=fw:1gzbd5cg]<div class="fw" id="{CB}" style="font-family: monospace;">@echo off<br /><br />rem ===========================================================================<br />rem MakeLibOpt.bat<br />rem Called by MakeLib.bat files.<br />rem Kevin Carmody - <span style="color: #000000;">2013.04</span><span style="color: #000000;">.06</span><br />rem<br />rem Revised by Petr Chornyj - <span style="color: #000000;">2016.09</span><span style="color: #000000;">.08</span><br />rem ===========================================================================<br /><br /><span style="color: #00C800;">if</span> <span style="color: #ff0000;">"%1"</span>==<span style="color: #ff0000;">"?"</span> goto SYNTAX<br /><span style="color: #00C800;">if</span> <span style="color: #ff0000;">"%1"</span>==<span style="color: #ff0000;">"/?"</span> goto SYNTAX<br />goto PARPARSE<br /><br />:<span style="color: #000000;">SYNTAX</span><br /> echo.<br /> echo MakeLib.bat<br /> echo Makes MiniGui or Harbour <span style="color: #0000ff;">library</span><br /> echo.<br /> echo Syntax:<br /> echo MakeLibOpt <span style="color: #000000;">(</span>libname<span style="color: #000000;">)</span> <span style="color: #000000;">(</span>libloc<span style="color: #000000;">)</span> <span style="color: #000000;">[</span>/X<span style="color: #000000;">]</span> <span style="color: #000000;">[</span>/-X<span style="color: #000000;">]</span> <span style="color: #000000;">[</span>/T<span style="color: #000000;">]</span> <span style="color: #000000;">[</span>/P<span style="color: #000000;">]</span> <span style="color: #000000;">[</span>/ND<span style="color: #000000;">]</span> <span style="color: #000000;">[</span>/<span style="color: #00C800;">DO</span><span style="color: #000000;">]</span><br /> echo.<br /> echo <span style="color: #000000;">(</span>libname<span style="color: #000000;">)</span> File <span style="color: #0000ff;">name</span> <span style="color: #0000ff;">of</span> target <span style="color: #0000ff;">library</span>, without extension<br /> echo <span style="color: #000000;">(</span>libloc<span style="color: #000000;">)</span> Location <span style="color: #0000ff;">of</span> target <span style="color: #0000ff;">library</span>, one <span style="color: #0000ff;">of</span> the following:<br /> echo M MiniGui <span style="color: #0000ff;">library</span> directory<br /> echo H Harbour or xHarbour <span style="color: #0000ff;">library</span> directory<br /> echo . Current directory<br /> echo <span style="color: #000000;">(</span>other<span style="color: #000000;">)</span> Any other value is interpreted as the directory <span style="color: #0000ff;">name</span><br /> echo /X Use xHarbour, must precede other options,<br /> echo <span style="color: #00C800;">default</span> <span style="color: #00C800;">if</span> MG_CMP set <span style="color: #0000ff;">to</span> XHARBOUR, see below<br /> echo /-X Use Harbour, must precede other options,<br /> echo <span style="color: #00C800;">default</span> <span style="color: #00C800;">if</span> MG_CMP missing or not set <span style="color: #0000ff;">to</span> XHARBOUR<br /> echo /T Use Turbo Assembler during C compile<br /> echo /P <span style="color: #00C800;">Pause</span> <span style="color: #00C800;">at</span> end<br /> echo /ND <span style="color: #00C800;">Do</span> not delete temporary files after compile and build<br /> echo /<span style="color: #00C800;">DO</span> Delete temporary files only, no compile or build<br /> echo Spacing between parameters must be as shown.<br /> echo.<br /> <span style="color: #00C800;">pause</span><br /> echo You may set the following environment variables. <br /> echo Locations in these variables must not have a trailing backslash.<br /> echo.<br /> echo MG_BCC Location <span style="color: #0000ff;">of</span> BCC, <span style="color: #00C800;">default</span> C:\Borland\BCC58<br /> echo MG_ROOT Location <span style="color: #0000ff;">of</span> MinuGui, <span style="color: #00C800;">default</span> C:\MiniGui<br /> echo MG_HRB Location <span style="color: #0000ff;">of</span> Harbour, <span style="color: #00C800;">default</span> <span style="color: #000000;">(</span>MG_ROOT<span style="color: #000000;">)</span>\Harbour<br /> echo MG_LIB Location <span style="color: #0000ff;">of</span> Harbour MiniGui libraries, <span style="color: #00C800;">default</span> <span style="color: #000000;">(</span>MG_ROOT<span style="color: #000000;">)</span>\Lib<br /> echo MG_XHRB Location <span style="color: #0000ff;">of</span> xHarbour, <span style="color: #00C800;">default</span> C:\xHarbour<br /> echo MG_XLIB Location <span style="color: #0000ff;">of</span> xHarbour MiniGui libraries, <span style="color: #00C800;">default</span> <span style="color: #000000;">(</span>MG_ROOT<span style="color: #000000;">)</span>\xLib<br /> echo MG_CMP <span style="color: #00C800;">If</span> set <span style="color: #0000ff;">to</span> XHARBOUR, then use xHarbour by <span style="color: #00C800;">default</span>: <br /> echo /X is not necessary, may be overridden by /-X<br /> echo.<br /> set MV_PAUSE=Y<br /> set MV_EXIT=Y<br /> goto END<br /><br />:<span style="color: #000000;">SYNTERR</span><br /> echo Type MakeLib.bat ? <span style="color: #00C800;">for</span> syntax.<br /> set MV_PAUSE=Y<br /> set MV_EXIT=Y<br /> goto END<br /><br />:<span style="color: #000000;">PARPARSE</span><br /> set MV_EXIT=N<br /> set MV_LIBNAME=%<span style="color: #000000;">1</span><br /> set MV_USEXHRB=N<br /> set MV_USETASM=N<br /> set MV_PAUSE=N<br /> set MV_DODEL=Y<br /> set MV_DODONLY=N<br /> set MV_MGLIB=N<br /> set MV_HBLIB=N<br /><br /> <span style="color: #00C800;">if</span> not defined MG_ROOT call :<span style="color: #000000;">READ_SETTINGS</span> %~dp0\minigui.cfg<br /><br /> <span style="color: #00C800;">if</span> defined MG_CMP <span style="color: #00C800;">if</span> <span style="color: #ff0000;">"%MG_CMP%"</span>==<span style="color: #ff0000;">"XHARBOUR"</span> set MV_USEXHRB=Y<br /> <span style="color: #00C800;">if</span> not defined MG_BCC set MG_BCC=c:\Borland\Bcc58<br /> <span style="color: #00C800;">if</span> not defined MG_ROOT set MG_ROOT=c:\minigui<br /> <span style="color: #00C800;">if</span> not defined MG_HRB set MG_HRB=%MG_ROOT%\harbour<br /> <span style="color: #00C800;">if</span> not defined MG_LIB set MG_LIB=%MG_ROOT%\lib<br /> <span style="color: #00C800;">if</span> not defined MG_XHRB set MG_XHRB=c:\xharbour<br /> <span style="color: #00C800;">if</span> not defined MG_XLIB set MG_XLIB=%MG_ROOT%\xlib<br /> <span style="color: #00C800;">if</span> %MV_USEXHRB%==N set MV_HRB=%MG_HRB%<br /> <span style="color: #00C800;">if</span> %MV_USEXHRB%==N set MV_LIB=%MG_LIB%<br /> <span style="color: #00C800;">if</span> %MV_USEXHRB%==Y set MV_HRB=%MG_XHRB%<br /> <span style="color: #00C800;">if</span> %MV_USEXHRB%==Y set MV_LIB=%MG_XLIB%<br /> shift<br /> <span style="color: #00C800;">if</span> <span style="color: #ff0000;">"%1"</span>==<span style="color: #ff0000;">""</span> goto SYNTERR<br /> <span style="color: #00C800;">if</span> /i %<span style="color: #000000;">1</span>==m goto MLIBSET<br /> <span style="color: #00C800;">if</span> /i %<span style="color: #000000;">1</span>==h goto HLIBSET<br /> goto OLIBSET<br />:<span style="color: #000000;">MLIBSET</span><br /> set MV_MGLIB=Y<br /> goto PARMORE<br />:<span style="color: #000000;">HLIBSET</span><br /> set MV_HBLIB=Y<br /> goto PARMORE<br />:<span style="color: #000000;">OLIBSET</span><br /> set MV_BUILD=%<span style="color: #000000;">1</span><br /> goto PARMORE<br /><br />:<span style="color: #000000;">PARMORE</span><br /> shift<br /> <span style="color: #00C800;">if</span> <span style="color: #ff0000;">"%1"</span>==<span style="color: #ff0000;">""</span> goto SETBUILD<br /> <span style="color: #00C800;">if</span> %<span style="color: #000000;">1</span>==? goto SYNTAX<br /> <span style="color: #00C800;">if</span> %<span style="color: #000000;">1</span>==/? goto SYNTAX<br /> <span style="color: #00C800;">if</span> /i %<span style="color: #000000;">1</span>==/x goto XHARBSET<br /> <span style="color: #00C800;">if</span> /i %<span style="color: #000000;">1</span>==/-x goto HARBSET<br /> <span style="color: #00C800;">if</span> /i %<span style="color: #000000;">1</span>==/t goto TASMSET<br /> <span style="color: #00C800;">if</span> /i %<span style="color: #000000;">1</span>==/p goto PAUSESET<br /> <span style="color: #00C800;">if</span> /i %<span style="color: #000000;">1</span>==/nd goto DELSET<br /> <span style="color: #00C800;">if</span> /i %<span style="color: #000000;">1</span>==/<span style="color: #00C800;">do</span> goto DONLYSET<br /> echo Unknown option %<span style="color: #000000;">1</span><br /> goto SYNTERR<br />:<span style="color: #000000;">XHARBSET</span><br /> set MV_USEXHRB=Y<br /> set MV_HRB=%MG_XHRB%<br /> set MV_LIB=%MG_XLIB%<br /> goto PARMORE<br />:<span style="color: #000000;">HARBSET</span><br /> set MV_USEXHRB=N<br /> set MV_HRB=%MG_HRB%<br /> set MV_LIB=%MG_LIB%<br /> goto PARMORE<br />:<span style="color: #000000;">TASMSET</span><br /> set MV_USETASM=Y<br /> goto PARMORE<br />:<span style="color: #000000;">PAUSESET</span><br /> set MV_PAUSE=Y<br /> goto PARMORE<br />:<span style="color: #000000;">DELSET</span><br /> set MV_DODEL=N<br /> goto PARMORE<br />:<span style="color: #000000;">DONLYSET</span><br /> set MV_DODONLY=Y<br /> goto PARMORE<br /><br />:<span style="color: #000000;">SETBUILD</span><br /> <span style="color: #00C800;">if</span> %MV_MGLIB%==Y set MV_BUILD=%MV_LIB%<br /> <span style="color: #00C800;">if</span> %MV_HBLIB%==Y set MV_BUILD=%MV_HRB%\lib<br /><br />:<span style="color: #000000;">TASMCHECK</span><br /> <span style="color: #00C800;">if</span> %MV_USETASM%==N goto END<br /> <span style="color: #00C800;">if</span> exist %MG_BCC%\bin\tasm32.exe goto END<br /> echo Assembler TASM32.EXE required but not found in %MG_BCC%\bin.<br /> echo %MV_LIBNAME%.lib not built.<br /> set MV_PAUSE=Y<br /> set MV_EXIT=Y<br /> goto END<br /><br />:<span style="color: #000000;">END</span><br /><br />exit /b <span style="color: #000000;">0</span><br /><br />:<span style="color: #000000;">READ_SETTINGS</span><br />set SETTINGSFILE=%<span style="color: #000000;">1</span><br /><span style="color: #00C800;">if</span> not exist %SETTINGSFILE% <span style="color: #000000;">(</span><br /> echo Unable <span style="color: #0000ff;">to</span> load config <span style="color: #0000ff;">from</span> file %<span style="color: #000000;">1</span><br /><span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">for</span> /f <span style="color: #ff0000;">"eol=# delims== tokens=1,2"</span> %%i in <span style="color: #000000;">(</span>%SETTINGSFILE%<span style="color: #000000;">)</span> <span style="color: #00C800;">do</span> <span style="color: #000000;">(</span><br /> set %%i=%%j<br /><span style="color: #000000;">)</span><br /><br />exit /b <span style="color: #000000;">0</span></div>[/code:1gzbd5cg]
MakeLibEnd.bat
[code=fw:1gzbd5cg]<div class="fw" id="{CB}" style="font-family: monospace;">rem MakeLibEnd.bat<br />rem Kevin Carmody - <span style="color: #000000;">2008.04</span><span style="color: #000000;">.07</span><br />rem Called by MakeLib.bat files.<br /><br /><span style="color: #00C800;">if</span> %MV_PAUSE%==Y <span style="color: #00C800;">pause</span><br />set MV_EXIT=<br />set MV_LIBNAME=<br />set MV_USEXHRB=<br />set MV_BUILD=<br />set MV_USETASM=<br />set MV_PAUSE=<br />set MV_DODEL=<br />set MV_DODONLY=<br />set MV_MGLIB=<br />set MV_HBLIB=<br />set MV_HRB=<br />set MV_LIB=</div>[/code:1gzbd5cg] |
what LIB Type does Fivewin use : | Dear Jimmy,
You can easily create an import library using hbmk2.exe:
-depkeyhead=test:libmariadb64.dll
-depcontrol=test:yes
-depimplibs=test:libmariadb64.dll
-depincpath=test:.
For Borland use:
-iflag={bcc}-a |
what about Visual FiveWin ? | what about Visual FiveWin ? |
what about Visual FiveWin ? | We are close to release a first beta, though still far from functional. |
what are possible Pen styles and their numbers for Pen Obj ? | Hello All,
what are the possible Pen styles and their numbers TO be Used WITH Pen OBJECT ?
TIA
Milan. |
what are possible Pen styles and their numbers for Pen Obj ? | Milan,
From the Window API docs: (search for these defines at bcc55\include)
The CreatePen function creates a logical pen that has the specified style, width, and color. The pen can subsequently be selected into a device context and used to draw lines and curves.
HPEN CreatePen(
int fnPenStyle, // pen style
int nWidth, // pen width
COLORREF crColor // pen color
);
Parameters
fnPenStyle
Specifies the pen style. It can be any one of the following values:
Style Description
PS_SOLID Pen is solid.
PS_DASH Pen is dashed. This style is valid only when the pen width is one or less in device units.
PS_DOT Pen is dotted. This style is valid only when the pen width is one or less in device units.
PS_DASHDOT Pen has alternating dashes and dots. This style is valid only when the pen width is one or less in device units.
PS_DASHDOTDOT Pen has alternating dashes and double dots. This style is valid only when the pen width is one or less in device units.
PS_NULL Pen is invisible.
PS_INSIDEFRAME Pen is solid. When this pen is used in any graphics device interface (GDI) drawing function that takes a bounding rectangle, the dimensions of the figure are shrunk so that it fits entirely in the bounding rectangle, taking into account the width of the pen. This applies only to geometric pens.
nWidth
Specifies the width of the pen, in logical units. If nWidth is zero, the pen is a single pixel wide, regardless of the current transformation.
crColor
Specifies a color reference for the pen color. |
what can make Problem with BEGIN SEQUENCE ? | hi,
i have a funny "Problem" when using BEGIN SEQUENCE
i have put this on "top" of Method
[code=fw:sw93ax89]<div class="fw" id="{CB}" style="font-family: monospace;">#ifdef Use_SEQUENCE<br /> bSaveError := ERRORBLOCK<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /> ERRORBLOCK<span style="color: #000000;">(</span> <span style="color: #000000;">{</span> | e | <span style="color: #00C800;">BREAK</span><span style="color: #000000;">(</span> e <span style="color: #000000;">)</span> <span style="color: #000000;">}</span> <span style="color: #000000;">)</span><br /> BEGIN SEQUENCE<br />#endif</div>[/code:sw93ax89]
and before end
[code=fw:sw93ax89]<div class="fw" id="{CB}" style="font-family: monospace;">#ifdef Use_SEQUENCE<br /> RECOVER<br /> ERRORBLOCK<span style="color: #000000;">(</span> bSaveError <span style="color: #000000;">)</span><br /> ::<span style="color: #000000;">lAllowed</span> := .T.<br /> END SEQUENCE<br /> ERRORBLOCK<span style="color: #000000;">(</span> bSaveError <span style="color: #000000;">)</span><br />#endif<br /><span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">nil</span></div>[/code:sw93ax89]
between i have working CODE to display Data but it is EMPTY when using SEQUENCE <!-- s:shock: --><img src="{SMILIES_PATH}/icon_eek.gif" alt=":shock:" title="Shocked" /><!-- s:shock: -->
when disable those Parts it work again ... hm
---
i do have use hb_threadStart(), which also use SEQUENCE, before i got to display Data in Main Thread
can this make a Problem like above <!-- s:?: --><img src="{SMILIES_PATH}/icon_question.gif" alt=":?:" title="Question" /><!-- s:?: --> |
what is the type of a device connected to a usb port? | How to know what is the type of a device connected to a usb port (coding a function) ?
Thanks |
what is the type of a device connected to a usb port? | <!-- l --><a class="postlink-local" href="http://fivetechsupport.com/forums/viewtopic.php?f=6&t=35720&sid=2a77f10cce59b400af30136c4c41728c#p212886">viewtopic.php?f=6&t=35720&sid=2a77f10cce59b400af30136c4c41728c#p212886</a><!-- l --> |
what is use for CRLF in HTLM ? | hi
i do have use
[code=fw:289cxlk7]<div class="fw" id="{CB}" style="font-family: monospace;"> cMemo := STRTRAN<span style="color: #000000;">(</span> cMemo, CHR<span style="color: #000000;">(</span> <span style="color: #000000;">10</span> <span style="color: #000000;">)</span>, CRLF <span style="color: #000000;">)</span></div>[/code:289cxlk7]
when "strip" more HTML CODE i might have use wrong sign so CODE is not "formatted" and all can be in "one line"
[code=fw:289cxlk7]<div class="fw" id="{CB}" style="font-family: monospace;">PROCEDURE StripCodeTag<span style="color: #000000;">(</span> cCode <span style="color: #000000;">)</span><br /> <span style="color: #B900B9;">// change HTML in CODE</span><br /> cCode := STRTRAN<span style="color: #000000;">(</span> cCode, <span style="color: #ff0000;">"<br /><br />"</span>, CRLF <span style="color: #000000;">)</span><br /> cCode := STRTRAN<span style="color: #000000;">(</span> cCode, <span style="color: #ff0000;">"<br />"</span>, <span style="color: #ff0000;">" "</span> <span style="color: #000000;">)</span><br /> cCode := STRTRAN<span style="color: #000000;">(</span> cCode, <span style="color: #ff0000;">'{'</span>, <span style="color: #ff0000;">"{"</span> <span style="color: #000000;">)</span><br /> cCode := STRTRAN<span style="color: #000000;">(</span> cCode, <span style="color: #ff0000;">'}'</span>, <span style="color: #ff0000;">"}"</span> <span style="color: #000000;">)</span><br /> cCode := STRTRAN<span style="color: #000000;">(</span> cCode, <span style="color: #ff0000;">"<"</span>, CHR<span style="color: #000000;">(</span> <span style="color: #000000;">34</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span> <span style="color: #B900B9;">// "<" )</span><br /> cCode := STRTRAN<span style="color: #000000;">(</span> cCode, <span style="color: #ff0000;">">"</span>, CHR<span style="color: #000000;">(</span> <span style="color: #000000;">34</span> <span style="color: #000000;">)</span> <span style="color: #000000;">)</span> <span style="color: #B900B9;">// ">" )</span><br /> cCode := STRTRAN<span style="color: #000000;">(</span> cCode, <span style="color: #ff0000;">'('</span>, <span style="color: #ff0000;">"("</span> <span style="color: #000000;">)</span><br /> cCode := STRTRAN<span style="color: #000000;">(</span> cCode, <span style="color: #ff0000;">')'</span>, <span style="color: #ff0000;">")"</span> <span style="color: #000000;">)</span><br /> cCode := STRTRAN<span style="color: #000000;">(</span> cCode, <span style="color: #ff0000;">'['</span>, <span style="color: #ff0000;">"["</span> <span style="color: #000000;">)</span><br /> cCode := STRTRAN<span style="color: #000000;">(</span> cCode, <span style="color: #ff0000;">']'</span>, <span style="color: #ff0000;">"]"</span> <span style="color: #000000;">)</span><br /> cCode := STRTRAN<span style="color: #000000;">(</span> cCode, <span style="color: #ff0000;">'&'</span>, <span style="color: #ff0000;">"&"</span> <span style="color: #000000;">)</span><br /><br /> cCode := STRTRAN<span style="color: #000000;">(</span> cCode, <span style="color: #ff0000;">" "</span>, <span style="color: #ff0000;">" "</span> <span style="color: #000000;">)</span><br /> cCode := STRTRAN<span style="color: #000000;">(</span> cCode, <span style="color: #ff0000;">'ÿ'</span>, <span style="color: #ff0000;">" "</span> <span style="color: #000000;">)</span><br /> cCode := STRTRAN<span style="color: #000000;">(</span> cCode, <span style="color: #ff0000;">"""</span>, <span style="color: #ff0000;">'"'</span> <span style="color: #000000;">)</span><br /><br /> cCode := STRTRAN<span style="color: #000000;">(</span> cCode, <span style="color: #ff0000;">'<span'</span>, <span style="color: #ff0000;">""</span> <span style="color: #000000;">)</span><br /> cCode := STRTRAN<span style="color: #000000;">(</span> cCode, <span style="color: #ff0000;">'#0000FF'</span>, <span style="color: #ff0000;">""</span> <span style="color: #000000;">)</span><br /> cCode := STRTRAN<span style="color: #000000;">(</span> cCode, <span style="color: #ff0000;">'#BF0040'</span>, <span style="color: #ff0000;">""</span> <span style="color: #000000;">)</span><br /> cCode := STRTRAN<span style="color: #000000;">(</span> cCode, <span style="color: #ff0000;">'#00C800'</span>, <span style="color: #ff0000;">""</span> <span style="color: #000000;">)</span><br /> cCode := STRTRAN<span style="color: #000000;">(</span> cCode, <span style="color: #ff0000;">'#000000'</span>, <span style="color: #ff0000;">""</span> <span style="color: #000000;">)</span><br /> cCode := STRTRAN<span style="color: #000000;">(</span> cCode, <span style="color: #ff0000;">'#B900B9'</span>, <span style="color: #ff0000;">""</span> <span style="color: #000000;">)</span><br /> cCode := STRTRAN<span style="color: #000000;">(</span> cCode, <span style="color: #ff0000;">'#ff0000'</span>, <span style="color: #ff0000;">""</span> <span style="color: #000000;">)</span><br /> cCode := STRTRAN<span style="color: #000000;">(</span> cCode, <span style="color: #ff0000;">'#0000ff'</span>, <span style="color: #ff0000;">""</span> <span style="color: #000000;">)</span><br /> cCode := STRTRAN<span style="color: #000000;">(</span> cCode, <span style="color: #ff0000;">'#00D7D7'</span>, <span style="color: #ff0000;">""</span> <span style="color: #000000;">)</span><br /> cCode := STRTRAN<span style="color: #000000;">(</span> cCode, <span style="color: #ff0000;">';">'</span>, <span style="color: #ff0000;">""</span> <span style="color: #000000;">)</span><br /> cCode := STRTRAN<span style="color: #000000;">(</span> cCode, <span style="color: #ff0000;">'</span>'</span>, <span style="color: #ff0000;">""</span> <span style="color: #000000;">)</span><br /> cCode := STRTRAN<span style="color: #000000;">(</span> cCode, <span style="color: #ff0000;">'</div>'</span>, <span style="color: #ff0000;">""</span> <span style="color: #000000;">)</span><br /> cCode := STRTRAN<span style="color: #000000;">(</span> cCode, <span style="color: #ff0000;">'style="color:'</span>, <span style="color: #ff0000;">""</span> <span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">RETURN</span></div>[/code:289cxlk7]
Result from Sample [url:289cxlk7]https://forums.fivetechsupport.com/viewtopic.php?t=42143[/url:289cxlk7] Message 13
[quote:289cxlk7]LOCAL aProperty := {
; "AcceleratorCapabilities",; "AdapterCompatibility",; "AdapterDACType",; "AdapterRAM",; "Availability",; "CapabilityDescriptions",; "Caption",; "ColorTableEntries",; "ConfigManagerErrorCode",; "ConfigManagerUserConfig",; "CreationClassName",; "CurrentBitsPerPixel",; "CurrentHorizontalResolution",; "CurrentNumberOfColors",; "CurrentNumberOfColumns",; "CurrentNumberOfRows",; "CurrentRefreshRate",; "CurrentScanMode",; "CurrentVerticalResolution",; "Description",; "DeviceID",; "DeviceSpecificPens",; "DitherType",; "DriverDate",; "DriverVersion",; "ErrorCleared",; "ErrorDescription",; "ICMIntent",; "ICMMethod",; "InfFilename",; "InfSection",; "InstallDate",; "InstalledDisplayDrivers",; "LastErrorCode",; "MaxMemorySupported",; "MaxNumberControlled",; "MaxRefreshRate",; "MinRefreshRate",; "Monochrome",; "Name",; "NumberOfColorPlanes",; "NumberOfVideoPages",; "PNPDeviceID",; "PowerManagementCapabilities",; "PowerManagementSupported",; "ProtocolSupported",; "ReservedSystemPaletteEntries",; "SpecificationVersion",; "Status",; "StatusInfo",; "SystemCreationClassName",; "SystemName",; "SystemPaletteEntries",; "TimeOfLastReset",; "VideoArchitecture",; "VideoMemoryType",; "VideoMode",; "VideoModeDescription",; "VideoProcessor" }[/quote:289cxlk7]
p.s. it do happens in FiveWin Forum where i got HTML COLOR in CODE |
what is use for CRLF in HTLM ? | Hi Jimmy,
Do you have a text example?
Have you already examined the text with a HEX code editor?
LG
Otto |
what is use for CRLF in HTLM ? | Hi Jimmy,
I have been working on the reverse for the last few days.
Here it works like this:
[code=fw:2alu1ykb]<div class="fw" id="{CB}" style="font-family: monospace;"><br />html<br /> cText += <span style="color: #ff0000;">'<html> <span style="color: #000000;">\n</span> '</span> ;<br /> cText += <span style="color: #ff0000;">'<head> <span style="color: #000000;">\n</span> '</span> ;<br />cText += <span style="color: #ff0000;">'<style> <span style="color: #000000;">\n</span> '</span> ;<br /><br /><span style="color: #0000ff;">from</span> <span style="color: #00C800;">mod</span> harbour<br /> cText += <span style="color: #ff0000;">'<html> <span style="color: #000000;">\\</span>n '</span> ;<br /> cText += <span style="color: #ff0000;">'<head> <span style="color: #000000;">\\</span>n '</span> ;<br />cText += <span style="color: #ff0000;">'<style> <span style="color: #000000;">\\</span>n '</span> ;<br /><span style="color: #000000;">(</span><span style="color: #000000;">2</span> backslashes<span style="color: #000000;">)</span><br /><br /> </div>[/code:2alu1ykb]
Best regards,
Otto |
what is use for CRLF in HTLM ? | hi Otto,
your \n have bring me on right Way <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D -->
have found out that i have use
[code=fw:1jogj6dl]<div class="fw" id="{CB}" style="font-family: monospace;"> cMemo := STRTRAN<span style="color: #000000;">(</span>cMemo,<span style="color: #ff0000;">"<span style="color: #000000;">\r</span><span style="color: #000000;">\n</span>"</span>, <span style="color: #ff0000;">""</span> <span style="color: #000000;">}</span></div>[/code:1jogj6dl]
instead of
[code=fw:1jogj6dl]<div class="fw" id="{CB}" style="font-family: monospace;"> cMemo := STRTRAN<span style="color: #000000;">(</span>cMemo,<span style="color: #ff0000;">"<span style="color: #000000;">\r</span><span style="color: #000000;">\n</span>"</span>, CRLF <span style="color: #000000;">}</span></div>[/code:1jogj6dl]
so CODE look bad
you can use Menu -> Database -> HTMLsign and edit it
use CRLF or better CHR(13)+CHR(10) for "change to"
---
"phpBB Forum Grabber", using HMG Syntax (include Source) , can be download here
[url:1jogj6dl]https://www.hmgforum.com/viewtopic.php?f=5&t=7281[/url:1jogj6dl] |
what to do if you don't get answers | Sometimes I miss posts, maybe because there are many, or because someone else is answering and attending, or simply because I miss it <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) -->
In those cases, please reply to yourself with +1 or up or similar, so we have another chance to see it <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) -->
thanks |
whatsapp | Buena tarde... tengo la versión 23.05... es posible obtener la clase whatpSapp, mencionada en la última version de fwh---
Gracias
JONSSON RUSSI |
whatsapp | The function provided with FWH2310 can send files as attachments. That is possible only due to some low level ( c language modules ) in FWH2310. So, that is not compatible with earlier versions.
We provide here a modified version with which we can send messages and also some images optionally. This works with FWH2304.
[code=fw:1burvkzt]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #B900B9;">// whatsapp app must be installed and opened before running this code</span><br /><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"FiveWin.ch"</span><br /><br /><span style="color: #00D7D7;">#define</span> ORANGES <span style="color: #ff0000;">"https://www.jesmondfruitbarn.com.au/wp-content/uploads/2016/10/Jesmond-Fruit-Barn-Oranges.jpg"</span><br /><br /><span style="color: #00C800;">function</span> Main<span style="color: #000000;">(</span><span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">local</span> cPhone := <span style="color: #ff0000;">""</span><br /> <span style="color: #00C800;">local</span> cMsg := <span style="color: #ff0000;">"Hello"</span><br /><br /> <span style="color: #00C800;">if</span> EDITVARS cPhone, cMsg<br /> SendToWhatsApp<span style="color: #000000;">(</span> AllTrim<span style="color: #000000;">(</span> cPhone <span style="color: #000000;">)</span>, AllTrim<span style="color: #000000;">(</span> cMsg <span style="color: #000000;">)</span>, ;<br /> <span style="color: #000000;">{</span> <span style="color: #ff0000;">"..<span style="color: #000000;">\b</span>itmaps<span style="color: #000000;">\0</span>07.bmp"</span>, ORANGES, ;<br /> <span style="color: #ff0000;">"https://www.google.co.in/"</span> <span style="color: #000000;">}</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">endif</span><br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br /><br /><br /><span style="color: #00C800;">function</span> SendToWhatsApp<span style="color: #000000;">(</span> cPhone, cMsg, aAttach <span style="color: #000000;">)</span><br /><br /> <span style="color: #00C800;">local</span> oShell, hBmp<br /> <span style="color: #00C800;">local</span> aSend := <span style="color: #000000;">{</span><span style="color: #000000;">}</span><br /><br /> <span style="color: #00C800;">if</span> Empty<span style="color: #000000;">(</span> cPhone <span style="color: #000000;">)</span>; <span style="color: #00C800;">return</span> .f.; <span style="color: #00C800;">endif</span><br /><br /> <span style="color: #00C800;">DEFAULT</span> cMsg := <span style="color: #ff0000;">"Hello"</span><br /><br /> <span style="color: #00C800;">if</span> !Empty<span style="color: #000000;">(</span> aAttach <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">if</span> !HB_ISARRAY<span style="color: #000000;">(</span> aAttach <span style="color: #000000;">)</span>; aAttach := <span style="color: #000000;">{</span> aAttach <span style="color: #000000;">}</span>; <span style="color: #00C800;">endif</span><br /> AEval<span style="color: #000000;">(</span> aAttach, <|c,i|<br /> <span style="color: #00C800;">if</span> HB_ISSTRING<span style="color: #000000;">(</span> c <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">if</span> !Empty<span style="color: #000000;">(</span> hBmp := FW_ReadImage<span style="color: #000000;">(</span> <span style="color: #00C800;">nil</span>, c, , .t. <span style="color: #000000;">)</span><span style="color: #000000;">[</span> <span style="color: #000000;">1</span> <span style="color: #000000;">]</span> <span style="color: #000000;">)</span><br /> AAdd<span style="color: #000000;">(</span> aSend, hBmp <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">else</span><br /> AAdd<span style="color: #000000;">(</span> aSend, CRLF + c <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">endif</span><br /> <span style="color: #00C800;">endif</span><br /> <span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br /> > <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">endif</span><br /><br /> cMsg := StrTran<span style="color: #000000;">(</span> cMsg, CRLF, <span style="color: #ff0000;">"%0D%0A"</span> <span style="color: #000000;">)</span><br /><br /> oShell := CreateObject<span style="color: #000000;">(</span> <span style="color: #ff0000;">"WScript.Shell"</span> <span style="color: #000000;">)</span><br /> ShellExecute<span style="color: #000000;">(</span> <span style="color: #000000;">0</span>, <span style="color: #ff0000;">"Open"</span>, <span style="color: #ff0000;">"whatsapp://send?phone="</span>+cPhone+<span style="color: #ff0000;">"&text="</span>+cMsg <span style="color: #000000;">)</span><br /> SysWait<span style="color: #000000;">(</span> <span style="color: #000000;">0.5</span> <span style="color: #000000;">)</span><br /><br /><br /> AEval<span style="color: #000000;">(</span> aSend, <|u|<br /> <span style="color: #00C800;">if</span> FW_CopyToClipBoard<span style="color: #000000;">(</span> u <span style="color: #000000;">)</span><br /> SysWait<span style="color: #000000;">(</span> <span style="color: #000000;">1</span> <span style="color: #000000;">)</span>; oShell:<span style="color: #000000;">SendKeys</span><span style="color: #000000;">(</span> <span style="color: #ff0000;">"^v"</span> <span style="color: #000000;">)</span>; SysWait<span style="color: #000000;">(</span> <span style="color: #000000;">1</span> <span style="color: #000000;">)</span><br /> <span style="color: #00C800;">endif</span><br /> <span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span><br /> > <span style="color: #000000;">)</span><br /><br /> oShell:<span style="color: #000000;">SendKeys</span><span style="color: #000000;">(</span><span style="color: #ff0000;">"~"</span><span style="color: #000000;">)</span><br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span></div>[/code:1burvkzt]
You are welcome to make any improvements.
With this we can send weblinks also.
We need to install WhatsApp application and install and open it. |
whatsapp | hBitmap = NViewLib32( cBmpFile , 1 )
Vs
FW_ReadImage( nil, cBmpFile, , .t. ) |
whatsapp | We do not know other libraries
But FWH's FW_ReadImage() is very powerful than any. |
whatsapp | Saludos buen dia y gracias.
Tengo aplicación con FW 2.4 con usuarios en producción y tiene personalizaciones, para este caso necesito copiar la Imagen hacia el clipboard del OS, cuento con la funcion NViewLib32( cBmpFile , 1 ) que devuelve un valor numérico. Necesito copiar la imagen hacia el clibboard del OS.
Igualmente posee FW actualizado y estamos compilando el nuevo binario |
whatsapp | Saludos y gracias a la ayuda de jose Alberto alvares, voy a validar con METHOD CopyToClipboard() CLASS TBitmap
local oClipboard := TClipboard():New( CF_BITMAP )
oClipboard:SetBitmap( Self )
oClipboard:End()
return nil |
whatsapp | Buen día...
Funciona perfecto... pero tengo necesidad de enviar PDF... La idea es generar una factura y dar la opción de enviar a whatsApp.
Gracias |
whatsapp | If you have FWH2310, you can send images and any files as attachments, pdf, etc |
whatsapp | Buen dia..
He actualizado a la fwh 23.10 y funciona perfecto....
Gracias |
whatsapp | If you are using FWH2310, please see fwh\samples\whatsapp.prg
Use the function given in that sample program, but not the program I posted above. |
whatsapp.prg | Saludos
Compile este programa y me genera incidencia, posiblemente debo suministrar un numero de teléfono correcto.
alguien tiene esta aplicación en producción, mis clientes necesitan gestión de las comunicaciones de manera sistematizada. |
whatsapp.prg | +1 |
whatsapp.prg | [url:2ew1se3i]https://wassenger.com/[/url:2ew1se3i]
[code=fw:2ew1se3i]<div class="fw" id="{CB}" style="font-family: monospace;">curl --request POST \<br /> --url https:<span style="color: #B900B9;">//api.wassenger.com/v1/messages \</span><br /> --header <span style="color: #ff0000;">'token: <api key>'</span> \<br /> --<span style="color: #00C800;">data</span> <span style="color: #ff0000;">'{"phone":"+1234567890","message":"Hello world! This is a test message"}'</span></div>[/code:2ew1se3i]
Parece ser que esta es la única forma sencilla de usarlo usando CURL. Ejemplo: <!-- l --><a class="postlink-local" href="http://forums.fivetechsupport.com/viewtopic.php?p=234766#p234766">viewtopic.php?p=234766#p234766</a><!-- l -->
Desde que facebook lo compró, todas las soluciones anteriores dejaron de funcionar. |
whatsapp.prg | Outra opção:
<!-- m --><a class="postlink" href="https://documenter.getpostman.com/view/4545782/SWTHbveC?version=latest#intro">https://documenter.getpostman.com/view/ ... test#intro</a><!-- m --> |
whatsapp.prg | whatsapp web sem abrir o navegador com WSL
<!-- m --><a class="postlink" href="http://fivewin.com.br/index.php?/topic/29571-msg-whatsapp-web-sem-abrir-o-navegador/">http://fivewin.com.br/index.php?/topic/ ... navegador/</a><!-- m --> |
whatsapp.prg | Dear Otto,
Since Facebook bought Whatsapp, its API is no longer available, as far as I know it.
You should consider using Telegram:
[url:11k4ikur]https://telegram.org/[/url:11k4ikur] |
whatsapp.prg | wassenger.com
Dear Antonio,
Do I understand this in the right manner.
You practically have to buy a service from wassengr.com that costs around 70 € / month to be able to use their API interface.
Best regards,
Otto |
whattsapp | Alguien sabe como funciona la tecnología whattsapp internamete, no me refiero a la forma de hacerlo funcionar que se ve bien claro. La cuestión es si lo podemos emplear para hacer cosas con nuestros programas. He visto varias cosas entre ellas como utilizarlo mediante un emulador de android desde el pc: <!-- m --><a class="postlink" href="http://www.elandroidelibre.com/2011/10/tutorial-%C2%BFcomo-usar-whatsapp-desde-el-pc.html">http://www.elandroidelibre.com/2011/10/ ... el-pc.html</a><!-- m --> . Pero me pregunto si podemos entrar al nivel de detalle de empleo desde un programa. Alguien a investigado algo sobre el tema? |
whattsapp | Andres,
Que quieres decir [quote:2ls0ub8s]como funciona la tecnología whattsapp internamete[/quote:2ls0ub8s] ? <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D --> |
whattsapp | Andrés,
Te refieres a si existe un API para poder usar ese servicio desde nuestras aplicaciones ?
No que yo sepa (y ojalá existiese) <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) --> |
whattsapp | Pues sí, a eso me refiero, tengo ya implementado todo el tema de sms y de correo en casi todos los programas, pero ahora esta tecnología está muy de moda en los móviles y la verdad toda la información que tenemos es de uso y no sobre su implementación o tecnología que emplea. Tenemos previsto la incorporación de equipos móviles personalizados para todos y quería mirar la posibilidad de aprovechar esta tecnología, más que nada por el coste de los mensajes que de momento es cero. Continuo investigando a ver si se puede hacer algo.
Gracias. |
when clausule from a button | Hello ,
[code=fw:3rh9w45h]<div class="fw" id="{CB}" style="font-family: monospace;"><br />lBuild := .F.<br /><span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">BUTTON</span> oBut<span style="color: #000000;">[</span><span style="color: #000000;">2</span><span style="color: #000000;">]</span> <span style="color: #0000ff;">OF</span> oBar <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"Edit"</span> <span style="color: #0000ff;">RESOURCE</span> <span style="color: #ff0000;">"edit32"</span> ; <br /> <span style="color: #0000ff;">ACTION</span> <span style="color: #000000;">(</span> <span style="color: #000000;">(</span>cAlias<span style="color: #000000;">)</span>-><span style="color: #000000;">(</span>RelBuilder<span style="color: #000000;">(</span>oBrw,oBrwAct,aInto,@lBuild<span style="color: #000000;">)</span><span style="color: #000000;">)</span>,;<br /> oBrw:<span style="color: #0000ff;">Refresh</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> ,;<br /> oBrw:<span style="color: #000000;">SetFocus</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span>,;<br /> oWnd:<span style="color: #000000;">AevalWhen</span><span style="color: #000000;">(</span><span style="color: #000000;">)</span> <span style="color: #000000;">)</span> <br />...<br /><span style="color: #0000ff;">DEFINE</span> <span style="color: #0000ff;">BUTTON</span> oBut<span style="color: #000000;">[</span><span style="color: #000000;">4</span><span style="color: #000000;">]</span> <span style="color: #0000ff;">OF</span> oBar <span style="color: #0000ff;">PROMPT</span> <span style="color: #ff0000;">"Set Relations"</span> <span style="color: #0000ff;">RESOURCE</span> <span style="color: #ff0000;">"buildall"</span> GROUP ;<br /> <span style="color: #0000ff;">WHEN</span> <span style="color: #000000;">(</span>lBuild<span style="color: #000000;">)</span>;<br /><br /><br />......<br /><br />oBrw:<span style="color: #000000;">bkeyDown</span> := <span style="color: #000000;">{</span> | nkey | IIF<span style="color: #000000;">(</span>nkey==<span style="color: #000000;">13</span> , EVAL<span style="color: #000000;">(</span>oBut<span style="color: #000000;">[</span><span style="color: #000000;">2</span><span style="color: #000000;">]</span>:<span style="color: #000000;">bAction</span><span style="color: #000000;">)</span> ,;<br /> IIF<span style="color: #000000;">(</span>nkey==VK_DELETE .AND. EVAL<span style="color: #000000;">(</span>oBut<span style="color: #000000;">[</span><span style="color: #000000;">3</span><span style="color: #000000;">]</span>:<span style="color: #000000;">bWhen</span><span style="color: #000000;">)</span> ,;<br /> EVAL<span style="color: #000000;">(</span>oBut<span style="color: #000000;">[</span><span style="color: #000000;">3</span><span style="color: #000000;">]</span>:<span style="color: #000000;">bAction</span><span style="color: #000000;">)</span> , <span style="color: #000000;">)</span> <span style="color: #000000;">)</span><span style="color: #000000;">}</span><br /><br />oBrw:<span style="color: #000000;">bLDblClick</span> := <span style="color: #000000;">{</span>||EVAL<span style="color: #000000;">(</span>oBut<span style="color: #000000;">[</span><span style="color: #000000;">2</span><span style="color: #000000;">]</span>:<span style="color: #000000;">bAction</span><span style="color: #000000;">)</span> <span style="color: #000000;">}</span><br /><br /> </div>[/code:3rh9w45h]
Relbuilder set lBuild to .T. when the save button is clicked
Using button edit works as expected after editing oBut[4] changes from disabled in enabled
BUT enter or doubleclicking in the browse let edit , but doesn't change obut[4] : it is still disabled !
Placing a tracelog in the when clausule from obut[4] : When (tracelog(lBuild) , lBuild) :
When the edit button is used , i can see that oWnd:AevalWhen() is executed , lBuild = .T.
Using enter or doubleclicking : AevalWhen seems not to be executed !!!!!!!
Frank |
when clausule from a button | Using a buttonbar we must
oWnd:oBar:AevalWhen()
Still : Why it works when the edit button is used AND Aevalwhen is executed and why not whit doubleclicking ? |
when de los gets | Hola Amigos: tengo una dialog con muchos gets, cada vez que uno de ellos pierde foco me revisa todas las condiciones when de cada get, esto es normal, es algo de las clases? o me esta pasando algo raro.
Saludos. Gracias. |
when de los gets | Leonor:
La condicion when de tus gets se evaluan todas juntas al activar el dialogo que los contiene, por ejemplo si vos tenes en variables locales las condiciones asociadas a cada get al activarse el dialogo los que no cumplan la condicion when estaran deshabilitados. Una vez que el dialogo esta activado si cambia el valor de la condicion when de algun get le tenes que hacer un :refresh().
Saludos, |
when de los gets | Esta bien lo que me explicas, y así esta trabajando, pero lo que me hace es lo siguiente: ejecuta los when de cada get en el activate del dialog, despues por cada get que pierde foco vuelve a ejecutar los when de cada get, en el dialog veo como se refrescan todos los get por cada uno que pierde foco y me puse carteles y veo como pasa por todos los get en lugar de hacer el valid de ese y el when del proximo a tomar foco unicamente, no hay ningun refresh puesto en ningun lugar, evidentemente estoy armando mal el vector que tiene los when guardados. Gracias. Leonor. |
when de los gets | Leonor:
Mostranos el codigo involucrado.
Saludos, |
when de los gets | Leonor,
Todos los WHEN de los GETs tienen que evaluarse, porque en función del cambio que se haya hecho, podría afectarles. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.