473,320 Members | 2,094 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Waiting for a web page to load on shutdown

I'm new to c# and am currently developing a small login/logout app that runs
in the system tray. I am trying to get it to access a website during system
shutdown, but it doesn't seem to want to.
//catch message from windows on shutdown
protected override void WndProc(ref Message m)
{
if (m.Msg == 0x11)
{
this.flagBoolean1 = true; //set flag for closing app OK

string currentUrl = webBrowser1.Url;

if (currentUrl.Contains("webpage1"))
webBrowser1.Navigate("webpage2");

else Shutdown();
}
base.WndProc(ref m);
}

//the close form cancel function for system tray app
private void Form1_Closing(object sender,
System.ComponentModel.CancelEventArgs e)
{
//really close app?
if (!flagBoolean1)
{
e.Cancel = true;
this.Visible = false;
}
else
{
string currentUrl = webBrowser1.Url;

//tried the web navigation at both locations to no avail
if (currentUrl.Contains("webpage1"))
{
webBrowser1.Navigate("webpage2");
}
Shutdown();
}
}
private void Shutdown()
{
this.WindowState = System.Windows.Forms.FormWindowState.Normal;
this.notifyIcon1.Visible = false;
this.Dispose();
Application.Exit();
this.Close();
}

Nov 17 '05 #1
1 1559
Sorry, i didn't get a chance to finish my post and somehow posted it anyway.
I am looking for ideas on how to get it to access the website "webpage2" when
shutdown is called, then to procceed with shutdown once the page is fully
loaded.

"mikelostcause" wrote:
I'm new to c# and am currently developing a small login/logout app that runs
in the system tray. I am trying to get it to access a website during system
shutdown, but it doesn't seem to want to.
//catch message from windows on shutdown
protected override void WndProc(ref Message m)
{
if (m.Msg == 0x11)
{
this.flagBoolean1 = true; //set flag for closing app OK

string currentUrl = webBrowser1.Url;

if (currentUrl.Contains("webpage1"))
webBrowser1.Navigate("webpage2");

else Shutdown();
}
base.WndProc(ref m);
}

//the close form cancel function for system tray app
private void Form1_Closing(object sender,
System.ComponentModel.CancelEventArgs e)
{
//really close app?
if (!flagBoolean1)
{
e.Cancel = true;
this.Visible = false;
}
else
{
string currentUrl = webBrowser1.Url;

//tried the web navigation at both locations to no avail
if (currentUrl.Contains("webpage1"))
{
webBrowser1.Navigate("webpage2");
}
Shutdown();
}
}
private void Shutdown()
{
this.WindowState = System.Windows.Forms.FormWindowState.Normal;
this.notifyIcon1.Visible = false;
this.Dispose();
Application.Exit();
this.Close();
}

Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Josh | last post by:
Hi - A couple days ago I posted asking for help on how to download a pushed file. I am trying to write a script to download a bunch of links from a page that takes a while to load. I managed to...
2
by: Shige | last post by:
I have a IIS server somewhere hosting an aspx website. Whenever i tried to access the website after some times, my browser will like wait about 10-20 seconds before showing the contents. But after...
3
by: Senthil | last post by:
Hi, I would like to know the code for reboot and shutdown windows xp professional using VB.Net. thanx Senthil
1
by: Manoj S | last post by:
Hello, I have two aspx pages. In the page load of one of the page, I have a com+ component being initiated and used. Due to this, DLLHOST.exe gets loaded. After the usage of the object is over,...
9
by: yxq | last post by:
Hello, Me.Cursor = Cursors.WaitCursor It will make mouse pointer to become waiting status for my form only, how to become waiting status for whole desktop? Thank you
4
by: marcosnogood | last post by:
Hello, I need to dynamically load an activex object because what object to load is based on certain conditions. Also I need to wait for the object to have initialized before moving on. What I...
4
by: Jono | last post by:
Hi Everyone, As it says in the title, I'm looking for a way to display a page while long running operations are performed on the server. Ideally, I'd like some way to push the current request...
2
by: mumebuhi | last post by:
I am having problem to kill the following script completely. The script basically does the following. The main thread creates a new thread, which does a completely useless thing, and then starts...
9
by: erikcw | last post by:
Hi, I have a cgi script where users are uploading large files for processing. I want to launch a subprocess to process the file so the user doesn't have to wait for the page to load. What is...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.