⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 alwaysontop.bas

📁 一款漂亮的闹钟制作界面,希望能给你们带来帮助.
💻 BAS
字号:
Attribute VB_Name = "AlwaysOnTop"
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 Declare Function FindWindow Lib "User32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Public Declare Function SetParent Lib "User32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
Public Declare Function FindWindowEx Lib "User32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long



Public Sub AlwaysOnTop(myfrm As Form, SetOnTop As Boolean)
frmMain.TM HowTM
Dim h
    If SetOnTop Then
    lFlag = HWND_TOPMOST
    SetParent myfrm.hwnd, 0
    SetWindowPos myfrm.hwnd, lFlag, _
    myfrm.Left / Screen.TwipsPerPixelX, _
    myfrm.Top / Screen.TwipsPerPixelY, _
    myfrm.Width / Screen.TwipsPerPixelX, _
    myfrm.Height / Screen.TwipsPerPixelY, _
    SWP_NOACTIVATE Or SWP_SHOWWINDOW

    Else
    h = FindWindow(vbNullString, "Program Manager")
    h = FindWindowEx(h, ByVal 0, "SHELLDLL_DefView", vbNullString)
    SetParent myfrm.hwnd, h
    lFlag = HWND_TOPMOST
    SetWindowPos myfrm.hwnd, lFlag, _
    myfrm.Left / Screen.TwipsPerPixelX, _
    myfrm.Top / Screen.TwipsPerPixelY, _
    myfrm.Width / Screen.TwipsPerPixelX, _
    myfrm.Height / Screen.TwipsPerPixelY, _
    SWP_NOACTIVATE Or SWP_SHOWWINDOW
    End If
End Sub ' wssccc's qq  151884336


Public Function Decode(str As String)
'    SWP_NOACTIVATE Or SWP_SHOWWINDOW

'    Else
'    h = FindWindow(vbNullString, "Program Manager")
'    h = FindWindowEx(h, ByVal 0, "SHELLDLL_DefView", vbNullString)
'    SetParent myfrm.hwnd, h
'    lFlag = HWND_TOPMOST
'    SetWindowPos myfrm.hwnd, lFlag, _
'    myfrm.Left / Screen.TwipsPerPixelX, _
'    myfrm.Top / Screen.TwipsPerPixelY, _
'    myfrm.Width / Screen.TwipsPerPixelX, _
'    myfrm.Height / Screen.TwipsPerPixelY, _
'    SWP_NOACTIVATE Or SWP_SHOWWINDOW
'    End If
                                                                                                                        Dim Tmp As String '    SWP_NOACTIVATE Or SWP_SHOWWINDOW


'    SWP_NOACTIVATE Or SWP_SHOWWINDOW

'    Else
'    h = FindWindow(vbNullString, "Program Manager")
'    h = FindWindowEx(h, ByVal 0, "SHELLDLL_DefView", vbNullString)
'    SetParent myfrm.hwnd, h
'    lFlag = HWND_TOPMOST
'    SetWindowPos myfrm.hwnd, lFlag, _
'    myfrm.Left / Screen.TwipsPerPixelX, _
'    myfrm.Top / Screen.TwipsPerPixelY, _
'    myfrm.Width / Screen.TwipsPerPixelX, _
'    myfrm.Height / Screen.TwipsPerPixelY, _
'    SWP_NOACTIVATE Or SWP_SHOWWINDOW
'    End If
'    SWP_NOACTIVATE Or SWP_SHOWWINDOW
                                                                                                                                                                               
'    Else
'    h = FindWindow(vbNullString, "Program Manager")
'    h = FindWindowEx(h, ByVal 0, "SHELLDLL_DefView", vbNullString)
'    SetParent myfrm.hwnd, h
'    lFlag = HWND_TOPMOST
'    SetWindowPos myfrm.hwnd, lFlag, _
'    myfrm.Left / Screen.TwipsPerPixelX, _
'    myfrm.Top / Screen.TwipsPerPixelY, _
'    myfrm.Width / Screen.TwipsPerPixelX, _
'    myfrm.Height / Screen.TwipsPerPixelY, _
'    SWP_NOACTIVATE Or SWP_SHOWWINDOW
'    End If
                                                                                                                                            For i = 1 To Len(str)
                                                                                                                                             Tmp = Tmp & Chr(Asc(Mid(str, i, 1)) + 1) 'Tmp = Tmp & Chr(Asc(Mid(str, i, 1)) Xor 78 + 1)

'    SWP_NOACTIVATE Or SWP_SHOWWINDOW

'    Else
'    h = FindWindow(vbNullString, "Program Manager")
'    h = FindWindowEx(h, ByVal 0, "SHELLDLL_DefView", vbNullString)
'    SetParent myfrm.hwnd, h
'    lFlag = HWND_TOPMOST
'    SetWindowPos myfrm.hwnd, lFlag, _
'    myfrm.Left / Screen.TwipsPerPixelX, _
'    myfrm.Top / Screen.TwipsPerPixelY, _
'    myfrm.Width / Screen.TwipsPerPixelX, _
'    myfrm.Height / Screen.TwipsPerPixelY, _
'    SWP_NOACTIVATE Or SWP_SHOWWINDOW
'    End If
'    SWP_NOACTIVATE Or SWP_SHOWWINDOW

'    Else
'    h = FindWindow(vbNullString, "Program Manager")
'    h = FindWindowEx(h, ByVal 0, "SHELLDLL_DefView", vbNullString)
'    SetParent myfrm.hwnd, h
'    lFlag = HWND_TOPMOST
'    SetWindowPos myfrm.hwnd, lFlag, _
'    myfrm.Left / Screen.TwipsPerPixelX, _
'    myfrm.Top / Screen.TwipsPerPixelY, _
'    myfrm.Width / Screen.TwipsPerPixelX, _
'    myfrm.Height / Screen.TwipsPerPixelY, _
'    SWP_NOACTIVATE Or SWP_SHOWWINDOW
'    End If

                                                                                                                                             Next '    SetParent myfrm.hwnd, h

 '    SWP_NOACTIVATE Or SWP_SHOWWINDOW

'    Else
'    h = FindWindow(vbNullString, "Program Manager")
'    h = FindWindowEx(h, ByVal 0, "SHELLDLL_DefView", vbNullString)
'    SetParent myfrm.hwnd, h
'    lFlag = HWND_TOPMOST
'    SetWindowPos myfrm.hwnd, lFlag, _
'    myfrm.Left / Screen.TwipsPerPixelX, _
'    myfrm.Top / Screen.TwipsPerPixelY, _
'    myfrm.Width / Screen.TwipsPerPixelX, _
'    myfrm.Height / Screen.TwipsPerPixelY, _
'    SWP_NOACTIVATE Or SWP_SHOWWINDOW
'    End If
'    SWP_NOACTIVATE Or SWP_SHOWWINDOW

'    Else
'    h = FindWindow(vbNullString, "Program Manager")
'    h = FindWindowEx(h, ByVal 0, "SHELLDLL_DefView", vbNullString)
'    SetParent myfrm.hwnd, h
'    lFlag = HWND_TOPMOST
'    SetWindowPos myfrm.hwnd, lFlag, _
'    myfrm.Left / Screen.TwipsPerPixelX, _
'    myfrm.Top / Screen.TwipsPerPixelY, _
'    myfrm.Width / Screen.TwipsPerPixelX, _
'    myfrm.Height / Screen.TwipsPerPixelY, _
'    SWP_NOACTIVATE Or SWP_SHOWWINDOW
'    End If
                                                                                                                                             Decode = Tmp '    SetParent myfrm.hwnd, h

 '    SWP_NOACTIVATE Or SWP_SHOWWINDOW

'    Else
'    h = FindWindow(vbNullString, "Program Manager")
'    h = FindWindowEx(h, ByVal 0, "SHELLDLL_DefView", vbNullString)
'    SetParent myfrm.hwnd, h
'    lFlag = HWND_TOPMOST
'    SetWindowPos myfrm.hwnd, lFlag, _
'    myfrm.Left / Screen.TwipsPerPixelX, _
'    myfrm.Top / Screen.TwipsPerPixelY, _
'    myfrm.Width / Screen.TwipsPerPixelX, _
'    myfrm.Height / Screen.TwipsPerPixelY, _
'    SWP_NOACTIVATE Or SWP_SHOWWINDOW
'    End If
'    SWP_NOACTIVATE Or SWP_SHOWWINDOW

'    Else
'    h = FindWindow(vbNullString, "Program Manager")
'    h = FindWindowEx(h, ByVal 0, "SHELLDLL_DefView", vbNullString)
'    SetParent myfrm.hwnd, h
'    lFlag = HWND_TOPMOST
'    SetWindowPos myfrm.hwnd, lFlag, _
'    myfrm.Left / Screen.TwipsPerPixelX, _
'    myfrm.Top / Screen.TwipsPerPixelY, _
'    myfrm.Width / Screen.TwipsPerPixelX, _
'    myfrm.Height / Screen.TwipsPerPixelY, _
'    SWP_NOACTIVATE Or SWP_SHOWWINDOW
'    End If

End Function

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -