Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to make apps on topmost and set active?

Status
Not open for further replies.

pitzcom

Technical User
Feb 3, 2003
3
0
0
PH
I'm developing a program that would make the application on topmost and currently get focused. Using API call setwindowpos ontopmost does not work on games such as NBA live, Generals; when my programs which is on timer is loaded it is still at the bottom window and gets only at the top when mouse is click otherwise it does not work. Though this API call is effective on windows based program and eventhough on half life (counter strike) it does not work on some 3D games. Anyone knows how.... please help me?
 
There are some other functions to activate a window (ShowWindow, SetForegroundWindow, SetActiveWindow), but they won't set it topmost. Are you sure you get the right handle to those particular windows?

Remedy
 


hi i am new to this and novice in programming but i think i know the solution

on a bas module paste this code

Const HWND_TOPMOST = -1
Const HWND_NOTOPMOST = -2
Const SWP_NOSIZE = &H1
Const SWP_NOMOVE = &H2
Const SWP_FRAMECHANGED = &H20

Private Declare Sub SetWindowPos Lib "User32" _
(ByVal hWnd As Long, _
ByVal hWndInsertAfter As Long, _
ByVal X As Long, ByVal Y As Long, _
ByVal cx As Long, _
ByVal cy As Long, _
ByVal wFlags As Long)

on form laod event paste this

SetWindowPos Me.hWnd, HWND_TOPMOST, 0, 0, 0, 0, (SWP_FRAMECHANGED Or SWP_NOMOVE Or SWP_NOSIZE)


now make it exe . it will all the time on the top. i hope it serves you
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top