Results 1 to 9 of 9

Thread: Program will not restore from taskbar when clicked after minimized

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2011
    Posts
    38

    Program will not restore from taskbar when clicked after minimized

    VB.Net 2010, XP

    I have a program which reads .xls, .doc, .msg, .htm, and .txt files searching
    for a word or phrase and adds the findings to a grid.
    After I minimize it, it will not restore when I click on it on the taskbar. It
    just beeps.
    I have added DoEvents in all places inside loops. That has not helped.

    Ideas?

  2. #2
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,104

    Re: Program will not restore from taskbar when clicked after minimized

    You were able to minimize it, which suggests that it isn't actually frozen....though the beep, and your actions, suggest that it is. Does it run fine when you don't minimize it?
    My usual boring signature: Nothing

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Program will not restore from taskbar when clicked after minimized

    Quote Originally Posted by MLarsB View Post
    I have added DoEvents in all places inside loops. That has not helped.
    That does not bode well. Even apart from this issue, you almost certainly should be using multi-threading of some sort. Are you only processing one file at a time? If so then you might consider doing the processing in the DoWork event handler of a BackgroundWorker.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  4. #4

    Thread Starter
    Member
    Join Date
    Feb 2011
    Posts
    38

    Re: Program will not restore from taskbar when clicked after minimized

    Shaggy Hiker,
    The program runs fine when not minimized. I can restore it with Task Manager "Switch To" but not with alt-tab. When I get to it and release the buttons it just beeps. When it is restored, it shows that it has just kept running as usual.

  5. #5

    Thread Starter
    Member
    Join Date
    Feb 2011
    Posts
    38

    Re: Program will not restore from taskbar when clicked after minimized

    I am processing one file at a time. I don't know how to do the processing in the DoWork event handler of a BackgroundWorker and I will not be learning while on this task.

    Thanks, though.

  6. #6

    Thread Starter
    Member
    Join Date
    Feb 2011
    Posts
    38

    Re: Program will not restore from taskbar when clicked after minimized

    I have a break point in each of these events, so I know they do not run: frmGridDisplay_Resize, frmGridDisplay_ResizeBegin, frmGridDisplay_ResizeEnd.

  7. #7
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,104

    Re: Program will not restore from taskbar when clicked after minimized

    What I find interesting is that you can restore it, just not by some typical means. I don't know what difference there might be between Taskbar restore and the other means, but it rather suggests to me that the program is responding rather than being frozen, as I initially thought. Do you have any code that deals with minimizing the form? What I am looking for is anything that could be causing it to minimize as soon as you attempt to restore.
    My usual boring signature: Nothing

  8. #8

    Thread Starter
    Member
    Join Date
    Feb 2011
    Posts
    38

    Re: Program will not restore from taskbar when clicked after minimized

    There are no "WindowState" usages in the code. Very occasionally it responds. It is in a tight loop much of the time. I tried sleep(1000) in the inner loop but it did not make a difference.

  9. #9

    Thread Starter
    Member
    Join Date
    Feb 2011
    Posts
    38

    Re: Program will not restore from taskbar when clicked after minimized

    I added this code to the form and now it still beeps, but it does the restore:
    Code:
      Private Sub frmGridDisplay_Activated(sender As Object, e As System.EventArgs) Handles Me.Activated
        If Me.WindowState = FormWindowState.Minimized Then
          Me.WindowState = FormWindowState.Normal
        End If
      End Sub

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width