VB6: Maintaining an application over the others

Last update on November 21, 2008 09:21 AM by netty5
Published by netty5

VB6: Maintaining an application over the others




Maintaining an application on top of other applications, regardless if they were present on the screen or are called later is.

In a general module


Public Declare Function 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) As Long

Public Const HWND_TOPMOST = -1
Public Const HWND_NOTOPMOST = -2
Public Const SWP_NOACTIVATE = &H10
Public Const SWP_SHOWWINDOW = &H40
Public Const SWP_NOMOVE = 2
Public Const SWP_NOSIZE = 1

In the opening form

<code>Private Sub Form_Load() Dim R as long R = SetWindowPos(SheetName.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE) end sub

Calling the function


The function must be put in the activation of the form, which will allow to resume this function if the form is selected (as the fuction may be used by other application).


Private Sub Form_Activate()
    Dim R as long
    R = SetWindowPos(SheetName.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE)
end sub

Removing priority


Private sub SuppPriority()
    Dim R as long
    R= SetWindowPos(NomFeuille.hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE)
End sub
Best answers for « VB6: Maintaining an application over the others » in :
[VBA: VB6] Using excel from another application Show[VBA: VB6] Using excel from another application Here is a little routine to call Excel from VB6 or another Office application. Paste in a general module (eg Module1) In VBA>> Insert>> Module and paste in the window ... In VB6>>...
.exe is not a valid Win32 application Show.exe is not a valid Win32 application Downloaded File IDE controller badly configured CD/DVD is unreadable File system corrupt File unregistered Virus/spyware Problem with browser configuration When you launch an executable file,...
Expand your Desktop over multiple monitors ShowExpand your Desktop over multiple monitors Hardware Requirements Software Requirements How to proceed If you are using Windows and want to enlarge your current desktop without having to buy another huge screen, this is possible by...
Download ASP/PHP Web Application Builder ShowASP/PHP Web Application Builder is a simple database development application. Since it is very simple, it does not require any knowledge on programming, it easily allows you to create your databases with ASP and PHP languages. ASP/PHP Web...
Enterprise Application Integration (EAI) ShowIntroduction to the EAI concept The purpose of EAI (Enterprise Application Integration) is the interoperability and organization of the flow of information between heterogeneous applications, i.e. ensure communcation between the different...
The HTTP protocol ShowIntroduction to the HTTP protocol Since 1990 HTTP protocol (HyperText Transfer Protocol) has been the most widely used protocol on the Internet. Version 0.9 was only intended to transfer data over the Internet (in particular Web pages written in...
TCP/IP ShowWhat does TCP/IP mean? TCP/IP is a suite of protocols. The acronym TCP/IP means "Transmission Control Protocol/Internet Protocol" and is pronounced "T-C-P-I-P". It comes from the names of the two major protocols in the suite of protocols, i.e....