MS Zooflow Sidebar
This commit is contained in:
@@ -13,6 +13,149 @@ Imports DigitalData.Modules.Messaging
|
||||
Imports DigitalData.Modules.Windows
|
||||
|
||||
Public Class frmFlowForm
|
||||
#Region "Sidebar Variablen und Konstanten"
|
||||
Public AppDeskData As AppDeskBar
|
||||
Public fBarRegistered As Boolean = False
|
||||
Public ret, i, uCallBack As Integer
|
||||
Structure RECT
|
||||
Public left As Integer
|
||||
Public top As Integer
|
||||
Public right As Integer
|
||||
Public bottom As Integer
|
||||
End Structure
|
||||
Structure AppDeskBar
|
||||
Public cbSize As Integer
|
||||
Public hWnd As IntPtr
|
||||
Public uCallbackMessage As Integer
|
||||
Public uEdge As Integer
|
||||
Public rc As RECT
|
||||
Public lParam As IntPtr
|
||||
End Structure
|
||||
Enum ABMsg
|
||||
ABM_NEW = 0
|
||||
ABM_REMOVE = 1
|
||||
ABM_QUERYPOS = 2
|
||||
ABM_SETPOS = 3
|
||||
ABM_GETSTATE = 4
|
||||
ABM_GETTASKBARPOS = 5
|
||||
ABM_ACTIVATE = 6
|
||||
ABM_GETAUTOHIDEBAR = 7
|
||||
ABM_SETAUTOHIDEBAR = 8
|
||||
ABM_WINDOWPOSCHANGED = 9
|
||||
ABM_SETSTATE = 10
|
||||
End Enum
|
||||
Enum ABEdge
|
||||
ABE_LEFT = 0
|
||||
ABE_TOP
|
||||
ABE_RIGHT
|
||||
ABE_BOTTOM
|
||||
End Enum
|
||||
Enum ABNotify
|
||||
ABN_STATECHANGE = 0
|
||||
ABN_POSCHANGED
|
||||
ABN_FULLSCREENAPP
|
||||
ABN_WINDOWARRANGE
|
||||
End Enum
|
||||
#End Region
|
||||
#Region "Sidebar DllImport"
|
||||
<DllImport("SHELL32", CallingConvention:=CallingConvention.StdCall)>
|
||||
Private Shared Function SHAppBarMessage(ByVal dwMessage As Integer, ByRef BarrData As AppDeskBar) As Integer
|
||||
End Function
|
||||
<DllImport("User32.dll", CharSet:=CharSet.Auto)>
|
||||
Public Shared Function RegisterWindowMessage(ByVal msg As String) As Integer
|
||||
End Function
|
||||
#End Region
|
||||
#Region "Sidebar Enum Properties Register"
|
||||
Private Shared Function MoveWindow(ByVal hWnd As IntPtr, ByVal x As Integer, ByVal y As Integer, ByVal cx As Integer, ByVal cy As Integer, ByVal repaint As Boolean) As Boolean
|
||||
|
||||
End Function
|
||||
Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
|
||||
If m.Msg = uCallBack Then
|
||||
Select Case m.WParam.ToInt32()
|
||||
Case CInt(ABNotify.ABN_POSCHANGED)
|
||||
ABSetPos(ABEdge.ABE_RIGHT)
|
||||
End Select
|
||||
End If
|
||||
MyBase.WndProc(m)
|
||||
End Sub 'WndProc
|
||||
Protected Overrides ReadOnly Property CreateParams() As System.Windows.Forms.CreateParams
|
||||
Get
|
||||
Dim cp As CreateParams = MyBase.CreateParams
|
||||
cp.Style = cp.Style And Not &HC00000 ' WS_CAPTION
|
||||
cp.Style = cp.Style And Not &H800000 ' WS_BORDER
|
||||
cp.ExStyle = &H80 Or &H8 ' WS_EX_TOOLWINDOW | WS_EX_TOPMOST
|
||||
Return cp
|
||||
End Get
|
||||
End Property
|
||||
Public Sub RegisterBar(ByVal dockEdge As ABEdge)
|
||||
Dim abd As New AppDeskBar()
|
||||
abd.cbSize = Marshal.SizeOf(abd)
|
||||
abd.hWnd = Me.Handle
|
||||
If Not fBarRegistered Then
|
||||
uCallBack = RegisterWindowMessage("AppBarMessage")
|
||||
abd.uCallbackMessage = uCallBack
|
||||
Dim ret As System.UInt32 = SHAppBarMessage(CInt(ABMsg.ABM_NEW), abd) 'ToDo: Unsigned Integers not supported
|
||||
fBarRegistered = True
|
||||
ABSetPos(ABEdge.ABE_RIGHT)
|
||||
Else
|
||||
SHAppBarMessage(CInt(ABMsg.ABM_REMOVE), abd)
|
||||
fBarRegistered = False
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub ABSetPos(ByVal dockEdge As ABEdge)
|
||||
Dim abd As New AppDeskBar()
|
||||
abd.cbSize = Marshal.SizeOf(abd)
|
||||
abd.hWnd = Me.Handle
|
||||
abd.uEdge = CInt(dockEdge)
|
||||
If abd.uEdge = CInt(ABEdge.ABE_LEFT) Or abd.uEdge = CInt(ABEdge.ABE_RIGHT) Then
|
||||
abd.rc.top = 0
|
||||
abd.rc.bottom = SystemInformation.PrimaryMonitorSize.Height
|
||||
If abd.uEdge = CInt(ABEdge.ABE_LEFT) Then
|
||||
abd.rc.left = 0
|
||||
abd.rc.right = Size.Width
|
||||
Else
|
||||
abd.rc.right = SystemInformation.PrimaryMonitorSize.Width
|
||||
abd.rc.left = abd.rc.right - Size.Width
|
||||
End If
|
||||
Else
|
||||
abd.rc.left = 0
|
||||
abd.rc.right = SystemInformation.PrimaryMonitorSize.Width
|
||||
If abd.uEdge = CInt(ABEdge.ABE_TOP) Then
|
||||
abd.rc.top = 0
|
||||
abd.rc.bottom = Size.Height
|
||||
Else
|
||||
abd.rc.bottom = SystemInformation.PrimaryMonitorSize.Height
|
||||
abd.rc.top = abd.rc.bottom - Size.Height
|
||||
End If
|
||||
End If
|
||||
' Query the system for an approved size and position.
|
||||
SHAppBarMessage(CInt(ABMsg.ABM_QUERYPOS), abd)
|
||||
' Adjust the rectangle, depending on the edge to which the
|
||||
' appbar is anchored.
|
||||
Select Case abd.uEdge
|
||||
Case CInt(ABEdge.ABE_LEFT)
|
||||
abd.rc.right = abd.rc.left + Size.Width
|
||||
Case CInt(ABEdge.ABE_RIGHT)
|
||||
abd.rc.left = abd.rc.right - Size.Width
|
||||
Case CInt(ABEdge.ABE_TOP)
|
||||
abd.rc.bottom = abd.rc.top + Size.Height
|
||||
Case CInt(ABEdge.ABE_BOTTOM)
|
||||
abd.rc.top = abd.rc.bottom - Size.Height
|
||||
End Select
|
||||
' Pass the final bounding rectangle to the system.
|
||||
SHAppBarMessage(CInt(ABMsg.ABM_SETPOS), abd)
|
||||
' Move and size the appbar so that it conforms to the
|
||||
' bounding rectangle passed to the system.
|
||||
|
||||
Me.Location = New Point(abd.rc.left, abd.rc.top)
|
||||
Dim PSBH = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height
|
||||
Dim TaskBarHeight = PSBH - System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height
|
||||
Me.Height = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height - TaskBarHeight
|
||||
|
||||
' MoveWindow(abd.hWnd, abd.rc.left, abd.rc.top, abd.rc.right - abd.rc.left, abd.rc.bottom - abd.rc.top, True)
|
||||
End Sub
|
||||
#End Region
|
||||
' Constants
|
||||
Private Const OPACITY_INITIAL = 0
|
||||
Private Const OPACITY_HIDDEN = 0.65
|
||||
@@ -72,6 +215,7 @@ Public Class frmFlowForm
|
||||
Init = New ClassInit(My.LogConfig, Me)
|
||||
AddHandler Init.Completed, AddressOf Init_Completed
|
||||
Init.InitializeApplication()
|
||||
'RegisterBar(ABEdge.ABE_RIGHT)
|
||||
End Sub
|
||||
|
||||
Private Sub Init_Completed(sender As Object, e As EventArgs)
|
||||
@@ -893,5 +1037,18 @@ Public Class frmFlowForm
|
||||
Private Sub SucheTestToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles SucheTestToolStripMenuItem.Click
|
||||
frmSearchNeu.Show()
|
||||
End Sub
|
||||
|
||||
Private Sub frmFlowForm_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
|
||||
'If fBarRegistered Then
|
||||
' fBarRegistered = False
|
||||
|
||||
' '----NEW
|
||||
' Dim abd As New AppDeskBar()
|
||||
' abd.cbSize = Marshal.SizeOf(abd)
|
||||
' abd.hWnd = Me.Handle
|
||||
|
||||
' ret = SHAppBarMessage(ABMsg.ABM_REMOVE, abd)
|
||||
'End If
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
|
||||
Reference in New Issue
Block a user