944,093 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 21383
  • C++ RSS
Aug 9th, 2005
0

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

Expand Post »
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.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
ravinderreddy is offline Offline
3 posts
since Jul 2005
Aug 9th, 2005
0

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

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.
Reputation Points: 19
Solved Threads: 5
Junior Poster
Stoned_coder is offline Offline
164 posts
since Jul 2005
Aug 9th, 2005
0

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

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.
Reputation Points: 19
Solved Threads: 5
Junior Poster
Stoned_coder is offline Offline
164 posts
since Jul 2005
Aug 9th, 2005
0

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

The SetActiveWindow function might also come in handy.
Reputation Points: 13
Solved Threads: 0
Light Poster
Dante Shamest is offline Offline
46 posts
since Apr 2003
Aug 11th, 2005
0

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

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...
C++ Syntax (Toggle Plain Text)
  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);
Reputation Points: 19
Solved Threads: 5
Junior Poster
Stoned_coder is offline Offline
164 posts
since Jul 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: please provide a separate forum for C
Next Thread in C++ Forum Timeline: binary tree class





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC