Solved

Keep app "on top" or "floating"?

Posted on 1998-07-14
1
152 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 100 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Check Disk (CHKDSK) on all volumes and fix if needed. 8 178
Need VBS version of Excel date conversion 4 65
String manipulation in Visual Basic 7 59
Advice in Xamarin 21 56
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…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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 process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

920 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now