PDA

View Full Version : StatusDlg and HTTP.TestConnection


Stefan_M
04-29-2004, 08:41 AM
Hi all,

I want to show the StatusDlg window while checking a Website but it doesn't work. It seems that the action HTTP.TestConnection() stops all other actions.
Is there another way to show the Status while checking the internet?

Button [On Click]
CheckAdress="ww1.copadata.at"

_meter=0;
StatusDlg.SetMeterRange(0, 100);
StatusDlg.Show(MB_ICONNONE, false);
Page.StartTimer(200);

result = HTTP.TestConnection(CheckAdress, 20, 80, nil, nil);

StatusDlg.Hide();
Page.StopTimer();


Page [On Timer]
_meter=_meter+1;
StatusDlg.SetMeterPos(_meter);



Stefan

rhosk
04-29-2004, 09:33 AM
Hi Stefan,

This probably gets a little deep, but when checking a connection, there really is no "meter" (I see what you're trying to do). The site is either live or it's not. There's no 0 to 100 to really count.

My suggestion would be maybe an animated dialog (flash or whatever - a computer connect type animation?) that just ticks away until the the connection takes. My 2.5 cents.

CWRIGHT
04-29-2004, 03:36 PM
Hi Stefan,

No help i am afraid, but I too have the same issue as you. You can specify the number of seconds to try the TestConnection for, but have no way of representing the progress through this time (the AMS app is essentially frozen).

I guess Ron's idea coupled with an embedded object would work, but I don't want to use Flash in my app, and we have no animated gif support for the time being.

rhosk
04-29-2004, 03:55 PM
I actually played with this for a while today and I couldn't get an object to appear with a "live" site (had to make the site invalid). It connected fine every single time and the object just "flashed" (poor term of words) at best.

If the site you're trying to connect to is "not reliable", then how's about a workaround. Maybe place a file on the site to download (say, to a temp directory or whatever - ehhh, 100k) and that would give the user an indication that a process is happening and you could use a regular dialog for that. Then, you could put a condition there if the file doesn't download in 'n' seconds or whatever. I think that's what you're looking for. Kinda cheezy way of doing it, but it would give the user a sort of feedback, if that's what you're looking for.

It's proabably why IR didn't put a progress feedback option on that because the connection is either there or it isn't. Is there something else that you're trying to do here?

Intrigued
04-29-2004, 11:47 PM
Let me know (if you use this) if this section of code will help (thank you):


-- Web Site to check against

CheckAdress = "http://www.cnn.com"


-- Standby message -- so that the user has something to view while they wait

Dialog.TimedMessage("Connecton Status. . .", "Testing for an Internet Connection. Standby...\r\n (up to 20 seconds to process)", 5000, MB_ICONINFORMATION);


-- Actual checking for an active Internet connection

result = HTTP.TestConnection(CheckAdress, 20, 80, nil, nil);
err = Application.GetLastError(); -- Error handling begin
if err ~= 0 then
Dialog.Message("Error: ", err); -- Error handling end
else


-- Response back to the user wether there was an active connection to the Internet or not

if result then
Dialog.TimedMessage("Connection Status. . .", "Success! Internet connection verified, continuing.", 3500, MB_ICONEXCLAMATION);
else
Dialog.Message("Connection Status. . .", "Failure! Internet connection not found!\r\nPlease connect to the Internet and try again!", MB_OK, MB_ICONEXCLAMATION, MB_DEFBUTTON1);
end
end

[Edit] - Changed one MB_INFOICON from informational one to exclamation and took out an apparently runaway "--" (comment) at the end of a line of code (grin)[End of Edit]

Stefan_M
04-30-2004, 01:55 AM
Thanks for your answers.

Intrigued the code works fine. :yes



Stefan