Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Keep app "on top" or "floating"?

Posted on 1998-07-14
1
Medium Priority
?
160 Views
Last Modified: 2010-05-03
what would I need to do in order to my application from getting hiden behind another app. I would like it to always be on top. If anyone can post the code need to do this, I'd appreciate it.
Thanks
0
Comment
Question by:LostOne
1 Comment
 
LVL 6

Accepted Solution

by:
clifABB earned 400 total points
ID: 1465733
Declare Function SetWindowPos Lib "user32" Alias "SetWindowPos" (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) As Long
Public Const SWP_NOMOVE = &H2
Public Const SWP_NOSIZE = &H1
Public Const HWND_TOPMOST = -1
Public Const HWND_NOTOPMOST = -2
public Const FLAGS = SWP_NOMOVE Or SWP_NOSIZE

To set the form Form1 to TOPMOST, use the following code:
lRes = SetWindowPos(Form1.hWnd, HWND_TOPMOST, 0, 0, 0, 0, FLAGS) ' lRes <> 0 When Successful

To reset the form Form1 to NON-TOPMOST, use the following code:

lRes = SetWindowPos (Form1.hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, FLAGS) REM lRes <> 0 When Successful

0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question