FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Using TWebServer()
Posts: 195
Joined: Sun Jul 22, 2012 07:01 PM
Using TWebServer()
Posted: Sat Sep 13, 2014 01: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>

Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Using TWebServer()
Posted: Sat Sep 13, 2014 06:00 AM

Robb,

Please review FWH/samples/fivegen folder

there you have a complete example.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 195
Joined: Sun Jul 22, 2012 07:01 PM
Re: Using TWebServer()
Posted: Sun Sep 14, 2014 02:30 AM

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

Robb

Posts: 195
Joined: Sun Jul 22, 2012 07:01 PM
Re: Using TWebServer()
Posted: Fri Sep 26, 2014 04: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

Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Using TWebServer()
Posted: Tue Sep 30, 2014 08:55 AM

Robb,

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

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 195
Joined: Sun Jul 22, 2012 07:01 PM
Re: Using TWebServer()
Posted: Tue Sep 30, 2014 04: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

Continue the discussion