3 Replies - 5149 Views - Last Post: 24 March 2010 - 08:06 PM Rate Topic: -----

#1 beju0506  Icon User is offline

  • D.I.C Head

Reputation: 7
  • View blog
  • Posts: 78
  • Joined: 23-February 08

Window won't come to front (become forefront window)

Posted 23 March 2010 - 12:12 PM

Hey everyone,

I've done some searching on Google and no luck, so I thought I'd check here. I have a relatively simple windows forms program I wrote in C#. In the program I scan the network, get a list of computer names, then when the user chooses computers and clicks a button, I run a WMI query on each of the selected computers. However, the problem is that if I open another program that is overtop of my WMI program's window, when I try to click on it or click on the taskbar thing for it, it won't come to the front. It will stay behind the other windows...
I'm not doing the WMI processing in a different thread (a mistake, I know, which will be rectified in a future version), which may be part of the problem, since this is the only time the window problem is happening. However, if I right click on the name of the program in the taskbar, it will come to the front... just not if I do left-click or actually click on a visible portion of the window.
Does anyone know how I can fix this? I haven't messed with any of the display properties, so everything should be set to the default that VS2008 sets it. Or do you think it's just that the window is partially unresponsive because of the intense calculation going on with the queries?

Thanks!

-Justin


[EDIT: Just noticed something else. If the active window (not my program) is not maximized, I get this issue... if it IS maximized, I can left-click on my program in the taskbar to bring it up as the active window... thought maybe this might help someone narrow it down for me. Thanks!]

This post has been edited by beju0506: 23 March 2010 - 12:14 PM


Is This A Good Question/Topic? 0
  • +

Replies To: Window won't come to front (become forefront window)

#2 FlashM  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 382
  • View blog
  • Posts: 1,195
  • Joined: 03-December 09

Re: Window won't come to front (become forefront window)

Posted 23 March 2010 - 12:40 PM

beju0506, can you send some sample code of your program, so we can test and try to reproduce this issue on our computers. It's really hard to say why this is happening...
Was This Post Helpful? 1
  • +
  • -

#3 sk8ermeb  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 20
  • View blog
  • Posts: 111
  • Joined: 23-March 10

Re: Window won't come to front (become forefront window)

Posted 23 March 2010 - 01:05 PM

Yes without seeing your code it is difficult to say. My guess is that you are right and if you were to run the WMI querry in a seperate thread this would solve your problem. I say this from a similar experience where I was writing code to a communications port. Even though it was on an interrupt my frame would not update untill the com port thread was closed. I had to run the entire window and all com and calc processing on a seperate thread to make the window update while waiting for the com port to finish.

Of course you might be stuck. Alot of time when you are using wondows network tools, at least in xp, while its searching, or working on the network the window will not come to the front, and if you click in the task bar a blank white non-updated screen apears...

-sk8ermeb
Was This Post Helpful? 1
  • +
  • -

#4 beju0506  Icon User is offline

  • D.I.C Head

Reputation: 7
  • View blog
  • Posts: 78
  • Joined: 23-February 08

Re: Window won't come to front (become forefront window)

Posted 24 March 2010 - 08:06 PM

Hey everyone,

Sorry for getting back so late to you on this; I wanted to try out a few things before I took up any more of your time.

It seems the multithreading fixed this problem. I used BackgroundWorker and farmed out the WMI queries to that and the main window now acts properly. Kinda weird, but at least it's fixed. ;)

Just thought I'd let everyone know in case someone else runs into this issue.

Thanks again for your help! :)

-Justin


View Postsk8ermeb, on 23 March 2010 - 12:05 PM, said:

Yes without seeing your code it is difficult to say. My guess is that you are right and if you were to run the WMI querry in a seperate thread this would solve your problem. I say this from a similar experience where I was writing code to a communications port. Even though it was on an interrupt my frame would not update untill the com port thread was closed. I had to run the entire window and all com and calc processing on a seperate thread to make the window update while waiting for the com port to finish.

Of course you might be stuck. Alot of time when you are using wondows network tools, at least in xp, while its searching, or working on the network the window will not come to the front, and if you click in the task bar a blank white non-updated screen apears...

-sk8ermeb

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1