sokotanic
Messages postés
116
Date d'inscription
mercredi 22 novembre 2006
Statut
Membre
Dernière intervention
19 mai 2012
20 août 2008 à 00:48
enfin, je suis revenir apres avoir cassé ma tete et sans resultat je pense, il marche pas , mais je veux savoir ou est le probleme , je veux pas gerer les messages... je veux juste coller ma bouton dans la barre.
voici mon nouveau code
Private Declare Sub 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)
Private Declare Function SHAppBarMessage Lib "shell32.dll" (ByVal dwMessage As Long, pData As APPBARDATA) As Long
Private Declare Function SetRect Lib "user32" (lpRect As RECT, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Declare Function Rectangle Lib "gdi32" (ByVal hdc As Long, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Declare Function PtInRect Lib "user32" (lpRect As RECT, pt As POINTAPI) As Long
Private Type POINTAPI
x As Long
y As Long
End Type
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 ' message specific
End Type
Dim aplibardata As APPBARDATA
Dim ControlTop As Integer 'Used by function CalcComponentPos()
Dim ControlLeft 'Used by function CalcComponentPos()
Dim AppBarHeight, AppBarWidth As Integer 'The AppBar height and width depends on the Edge where the AppBar is docked
Dim WM_ABNOTIFY As Integer
Dim MousePos As POINTAPI
'Dim Desktop, LeftRect, RightRect, TopRect, BottomRect As Rectangle
Private Sub Command1_Click()
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''' enregistrement de notre barre
WM_ABNOTIFY = WM_USER + 100 'User defined Callback message
buton = Command1.hWnd 'hwnd button
aplibardata.cbSize = Len(aplibardata) 'sizeof de aplibardata
aplibardata.hWnd = buton 'hwnd de ma bouton
aplibardata.uCallbackMessage = WM_ABNOTIFY
haha = SHAppBarMessage(ABM_NEW, aplibardata) 'ABM_GETSTATE
aplibardata.uEdge = ABE_TOP
SetRect aplibardata.rc, 0, 0, Screen.Width, Screen.Height
SHAppBarMessage ABM_QUERYPOS, aplibardata
'Calculate final size
aplibardata.rc.Bottom = aplibardata.rc.Top + AppBarHeight
SHAppBarMessage ABM_SETPOS, aplibardata
SetWindowPos aplibardata.hWnd, 0, aplibardata.rc.Left, aplibardata.rc.Top, aplibardata.rc.Right - aplibardata.rc.Left, aplibardata.rc.Bottom - aplibardata.rc.Top, SWP_NOZORDER Or SWP_NOACTIVATE
''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''
GetCursorPos MousePos
Desktop = RECT(0, 0, Screen.Width, Screen.Height)
LeftRect = RECT(Desktop.Left, Desktop.Top, Desktop.Left + AppBarWidth, Desktop.Bottom)
TopRect = RECT(Desktop.Left, Desktop.Top, Desktop.Right, Desktop.Top + AppBarHeight)
BottomRect = RECT(Desktop.Left, Desktop.Bottom - AppBarHeight, Desktop.Right, Desktop.Bottom)
If (PtInRect(LeftRect, MousePos)) Then
aplibardata.rc = LeftRect
aplibardata.uEdge = ABE_LEFT
End If
If (PtInRect(RightRect, MousePos)) Then
aplibardata.rc = RightRect
aplibardata.uEdge = ABE_RIGHT
End If
If (PtInRect(TopRect, MousePos)) Then
aplibardata.rc = TopRect
aplibardata.uEdge = ABE_TOP
End If
If (PtInRect(BottomRect, MousePos)) Then
aplibardata.rc = BottomRect
aplibardata.uEdge = ABE_BOTTOM
End If
End Sub
Private Sub Form_Load()
SHAppBarMessage ABM_REMOVE, aplibardata
End Sub
et dans un header:
Public Const ABM_NEW = &H0
Public Const ABM_REMOVE = &H1
Public Const ABM_QUERYPOS = &H2
Public Const ABM_SETPOS = &H3
Public Const ABM_GETSTATE = &H4
Public Const ABM_GETTASKBARPOS = &H5
Public Const ABM_ACTIVATE = &H6
Public Const ABM_GETAUTOHIDEBAR = &H7
Public Const ABM_SETAUTOHIDEBAR = &H8
Public Const ABM_WINDOWPOSCHANGED = &H9
Public Const ABN_STATECHANGE = &H0
Public Const ABN_POSCHANGED = &H1
Public Const ABN_FULLSCREENAPP = &H2
Public Const ABN_WINDOWARRANGE = &H3
Public Const ABS_AUTOHIDE = &H1
Public Const ABS_ALWAYSONTOP = &H2
Public Const ABE_LEFT = 0
Public Const ABE_TOP = 1
Public Const ABE_RIGHT = 2
Public Const ABE_BOTTOM = 3
Public Const WM_USER = &H400
Public Const SWP_NOACTIVATE = &H10
Public Declare Function Rectangle Lib "gdi32" (ByVal hdc As Long, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
que dois je faire .?