Make an application on top of another window in VB6
Maintaining an application on top of other applications, regardless if they were present on the screen or are called later is.
VB6: Maintaining an application over the others
* In a general module
* In the opening form
* Calling the function
* Removing priority
Copy and paste this in a General Module.
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 function may be used by other application).
Removing priority
VB6: Maintaining an application over the others
* In a general module
* In the opening form
* Calling the function
* Removing priority
Copy and paste this 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 = 1Put this in your form.
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 function 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
Comments
Post a Comment