Using TWebServer()

Using TWebServer()

Postby rhlawek » Sat Sep 13, 2014 1:09 am

I began doing a little bit of testing with the TWebServer class, I was able to use the provided samples, my test html is below, and quite easily get it to serve up a web page with a labeled field for user the user to input a search value, and a button to press to initiate the search but my progress ended there, I don't get how to use this class any further than that. Can I get an example of how to capture the search value, and the button press to initiate a query. I'm assuming once I know how to do that the search function will return appropriate HTML to display the results. Once I know how to start the search, writing the display html is not too difficult a task.

I would also like to know if it possible to have this web server present html that is passed to it in a string, instead of having to write it to a file on disk and point to the file.

Robb

<HTML>
<TITLE>Analyzer</TITLE>
<HEAD>
</HEAD>

<SCRIPT>
function Search()
{
location.href = "results.htm?" + escape( document.search.item.value ) + '&' +
document.search.Headers[ 0 ].checked;
}
</SCRIPT>

<BODY BACKGROUND='images/beige3.bmp'>
<IMG SRC="images/Logo.jpg" alt="www.dummy.com" WIDTH=342 HEIGHT=90><br>
<H2>Analyzer</H2>
<FORM NAME="search">
<H3>Search: <INPUT SIZE=30 TYPE=Text VALUE="" NAME='item'>
<INPUT TYPE=Button Value='Search' OnClick=Search()></H3><br>
</FORM>

</BODY>
</HTML>
User avatar
rhlawek
 
Posts: 194
Joined: Sun Jul 22, 2012 7:01 pm

Re: Using TWebServer()

Postby Antonio Linares » Sat Sep 13, 2014 6:00 am

Robb,

Please review FWH/samples/fivegen folder

there you have a complete example.
regards, saludos

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

Re: Using TWebServer()

Postby rhlawek » Sun Sep 14, 2014 2:30 am

Thank you. I looked several times for such an example, but it appears that it will answer my questions. Thank you.

Robb
User avatar
rhlawek
 
Posts: 194
Joined: Sun Jul 22, 2012 7:01 pm

Re: Using TWebServer()

Postby rhlawek » Fri Sep 26, 2014 4:15 pm

I would like to use this class as part of a windows service I run, which is headless as you would expect a service to be. When I try to use this class in that context it tells me that TSocket cannot be used without a main window. All my test code on the console and with a GUI works just fine. For further testing purposes I added a window (tried activating and hiding it), which does open then hides, but the TSocket message persists.

What exactly is TSocket looking for from that window, or what does it need to see to know it has a main window available? I'm assuming there is a scope problem, but I can't figure out how to pursue this any further to solution.

Robb
User avatar
rhlawek
 
Posts: 194
Joined: Sun Jul 22, 2012 7:01 pm

Re: Using TWebServer()

Postby Antonio Linares » Tue Sep 30, 2014 8:55 am

Robb,

Sockets notifications arrive as windows messages, thats why we need a window
regards, saludos

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

Re: Using TWebServer()

Postby rhlawek » Tue Sep 30, 2014 4:31 pm

I understand that, and don't have an issue with it. I just need the window can be hidden and to not obstruct program flow. I can't figure out how to do that within a service. I'll provide a sample to illustrate what I am trying to make work, won't get to that again until later in the week. It seems to me that I am introducing a variable scope issue, but I'll work that out in the sample.

Robb
User avatar
rhlawek
 
Posts: 194
Joined: Sun Jul 22, 2012 7:01 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: nageswaragunupudi and 63 guests