system shut down problem with webbrowser

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • mikelostcause

    system shut down problem with webbrowser

    Is there anyway to hold the base.WndProc(re f m) until after the Logout()
    function finishes loading a webpage??

    I'm working on shutting down an app that runs in the system tray, I have no
    problems shutting down, but I have problems saving data first.

    if the base.WndProc(re f m) is placed at the top, it closes, but the system
    does not continue to shutdown and it does not save the data via the Logout()
    funtion.
    If the base.WndProc(re f m) is placed at the bottom, it closes correctly, but
    doesn't seem to perform the Logout function, I don't believe that it is
    waiting for the webpage to load.

    protected override void WndProc(ref Message m)
    {
    //base.WndProc(re f m); ----------placed at the top position
    switch(m.Msg)
    {
    case WM_SYSCOMMAND:

    switch(m.WParam .ToInt32()){

    case SC_SCREENSAVE:
    Logout();
    break;

    case SC_MONITORPOWER :
    Logout();
    break;

    default:
    break;
    }
    break;

    case WM_QUERYENDSESS ION:
    this.flagBoolea n1 = true; //do i really want to shut down?
    Logout();
    break;

    case WM_WTSSESSION_C HANGE:
    this.flagBoolea n1 = true; //do i really want to shut down?
    Logout();
    break;

    }
    base.WndProc(re f m); // placed at the bottom position
    }

    the Logout() function consists of a call to a website.

    my understanding of messages is not very good, and i haven't been able to
    find a good way to learn about them.


  • Nicholas Paldino [.NET/C# MVP]

    #2
    Re: system shut down problem with webbrowser

    Mike,

    I don't think it should really matter where you place it, because
    windows is going to wait for your method to return, and calling the base at
    any point isn't going to force the return.

    Rather, I would look at the Logout function. Is it loading the page
    asynchronously? If so, have it take a flag as a parameter which causes it
    to load synchronously, or wait after the call to Logout (through an Event or
    something of that nature) to determine when the page is done loading.

    Also, what are you using to load the page?

    Hope this helps.

    --
    - Nicholas Paldino [.NET/C# MVP]
    - mvp@spam.guard. caspershouse.co m

    "mikelostca use" <mikelostcause@ discussions.mic rosoft.com> wrote in message
    news:111E6947-9978-4338-BB1C-77FFA9FC7E80@mi crosoft.com...[color=blue]
    > Is there anyway to hold the base.WndProc(re f m) until after the Logout()
    > function finishes loading a webpage??
    >
    > I'm working on shutting down an app that runs in the system tray, I have
    > no
    > problems shutting down, but I have problems saving data first.
    >
    > if the base.WndProc(re f m) is placed at the top, it closes, but the system
    > does not continue to shutdown and it does not save the data via the
    > Logout()
    > funtion.
    > If the base.WndProc(re f m) is placed at the bottom, it closes correctly,
    > but
    > doesn't seem to perform the Logout function, I don't believe that it is
    > waiting for the webpage to load.
    >
    > protected override void WndProc(ref Message m)
    > {
    > //base.WndProc(re f m); ----------placed at the top position
    > switch(m.Msg)
    > {
    > case WM_SYSCOMMAND:
    >
    > switch(m.WParam .ToInt32()){
    >
    > case SC_SCREENSAVE:
    > Logout();
    > break;
    >
    > case SC_MONITORPOWER :
    > Logout();
    > break;
    >
    > default:
    > break;
    > }
    > break;
    >
    > case WM_QUERYENDSESS ION:
    > this.flagBoolea n1 = true; //do i really want to shut
    > down?
    > Logout();
    > break;
    >
    > case WM_WTSSESSION_C HANGE:
    > this.flagBoolea n1 = true; //do i really want to shut
    > down?
    > Logout();
    > break;
    >
    > }
    > base.WndProc(re f m); // placed at the bottom position
    > }
    >
    > the Logout() function consists of a call to a website.
    >
    > my understanding of messages is not very good, and i haven't been able to
    > find a good way to learn about them.
    >
    >[/color]


    Comment

    Working...