我是要做一个桌面LED的时钟
要按“显示桌面”也不能最小化网上看到的全是置前,从没看到过置后,在此问一下不要用时钟

解决方案 »

  1.   

    如何让窗口不能最小化 并且 窗口置在最后?要按“显示桌面”也不能最小化我是要做一个桌面LED的时钟
    要按“显示桌面”也不能最小化网上看到的全是置前,从没看到过置后,在此问一下不要用时钟来判断窗口是否最小化
      

  2.   

    你的意思就像WIN7的桌面小工具一样是吧?
      

  3.   

    我仔细看了WIN7的小工具,如果按“显示桌面”这些小工具也会闪烁一下子。
    你要求不要用时钟,为啥?
      

  4.   

    找到代码了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 SetLayeredWindowAttributes Lib "user32" (ByVal hWnd As Long, ByVal crkey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
    Private Declare Function GetWindow Lib "user32" (ByVal hWnd As Long, ByVal wCmd As Long) As Long
    Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
    Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
    Private Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, ByRef lpvParam As Any, ByVal fuWinIni As Long) As Long
    Private Const WS_EX_LAYERED = &H80000 
    Private Const WS_EX_TRANSPARENT = &H20& 
    Private Const GWL_EXSTYLE = (-20) 
    Private Const LWA_COLORKEY = &H1 
    Private Const GW_CHILD = 5  
    Private Sub Form_Load()
        Dim rtn As Long, lColour As Long
        lColour = &H80000
        Me.BackColor = lColour
        rtn = GetWindowLong(Me.hWnd, GWL_EXSTYLE)
        rtn = rtn Or WS_EX_LAYERED Or WS_EX_TRANSPARENT
        SetWindowLong Me.hWnd, GWL_EXSTYLE, rtn
        SetLayeredWindowAttributes Me.hWnd, lColour, 0, LWA_COLORKEY 
    rtn = SystemParametersInfo(SPI_GETWORKAREA, 0, DeskTopRect, 0)
     rtn = FindWindow("Progman", vbNullString)
        SetParent Me.hWnd, GetWindow(rtn, GW_CHILD)
    End Sub