How to make a window an active window(focussed window)

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Jul 2005
Posts: 3
Reputation: ravinderreddy is an unknown quantity at this point 
Solved Threads: 0
ravinderreddy ravinderreddy is offline Offline
Newbie Poster

How to make a window an active window(focussed window)

 
0
  #1
Aug 9th, 2005
On windows operating system How can we make a window an active window (focussed window) using c/c++ programming.
I tried using SetForegroundWindow() but it is not working.
AllowSetForegroundWindow() will work on Windows XP?

Any how please give me an idea regaurding this.
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 164
Reputation: Stoned_coder is an unknown quantity at this point 
Solved Threads: 5
Stoned_coder Stoned_coder is offline Offline
Junior Poster

Re: How to make a window an active window(focussed window)

 
0
  #2
Aug 9th, 2005
before you call that you must satisfy the conditions of SetForegroundWindow. This is easiest if you use SystemParametersInfo() to change the value of SPI_SETFOREGROUNDLOCKTIMEOUT to 0. Then SetForegroundWindow will work.
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 164
Reputation: Stoned_coder is an unknown quantity at this point 
Solved Threads: 5
Stoned_coder Stoned_coder is offline Offline
Junior Poster

Re: How to make a window an active window(focussed window)

 
0
  #3
Aug 9th, 2005
oh yeah dont forget to set it back to what it was after the call to SetForegroundWindow() so that the OS behaves as it should.
Reply With Quote Quick reply to this message  
Join Date: Apr 2003
Posts: 46
Reputation: Dante Shamest is an unknown quantity at this point 
Solved Threads: 0
Dante Shamest's Avatar
Dante Shamest Dante Shamest is offline Offline
Light Poster

Re: How to make a window an active window(focussed window)

 
0
  #4
Aug 9th, 2005
The SetActiveWindow function might also come in handy.
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 164
Reputation: Stoned_coder is an unknown quantity at this point 
Solved Threads: 5
Stoned_coder Stoned_coder is offline Offline
Junior Poster

Re: How to make a window an active window(focussed window)

 
0
  #5
Aug 11th, 2005
Your pm box is full ravin.
You may have an outdated sdk which is why this might not work for you. Try downloading latest platform sdk.

SPI_GETFOREGROUNDLOCKTIMEOUT is #defined as 0x2000
SPI_SETFOREGROUNDLOCKTIMEOUT is #defined as 0x2001

So you could try this...
  1. DWORD timeout;
  2. SystemParametersInfo(0x2000,0,&timeout,0);
  3. SystemParametersInfo(0x2001,0,0,SPIF_SENDWININICHANGE | SPIF_UPDATEINIFILE);
  4. SetForegroundWindow(hwnd);
  5. SystemParametersInfo(0x2001,0,&timeout,SPIF_SENDWININICHANGE | SPIF_UPDATEINIFILE);
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC