Page 1 of 1

Problem with WebOpen

Posted: Wed Apr 30, 2014 12:49 pm
by Rado1
I'm not sure it is a bug or my mistake, but the following behavior is suspicious:

in the attached project I wanted to read (later process) ZGE wiki pages. It uses WebOpen component several times, each time for one defined page. At the moment it has 2 pages defined. The application works correctly if started the first time in Preview (Alt+Enter). If started the second time, it reads just one page, and if started 3rd and more times, it does not read any page.

After some more tests I observed that the problem is not in WebOpen component itself, but in recursion of activation the same WebOpen component from its own OnResult section. This recursion is has probably some side effects causing the undesired behavior. In meantime I have another version of the project without recursion, which works fine.

Posted: Thu May 01, 2014 9:12 am
by VilleK
Cool idea to process ZGE wiki pages from ZGE itself :)

You are probably right it is the recursion that is the problem. Let me know if you find anything else, this component hasn't been tested much.

Posted: Mon May 05, 2014 11:20 am
by Rado1
Fixed in the latest beta, thanks Ville!

Posted: Sun Jun 01, 2014 7:32 am
by Rado1
Continuing with the idea of creating ZGE help from wiki pages, I would like to use WebOpen component also for downloading pictures (and maybe also other kind of binary files). I know, the original idea of WebOpen was different, but maybe its extension would not be very difficult.

The idea is to download a binary file from WebOpen.Url and put its content to the specified byte array WebOpen.ResultArray which can be saved to a local file by means of the File component.

At the moment, the WebOpen does not change the content of the specified WebOpen.ResultArray and the WebOpen.ResultString contains just first characters of the picture content (for instance, "‰PNG" for .png).

The attached project file contains an example of how I would like to use the WebOpen and File components.

Posted: Sun Jun 01, 2014 11:03 am
by Kjell
Hi Rado1,

In case you don't want to wait you could use a Array that is big enough to fit the largest file you want to support and a simple PHP script to determine the file-size. For instance ..

Code: Select all

$header = get_headers($_GET['url'], 1);
echo $header['Content-Length'];
.. that you then query using something like " ... /image.png". Alternatively you could simply use the WinINet functions directly.

But i'm sure Ville will fix it soon :)


Posted: Mon Jun 02, 2014 7:48 am
by Rado1
Hi Kjell, I would like to avoid PHP or external libraries, such as WinINet, if possible. Originally, I wanted to create the "ZGE help builder" in Java or C++, which would be easier, but creating a ZGE project for that is more interesting and challenging. Rado1.