如 如何获取任务栏中时间区域的大小,位置,以及如何设置改变它的大小?

解决方案 »

  1.   


       如何读取 Windows 工作列的大小及位置? 原始来源:王国荣 此一问题需呼叫 SHAppBarMessage API 函数,细节如下: 1. API 的宣告:
        Const ABM_GETTASKBARPOS = &H5
        Private Type RECT
                Left As Long
                Top As Long
                Right As Long
                Bottom As Long
        End Type
        Private Type APPBARDATA
            cbSize As Long
            hWnd As Long
            uCallbackMessage As Long
            uEdge As Long
            rc As RECT
            lParam As Long
        End Type    注:如果以上的宣告放在「一般模组」底下, 应在 Const 之前加上 Public 保留字,
            并且将Private 保留字去掉。 2. 程式范例:              Dim data As APPBARDATA
                  data.cbSize = Len(data)
                  Call SHAppBarMessage(ABM_GETTASKBARPOS, data)
                  ' data.rc.Left 等於工作列的左边界
                  ' data.rc.Top 等於工作列的上边界
                  ' data.rc.Right 等於工作列的右边界
                  ' data.rc.Bottom 等於工作列的下边界              请注意以上求出之工作列位置及大小是以 pixel(像素) 为单位。
     
     
      

  2.   


    Type RECT
        Left As Long
        Top As Long
        Right As Long
        Bottom As Long
    End TypeDeclare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
    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
    Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
    Option ExplicitPrivate strTime As String
    Private intNum(5) As Integer
    Private i As IntegerPrivate Sub Form_Load()
        Dim hwnd As Long, RcTemp As RECT
        hwnd = FindWindow("Shell_TrayWnd", vbNullString)
        hwnd = FindWindowEx(hwnd, 0, "TrayNotifyWnd", vbNullString)
        hwnd = FindWindowEx(hwnd, 0, "TrayClockWClass", vbNullString)
        GetWindowRect hwnd, RcTemp
     End Sub
    自己看吧,,我懒得解释了返回的rctemp.width 其中你自己读把