Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 15589

[RESOLVED] MsgBox is hidden under the user-control window

$
0
0
When I use subclassing in a user-control, such a situation often occurs:

MsgBox is hidden under the user-control window, and the program is in a frozen state (fake death). I need to use the Alt key to switch the MsgBox to the front.

This situation only occurs in the VB6-IDE. Although it's only a small problem, it's very annoying. I'd like to know if there are some good ways to solve this problem. Thanks.

Code:

Private Sub SC_WindowProc(Result As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long)
    Const WM_SETFOCUS = &H7
    Const WM_KILLFOCUS = &H8
    Const WM_KEYDOWN = &H100
    Const WM_KEYUP = &H101
    Const WM_CHAR = &H102
    Const WM_COMMAND = &H111
    Const WM_LBUTTONDOWN = &H201
    Const WM_LBUTTONUP = &H202
    Const WM_RBUTTONDOWN = &H204
    Const WM_RBUTTONUP = &H205
   
    On Error GoTo Err_Handler
                               
    Select Case Msg
    Case WM_SETFOCUS
        If wParam <> UserControl.hWnd Then
            SetFocusEx UserControl.hWnd: Exit Sub
        End If
        SetFocusAPI m_hScintillaWnd            '--- Scintilla Window Handle
           
    Case WM_KILLFOCUS
        'PostMessageW m_hScintillaWnd, WM_KILLFOCUS, 0&, 0&
        PostMessageW UserControl.hWnd, WM_KILLFOCUS, 0&, 0&
       

    Case WM_CHAR
       
    Case WM_KEYDOWN
   
    End Select
           
    Result = SC.CallWindowProc(Msg, wParam, lParam)
   
    Select Case Msg
    Case WM_SETFOCUS, WM_KILLFOCUS
        'Do something
           
    End Select
   
    Exit Sub
   
Err_Handler:
    Result = SC.CallWindowProc(Msg, wParam, lParam)
End Sub


Viewing all articles
Browse latest Browse all 15589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>