Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Always on top

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Varreon
Advanced Cheater
Reputation: 0

Joined: 13 Jun 2007
Posts: 80

PostPosted: Mon Jul 09, 2007 5:59 pm    Post subject: Always on top Reply with quote

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
View user's profile Send private message
appalsap
Moderator
Reputation: 0

Joined: 27 Apr 2006
Posts: 6753
Location: Pakistan

PostPosted: Mon Jul 09, 2007 6:05 pm    Post subject: Reply with quote

SetFocus
Back to top
View user's profile Send private message
Varreon
Advanced Cheater
Reputation: 0

Joined: 13 Jun 2007
Posts: 80

PostPosted: Mon Jul 09, 2007 6:56 pm    Post subject: Reply with quote

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
View user's profile Send private message
Flyte
Peanuts!!!!
Reputation: 6

Joined: 19 Apr 2006
Posts: 1887
Location: Canada

PostPosted: Mon Jul 09, 2007 10:54 pm    Post subject: Reply with quote

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
View user's profile Send private message
Varreon
Advanced Cheater
Reputation: 0

Joined: 13 Jun 2007
Posts: 80

PostPosted: Mon Jul 09, 2007 11:34 pm    Post subject: Reply with quote

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 Very Happy Very Happy

_________________
Back to top
View user's profile Send private message
MadDoom
Cheater
Reputation: 0

Joined: 27 Dec 2006
Posts: 38

PostPosted: Tue Jul 10, 2007 2:53 am    Post subject: Reply with quote

if this in delphi:
change the formstyle to "fsStayOnTop" in the object inspector.
Back to top
View user's profile Send private message
Varreon
Advanced Cheater
Reputation: 0

Joined: 13 Jun 2007
Posts: 80

PostPosted: Tue Jul 10, 2007 9:00 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites