What do you mean when you say Dim the Screen? Like when you Select Shutdown? Or do you mean how do you get access to the Screen for Drawing Operations?

If it's Accessing the Screen, Maximize a Borderless Form and use the BitBlt API with the GetDC API to copy the Image of the Desktop to the Form, giving the Illusion of the Desktop on which you can Draw, etc..

Otherwise, do the same as above, then use a loop to draw diagonal black lines every 2 pixels to give the effect of Dimming the Screen.

Here's a quick Example of how to add an Item the the System Menu of a Form and Utilize it..

In a Module..
Code:
Private Declare Function GetSystemMenu Lib "user32" (ByVal Hwnd As Long, ByVal bRevert As Long) As Long
Private Declare Function AppendMenu Lib "user32" Alias "AppendMenuA" (ByVal hMenu As Long, ByVal wFlags As Long, ByVal wIDNewItem As Long, ByVal lpNewItem As Any) As Long
Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal Hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal Hwnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long

Public Const GWL_WNDPROC = (-4)
Private Const MF_ENABLED = &H0&
Private Const MF_STRING = &H0&
Private Const WM_MENUSELECT = &H11F

Private lMenu As Long
Public lPrevProc As Long

Public Sub SetupMenu(ByVal lHwnd As Long)
    lMenu = GetSystemMenu(lHwnd, 0)
    Call AppendMenu(lMenu, MF_ENABLED Or MF_STRING, 200, ByVal "Happy Happy Joy Joy!")
End Sub

Public Function SubWindowProc(ByVal Hwnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
    Static lSelected As Long
    Static lSelMenu As Long
    
    If Msg = WM_MENUSELECT Then
        If lParam Then
            lSelected = wParam And &HFF
            lSelMenu = lParam
        Else
            If lSelected = 200 And lSelMenu = lMenu Then MsgBox "Happy Happy Joy Joy!!!", vbSystemModal, "System Menu Popup"
            lSelected = 0
        End If
    End If
    SubWindowProc = CallWindowProc(lPrevProc, Hwnd, Msg, wParam, ByVal lParam)
End Function
In the Form..
Code:
Private Sub Form_Load()
    Call SetupMenu(Hwnd)
    lPrevProc = SetWindowLong(Hwnd, GWL_WNDPROC, AddressOf SubWindowProc)
End Sub

Private Sub Form_Unload(Cancel As Integer)
    Call SetWindowLong(Hwnd, GWL_WNDPROC, lPrevProc)
End Sub

------------------
Aaron Young
Analyst Programmer
[email protected]
[email protected]