| View previous topic :: View next topic |
| Author |
Message |
Varreon Advanced Cheater
Reputation: 0
Joined: 13 Jun 2007 Posts: 80
|
Posted: Mon Jul 09, 2007 5:59 pm Post subject: Always on top |
|
|
Ive been trying to keep a secondary form for my app to remain on top. Ive tried:
SetWindowPos(sub,HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
sub being the handle to my form. Thanks for any advice!
_________________
|
|
| Back to top |
|
 |
appalsap Moderator
Reputation: 0
Joined: 27 Apr 2006 Posts: 6753 Location: Pakistan
|
Posted: Mon Jul 09, 2007 6:05 pm Post subject: |
|
|
| SetFocus
|
|
| Back to top |
|
 |
Varreon Advanced Cheater
Reputation: 0
Joined: 13 Jun 2007 Posts: 80
|
Posted: Mon Jul 09, 2007 6:56 pm Post subject: |
|
|
Does this permanently force the window to remain on top? I want it to react like the "Always on top" option that is in the Windows Onscreen Keyboard.
*Edit*
Just tried SetFocus, but it doesn't achieve what im looking for. See above.
Thanks
_________________
|
|
| Back to top |
|
 |
Flyte Peanuts!!!!
Reputation: 6
Joined: 19 Apr 2006 Posts: 1887 Location: Canada
|
Posted: Mon Jul 09, 2007 10:54 pm Post subject: |
|
|
I believe this is what you are looking for:
| Code: | LONG wLong = GetWindowLong(hWnd,GWL_EXSTYLE);
SetWindowLong(hWnd, GWL_EXSTYLE, wLong | WS_EX_TOPMOST);
SetWindowPos(hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_FRAMECHANGED); |
|
|
| Back to top |
|
 |
Varreon Advanced Cheater
Reputation: 0
Joined: 13 Jun 2007 Posts: 80
|
Posted: Mon Jul 09, 2007 11:34 pm Post subject: |
|
|
Hmm... Maybe it wont work in my situation. So ive got form1, my main form. When Form1's button is clicked, Form2.Show() is called. Then a button on Form2 is pressed which applies that code after grabbing its handle.
The Result:
Form2 is always on top compared to form1, but I want it to be ontop in comparison to, say: Firefox.
Hope this can help u help me
_________________
|
|
| Back to top |
|
 |
MadDoom Cheater
Reputation: 0
Joined: 27 Dec 2006 Posts: 38
|
Posted: Tue Jul 10, 2007 2:53 am Post subject: |
|
|
if this in delphi:
change the formstyle to "fsStayOnTop" in the object inspector.
|
|
| Back to top |
|
 |
Varreon Advanced Cheater
Reputation: 0
Joined: 13 Jun 2007 Posts: 80
|
Posted: Tue Jul 10, 2007 9:00 am Post subject: |
|
|
Ok. This got the same results as setwindowpos, so i changed some. I have both the main form and form2 to formstyle: fsStayOnTop. Now it works, so I have my 2 forms always on top, although i'd have prefered just the 2nd. I'll just end up hiding my 1st form anyway...
THANKS!
_________________
|
|
| Back to top |
|
 |
|