Call HTML form in FWH application

Call HTML form in FWH application

Postby TimStone » Fri May 21, 2021 6:21 pm

I would like to display an HTML form from within a Win32 Desktop application ( NOT MOD_HARBOUR PLEASE )

From a website the following is called:

<form name=”PrePage” method = “post” action = “https://SourceServer.com/payment/Catalog.aspx”>
<input type = “hidden” name = “LinkId” value =”jiehiu378208kijfiiuie” />
<input type = “image” src =”//content.SourceServer.com/images/getit.gif” /></form>

Though I use this on my server now, hackers are trying to access it. The last time they did it, they diverted payments to their PayPal account ( knowing PP lets them get away with the theft ). I want to remove the "Store" from my website completely and have the access only in my application which is NOT web based.
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2944
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Call HTML form in FWH application

Postby rhlawek » Fri May 21, 2021 7:46 pm

Tim,

I don't think I completely understand the ask. What exactly do you want to be able to do from your application?
User avatar
rhlawek
 
Posts: 194
Joined: Sun Jul 22, 2012 7:01 pm

Re: Call HTML form in FWH application

Postby TimStone » Fri May 21, 2021 8:22 pm

On a website, I define a popup form with the code I provided. That links to a secured credit card gateway. It is an HTML form.

I want to have a menu option in my program that will popup the same form. Yes, it would display it in the default web browser on that computer, and the individual would then process the form ( on that same browser ).

I need to pass that entire script to the web browser from within the program. Right now it's easy to call websites, but I don't pass all the extra information. For Example:

ACTION ShellExecute( nil, "open", "http://fivetech.com" ) will open that website, but how can I pass the data above to open a form in the browser ?
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2944
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Call HTML form in FWH application

Postby Marc Venken » Fri May 21, 2021 8:54 pm

Tim,

I was also looking for showing html from FW and I found this function on the forum and was playing with it.
I put your form insite the html file you have to put in the samples dir of you choise (change the path in the prg)

It seem to put the data into the form, but dos not send. It can however be a starting point from where to look.

Code: Select all  Expand view  RUN

#include "FiveWin.ch"

#Define OLECMDID_PRINT 6
#Define OLECMDEXECOPT_PROMPTUSER 1
#Define OLECMDEXECOPT_DONTPROMPTUSER 2

Function Main()
   local oWnd, oActiveX1, oActiveX2, cTemp

   cTemp = '<head><link rel="stylesheet" href="temp.css"></head><table class="styled-table"><thead><tr><th>36</th><th>38</th>'
   cTemp += '<th>40</th><th>42</th><th>44</th></tr></thead><tbody><tr><td></td><td>1</td><td>1</td><td>1</td><td>2</td></tr></tbody></table>'

   DEFINE WINDOW oWnd TITLE "FiveWin multiple ActiveX support"

   //@ 10, 10 ACTIVEX oActiveX1 PROGID "Shell.Explorer" OF oWnd SIZE 500, 150
   @ 5, 5 BUTTON "&OK"     OF oWnd SIZE 40, 12  ACTION drukhtml()

   //oActiveX1:Do( "Navigate2", "c:\fwharb\samples\temp.html" )

   ACTIVATE WINDOW oWnd

return nil

function drukhtml()
  cHtml:= "c:\fwharb\samples\temp.html"
  printhtml(cHtml,1,.t.)
return nil

FUNCTION PrintHtml(cHtmlOrUrl,nCopies,lShow)
static oWnd1:=nil, oBar, oIe
local i
default lShow:=.f.,nCopies:=1
if oWnd1=nil
DEFINE WINDOW oWnd1
DEFINE BUTTONBAR oBar OF oWnd1
DEFINE BUTTON OF oBar;
PROMPT 'Print'
endif
oIe = TActiveX():New( oWnd1, "Shell.Explorer" )
oIe:Do( "Navigate2", cHtmlOrUrl)
if lshow
oWnd1:oClient = oIe
ShowWindow(oWnd1, 1 ) && 1=Show,0=hide
ACTIVATE WINDOW oWnd1
oWnd1:Center()
endif
sysrefresh()
RETURN nil


FUNCTION PrintHtml2(cHtmlOrUrl,nCopies,lShow)
static oWnd:=nil, oBar, oIe
local i
default lShow:=.f.,nCopies:=1
if oWnd=nil
DEFINE WINDOW oWnd
DEFINE BUTTONBAR oBar OF oWnd
DEFINE BUTTON OF oBar;
PROMPT 'Print';
ACTION oIe:Do( "ExecWB", OLECMDID_PRINT, OLECMDEXECOPT_PROMPTUSER )
oIe = TActiveX():New( oWnd, "Shell.Explorer" )
endif
oIe:Do( "Navigate2", cHtmlOrUrl)
do while alltrim(oIe:document:readyState) <> 'complete'
sysrefresh()
waitseconds(.5)
enddo
if lshow
oWnd:oClient = oIe
ShowWindow(oWnd, 1 ) && 1=Show,0=hide
ACTIVATE WINDOW oWnd
oWnd:Center()
else
for i=1 to nCopies
msgwait('Printing large receipt (' + alltrim(str(i)) + ' of '+alltrim(str(nCopies))+' copies).',,2)
oIe:Do( "ExecWB", OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER )
next i
endif
sysrefresh()
RETURN nil

 


temp.html has folowing code inside :

<form name=”PrePage” method = “post” action = “https://SourceServer.com/payment/Catalog.aspx”>
<input type = “hidden” name = “LinkId” value =”jiehiu378208kijfiiuie” />
<input type = “image” src =”//content.SourceServer.com/images/getit.gif” /></form>
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1435
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: Call HTML form in FWH application

Postby rhlawek » Sat May 22, 2021 12:52 am

Perhaps write the .html to a local file then pass that file name into ShellExecute(), instead of a url, and depend on Windows default file handler to open in the browser based on file extension.
User avatar
rhlawek
 
Posts: 194
Joined: Sun Jul 22, 2012 7:01 pm

Re: Call HTML form in FWH application

Postby nageswaragunupudi » Sat May 22, 2021 2:53 am

I was also looking for showing html from FW and I found this function on the forum and was playing with it.


Please consider using the built-in FWH function
Code: Select all  Expand view  RUN

HTMLVIEW( cHtmlFile )  // give full path of the file
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10643
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Call HTML form in FWH application

Postby Marc Venken » Sat May 22, 2021 9:21 am

nageswaragunupudi wrote:
I was also looking for showing html from FW and I found this function on the forum and was playing with it.


Please consider using the built-in FWH function
Code: Select all  Expand view  RUN

HTMLVIEW( cHtmlFile )  // give full path of the file
 


Works also for me !

But is seems that just as the other option that HTMLVIEW also needs a file with a Path and HTML code inside it to work. Ok for viewing links, websites,...

I my case I browse a Xbrowse that has a field inside a memo that has HTML code to build a table based on data. So, when moving the browse, I want the dialog where the html is showing to refresh with new data
For now I think I can move the browse, save the htmlcode to a file and then call the htmlview with the updated htmlcode. Should work, but maybe there can be updated function that will show plain html data from a
variable data.

When cTemp = used, htmlview will also startup google and give a result of a google seek for the code (cTemp = used as a seeking parameter)


Code: Select all  Expand view  RUN

function htmlzien(cFile,oWnd1)
   cTemp = '<head><link rel="stylesheet" href="temp.css"></head><table class="styled-table"><thead><tr><th>36</th><th>38</th>'
   cTemp += '<th>99</th><th>42</th><th>44</th></tr></thead><tbody><tr><td></td><td>1</td><td>1</td><td>1</td><td>2</td></tr></tbody></table>'

  htmlview(cTemp)
//  htmlview(cTemp,"Titel",oWnd1,10,10,400,350)
  //htmlview(cFile,"Titel",oWnd1,10,10,400,350)

Return

 
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1435
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: Call HTML form in FWH application

Postby Antonio Linares » Sat May 22, 2021 4:54 pm

Tim,

ACTION ShellExecute( nil, "open", "http://www.fivetechsoft.com?param1=Tim&param2=Stone" )

The above issues a "GET" request as the params go on the URL after the "?"

If you want those params not to be seen on the URL then you have to use "MSXML2.XMLHTTP" or CURL to do a "POST" request
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42103
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot], wilsongamboa and 68 guests