Format modal form displayed on taskbar

According to MS , when you show a modal form in VB6, it doesn’t appear in the “by design” taskbar

But is there a way to make the appearance of the VB6 Modal form appear on the taskbar (the ShowInTaskbar property does not work when it is modal)

In one of our applications, we have a modal login form, which is the first form that will be displayed in the application after unloading the splash screen, if the user moves another window on top of you, you do not know that it is loaded.

+6
source share
3 answers

You can use something like this in modal form

Private Const WS_EX_APPWINDOW As Long = &H40000 Private Const GWL_EXSTYLE As Long = (-20) Private Const SW_HIDE As Long = 0 Private Const SW_SHOW As Long = 5 Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long Private m_bActivated As Boolean Private Sub Form_Activate() If Not m_bActivated Then m_bActivated = True Call SetWindowLong(hwnd, GWL_EXSTYLE, GetWindowLong(hwnd, GWL_EXSTYLE) Or WS_EX_APPWINDOW) Call ShowWindow(hwnd, SW_HIDE) Call ShowWindow(hwnd, SW_SHOW) End If End Sub 
+6
source

Put this code in your modal window:

 Private Declare Function ShowWindow Lib "user32" (ByVal hWnd As Long, ByVal nCmdShow As Long) As Long Private Sub Form_Activate() Call ShowWindow(Me.hWnd, vbHide) Me.Caption = Me.Caption Call ShowWindow(Me.hWnd, vbNormalFocus) End Sub 
+3
source

You will need to execute a subclass, something like this from VBAccelerator.

Disclaimer - adapted from PM2's answer to this question , which is probably a duplicate, but we cannot say, because the original poster never told us if their form was modal.

+1
source

Source: https://habr.com/ru/post/905213/


All Articles