Accueil > > > SAVOIR SI UNE FENETRE EST VISIBLE DANS LA BARRE DE TACHE ( .NET )
SAVOIR SI UNE FENETRE EST VISIBLE DANS LA BARRE DE TACHE ( .NET )
Information sur la source
Description
cette classe ( inachevée ) contient des routines pour tester si une fenetre est listée dans la taskbar ( et le alt-tab ) et pour recupérer l'icone associée a cette fenetre ( pour coder une fausse taskbar ! ) LA CLASSE EST INACHEVEE ( pas de try catch, code imparfait ) c'est un départ pour ceux qui ont comme moi lutté pour trouver les critères ( styles ) qui ne sont pas complètement ce que la msdn nous dit ! Afin de vous éviter de chercher pendant des heures une logique dans spy++ , je publie cette source, ne ralez pas si le code est crade, c'est à vous de mettre en forme, c'est une matière première !
Source
- #Region "Copyright"
- '************************************************************************
- '* Auteur * Proviste / Coq *
- '* Date Création * 07/12/04 *
- '* Derniere Modification * 25/12/04 *
- '************************************************************************
- '* * *
- '* Module * clsHwndInfos *
- '* * *
- '* Description * Operation et information sur les hwnd *
- '* * *
- '* * *
- '************************************************************************
- #End Region
-
- #Region "Imports"
- '-_-'
- Imports System.Runtime.InteropServices
- #End Region
-
- Public Class clsHwndInfo
- #Region " Declaration"
-
- #Region " Enum Window Style :o"
- Private Enum enWindowStyles
- WS_BORDER = &H800000
- WS_CAPTION = &HC00000
- WS_CHILD = &H40000000
- WS_CLIPCHILDREN = &H2000000
- WS_CLIPSIBLINGS = &H4000000
- WS_DISABLED = &H8000000
- WS_DLGFRAME = &H400000
- WS_EX_ACCEPTFILES = &H10&
- WS_EX_DLGMODALFRAME = &H1&
- WS_EX_NOPARENTNOTIFY = &H4&
- WS_EX_TOPMOST = &H8&
- WS_EX_TRANSPARENT = &H20&
- WS_EX_TOOLWINDOW = &H80&
- WS_GROUP = &H20000
- WS_HSCROLL = &H100000
- WS_MAXIMIZE = &H1000000
- WS_MAXIMIZEBOX = &H10000
- WS_MINIMIZE = &H20000000
- WS_MINIMIZEBOX = &H20000
- WS_OVERLAPPED = &H0&
- WS_POPUP = &H80000000
- WS_SYSMENU = &H80000
- WS_TABSTOP = &H10000
- WS_THICKFRAME = &H40000
- WS_VISIBLE = &H10000000
- WS_VSCROLL = &H200000
- '\\ New from 95/NT4 onwards
- WS_EX_MDICHILD = &H40
- WS_EX_WINDOWEDGE = &H100
- WS_EX_CLIENTEDGE = &H200
- WS_EX_CONTEXTHELP = &H400
- WS_EX_RIGHT = &H1000
- WS_EX_LEFT = &H0
- WS_EX_RTLREADING = &H2000
- WS_EX_LTRREADING = &H0
- WS_EX_LEFTSCROLLBAR = &H4000
- WS_EX_RIGHTSCROLLBAR = &H0
- WS_EX_CONTROLPARENT = &H10000
- WS_EX_STATICEDGE = &H20000
- WS_EX_APPWINDOW = &H40000
- WS_EX_OVERLAPPEDWINDOW = (WS_EX_WINDOWEDGE Or WS_EX_CLIENTEDGE)
- WS_EX_PALETTEWINDOW = (WS_EX_WINDOWEDGE Or _
- WS_EX_TOOLWINDOW Or WS_EX_TOPMOST)
- End Enum
- #End Region
-
- #Region " GetWindowLong Diverses Declaration"
-
- <DllImport("user32.dll", CharSet:=CharSet.Ansi, EntryPoint:="GetWindowLong")> _
- Private Shared Function GetWindowLong32(ByVal hWnd As IntPtr, ByVal nIndex As Integer) As Integer
- End Function
-
- <DllImport("user32.dll", CharSet:=CharSet.Ansi, EntryPoint:="GetWindowLong")> _
- Private Shared Function GetWindowLongPtr(ByVal hWnd As IntPtr, ByVal nIndex As Integer) As IntPtr
- End Function
-
- <DllImport("user32.dll", CharSet:=CharSet.Ansi, EntryPoint:="GetWindowLong")> _
- Private Shared Function GetWindowLong64(ByVal hWnd As IntPtr, ByVal nIndex As Integer) As Long
- End Function
-
- #End Region
-
- #Region " GetClassLong Diverses Declaration"
-
- <DllImport("user32.dll", CharSet:=CharSet.Ansi, EntryPoint:="GetClassLong", SetLastError:=True)> _
- Private Shared Function GetClassLong32(ByVal hWnd As IntPtr, ByVal nIndex As Integer) As Integer
- End Function
-
- <DllImport("user32.dll", CharSet:=CharSet.Ansi, EntryPoint:="GetClassLong", SetLastError:=True)> _
- Private Shared Function GetClassLongPtr(ByVal hWnd As IntPtr, ByVal nIndex As Integer) As IntPtr
- End Function
-
- <DllImport("user32.dll", CharSet:=CharSet.Ansi, EntryPoint:="GetClassLong", SetLastError:=True)> _
- Private Shared Function GetClassLong64(ByVal hWnd As IntPtr, ByVal nIndex As Integer) As Long
- End Function
-
- #End Region
-
-
- <DllImport("user32.dll", CharSet:=CharSet.Ansi, EntryPoint:="SendMessage")> _
- Private Shared Function SendMessagePtr(ByVal hwnd As IntPtr, _
- ByVal wMsg As Int32, _
- ByVal wParam As Integer, _
- ByVal lParam As Integer) As IntPtr
- End Function
-
- '-sendmessage
- Private Declare Function SendMessage _
- Lib "user32" _
- Alias "SendMessageA" _
- (ByVal hwnd As IntPtr, _
- ByVal wMsg As Int32, _
- ByVal wParam As Integer, _
- ByVal lParam As System.Text.StringBuilder) As Integer
-
- Private Declare Function SendMessage _
- Lib "user32" _
- Alias "SendMessageA" _
- (ByVal hwnd As IntPtr, _
- ByVal wMsg As Int32, _
- ByVal wParam As Integer, _
- ByVal lParam As Integer) As Integer
-
- Private Const WM_SETTEXT = &HC
- Private Const WM_GETTEXT = &HD
- Private Const WM_GETTEXTLENGTH = &HE
- Private Const WM_SETICON = &H80
- Private Const WM_GETICON = &H7F
- Private Const ICON_SMALL = 0
- Private Const ICON_BIG = 1
- Private Const Icon_BIG_XP = 2
-
- Private Enum enGetWindowLong
- GWL_EXSTYLE = (-20)
- GWL_HINSTANCE = (-6)
- GWL_HWNDPARENT = (-8)
- GWL_ID = (-12)
- GWL_STYLE = (-16)
- GWL_USERDATA = (-21)
- GWL_WNDPROC = (-4)
- End Enum
-
- Private Enum enGetWindowLongPtr
- GCLP_MENUNAME = (-8)
- GCLP_HBRBACKGROUND = (-10)
- GCLP_HCURSOR = (-12)
- GCLP_HICON = (-14)
- GCLP_HMODULE = (-16)
- GCLP_WNDPROC = (-24)
- GCLP_HICONSM = (-34)
- End Enum
-
- Private Const GCL_CBCLSEXTRA = -20
- Private Const GCL_CBWNDEXTRA = -18
- Private Const GCL_HCURSOR = -12
- Private Const GCL_HICON = -14
- Private Const GCL_HMODULE = -16
- Private Const GCL_MENUNAME = -8
- Private Const GCL_STYLE = -26
- Private Const GCL_WNDPROC = -24
- Private Const GCL_HICONSM = -34
-
- Private myHwndPtr As IntPtr
-
- #End Region
-
- #Region " Procédures"
- #Region " Publiques"
-
- ''' -----------------------------------------------------------------------------
- ''' <summary>
- ''' Crée une nouvelle instance de la classe.
- ''' </summary>
- ''' <param name="hwndptr">Hwndptr qui sera traité</param>
- ''' <remarks>
- ''' </remarks>
- ''' <history>
- ''' Proviste 28/12/2004 Created
- ''' </history>
- ''' -----------------------------------------------------------------------------
- Public Sub New(ByVal hwndptr As IntPtr)
- NewInst(hwndptr)
- End Sub
-
- ''' -----------------------------------------------------------------------------
- ''' <summary>
- ''' Crée une nouvelle instance de la classe
- ''' </summary>
- ''' <param name="hwnd"></param>
- ''' <remarks>
- ''' </remarks>
- ''' <history>
- ''' Proviste 28/12/2004 Created
- ''' </history>
- ''' -----------------------------------------------------------------------------
- Public Sub New(ByVal hwnd As Long)
- NewInst(New IntPtr(hwnd))
- End Sub
-
-
- #End Region
-
- #Region " Privées"
-
-
-
- Private Sub NewInst(ByVal hwndptr As IntPtr)
- myHwndPtr = hwndptr
- End Sub
-
- #End Region
-
- #End Region
-
- #Region " Property"
- ''' -----------------------------------------------------------------------------
- ''' <summary>
- ''' Cette propriété renvoie ou définie le texte associé à un hwnd.
- ''' </summary>
- ''' <value>Valeur de type string</value>
- ''' <remarks>
- ''' </remarks>
- ''' <history>
- ''' Proviste 28/12/2004 Created
- ''' </history>
- ''' -----------------------------------------------------------------------------
- Public Property WindowText() As String
- Get
- Dim wdsTxtBuilt As System.Text.StringBuilder
- Dim wdsTxtLength As Integer
-
- wdsTxtLength = SendMessage(myHwndPtr, WM_GETTEXTLENGTH, 0, 0) + 1
-
- wdsTxtBuilt = New System.text.StringBuilder(Chr(0), wdsTxtLength)
-
- SendMessage(myHwndPtr, WM_GETTEXT, wdsTxtLength, wdsTxtBuilt)
-
- Return wdsTxtBuilt.ToString
- End Get
- Set(ByVal Value As String)
- SendMessage(myHwndPtr, WM_SETTEXT, Value.Length, New System.Text.StringBuilder(Value))
- End Set
-
- End Property
-
- ''' -----------------------------------------------------------------------------
- ''' <summary>
- ''' Retourne une valeur booléene pour savoir si l'objet associée au hwnd ( à priori une feuille ) est affichée dans la barre des tâche.
- ''' </summary>
- ''' <value>True : la form associée au hwnd passé en paramètre est affichée dans la barre des tâches</value>
- ''' <remarks>
- ''' </remarks>
- ''' <history>
- ''' Proviste 01/12/2005 Created
- ''' </history>
- ''' -----------------------------------------------------------------------------
- Public ReadOnly Property ShownInTaskBar() As Boolean
- Get
-
- If myHwndPtr.Size = 8 Then 'win64
- Dim wStyles As Long
- wStyles = GetWindowLong64(myHwndPtr, enGetWindowLong.GWL_STYLE)
- If (wStyles And enWindowStyles.WS_VISIBLE) = enWindowStyles.WS_VISIBLE Then
- Dim wStylesEx As Long
- wStylesEx = GetWindowLong32(myHwndPtr, enGetWindowLong.GWL_EXSTYLE)
- If (wStylesEx And enWindowStyles.WS_EX_TOOLWINDOW) = enWindowStyles.WS_EX_TOOLWINDOW Then
- Return False
- Else
- Return ((wStyles And enWindowStyles.WS_EX_APPWINDOW) = enWindowStyles.WS_EX_APPWINDOW) OrElse _
- ((wStyles And enWindowStyles.WS_POPUP) = enWindowStyles.WS_POPUP)
- End If
- Else
- Return False
- End If
- Else
- Dim wStyles As Integer
- wStyles = GetWindowLong32(myHwndPtr, enGetWindowLong.GWL_STYLE)
- If (wStyles And enWindowStyles.WS_VISIBLE) = enWindowStyles.WS_VISIBLE Then
- Dim wStylesEx As Integer
- wStylesEx = GetWindowLong32(myHwndPtr, enGetWindowLong.GWL_EXSTYLE)
- If (wStylesEx And enWindowStyles.WS_EX_TOOLWINDOW) = enWindowStyles.WS_EX_TOOLWINDOW Then
- Return False
- Else
- Return ((wStyles And enWindowStyles.WS_EX_APPWINDOW) = enWindowStyles.WS_EX_APPWINDOW) OrElse _
- ((wStyles And enWindowStyles.WS_POPUP) = enWindowStyles.WS_POPUP)
- End If
- Else
- Return False
- End If
- End If
- End Get
- End Property
-
- ''' -----------------------------------------------------------------------------
- ''' <summary>
- ''' Retourne une valeur booléene pour savoir si l'objet associé au hwnd est visible ( indépendement du fait qu'il soit caché ou non )
- ''' </summary>
- ''' <value>Renvoie True si l'objet est visible</value>
- ''' <remarks>
- ''' </remarks>
- ''' <history>
- ''' Proviste 01/12/2005 Created
- ''' </history>
- ''' -----------------------------------------------------------------------------
- Public ReadOnly Property Visible() As Boolean
- Get
- If myHwndPtr.Size = 8 Then 'win64
- Return ((GetWindowLong64(myHwndPtr, enGetWindowLong.GWL_EXSTYLE) And enWindowStyles.WS_VISIBLE) = enWindowStyles.WS_VISIBLE)
- Else
- Return ((GetWindowLong32(myHwndPtr, enGetWindowLong.GWL_EXSTYLE) And enWindowStyles.WS_VISIBLE) = enWindowStyles.WS_VISIBLE)
- End If
- End Get
- End Property
-
- ''' -----------------------------------------------------------------------------
- ''' <summary>
- ''' Renvoie ou définie le handle de l'icone associé à la fenetre
- ''' </summary>
- ''' <value></value>
- ''' <remarks>
- ''' </remarks>
- ''' <history>
- ''' Proviste 01/12/2005 Created
- ''' </history>
- ''' -----------------------------------------------------------------------------
- Public ReadOnly Property hIcon() As IntPtr
- Get
- Dim hIcn As IntPtr
-
- hIcn = SendMessagePtr(myHwndPtr, WM_GETICON, ICON_BIG, 0)
- If hIcn.ToString = "0" Then
- Return GetClassLongPtr(myHwndPtr, GCL_HICON)
- Else
- Return hIcn
- End If
-
- End Get
- ' Set(ByVal Value As IntPtr)
- ' 'MsgBox(SetClassLong(myHwndPtr, GCL_HICON, Value))
- ' End Set
- End Property
-
- ''' -----------------------------------------------------------------------------
- ''' <summary>
- ''' Renvoie ou définie le handle de l'icone 16*16 associé à la fenetre
- ''' </summary>
- ''' <value></value>
- ''' <remarks>
- ''' </remarks>
- ''' <history>
- ''' Proviste 01/12/2005 Created
- ''' </history>
- ''' -----------------------------------------------------------------------------
- Public ReadOnly Property hIconSmall() As IntPtr
- Get
- Dim hIcn As IntPtr
-
- hIcn = SendMessagePtr(myHwndPtr, WM_GETICON, ICON_SMALL, 0)
- If hIcn.Equals(IntPtr.Zero) Then
- Return GetClassLongPtr(myHwndPtr, GCL_HICONSM)
- Else
- Return hIcn
- End If
-
- End Get
- ' Set(ByVal Value As IntPtr)
- '
- ' End Set
- End Property
- #End Region
- End Class
#Region "Copyright"
'************************************************************************
'* Auteur * Proviste / Coq *
'* Date Création * 07/12/04 *
'* Derniere Modification * 25/12/04 *
'************************************************************************
'* * *
'* Module * clsHwndInfos *
'* * *
'* Description * Operation et information sur les hwnd *
'* * *
'* * *
'************************************************************************
#End Region
#Region "Imports"
'-_-'
Imports System.Runtime.InteropServices
#End Region
Public Class clsHwndInfo
#Region " Declaration"
#Region " Enum Window Style :o"
Private Enum enWindowStyles
WS_BORDER = &H800000
WS_CAPTION = &HC00000
WS_CHILD = &H40000000
WS_CLIPCHILDREN = &H2000000
WS_CLIPSIBLINGS = &H4000000
WS_DISABLED = &H8000000
WS_DLGFRAME = &H400000
WS_EX_ACCEPTFILES = &H10&
WS_EX_DLGMODALFRAME = &H1&
WS_EX_NOPARENTNOTIFY = &H4&
WS_EX_TOPMOST = &H8&
WS_EX_TRANSPARENT = &H20&
WS_EX_TOOLWINDOW = &H80&
WS_GROUP = &H20000
WS_HSCROLL = &H100000
WS_MAXIMIZE = &H1000000
WS_MAXIMIZEBOX = &H10000
WS_MINIMIZE = &H20000000
WS_MINIMIZEBOX = &H20000
WS_OVERLAPPED = &H0&
WS_POPUP = &H80000000
WS_SYSMENU = &H80000
WS_TABSTOP = &H10000
WS_THICKFRAME = &H40000
WS_VISIBLE = &H10000000
WS_VSCROLL = &H200000
'\\ New from 95/NT4 onwards
WS_EX_MDICHILD = &H40
WS_EX_WINDOWEDGE = &H100
WS_EX_CLIENTEDGE = &H200
WS_EX_CONTEXTHELP = &H400
WS_EX_RIGHT = &H1000
WS_EX_LEFT = &H0
WS_EX_RTLREADING = &H2000
WS_EX_LTRREADING = &H0
WS_EX_LEFTSCROLLBAR = &H4000
WS_EX_RIGHTSCROLLBAR = &H0
WS_EX_CONTROLPARENT = &H10000
WS_EX_STATICEDGE = &H20000
WS_EX_APPWINDOW = &H40000
WS_EX_OVERLAPPEDWINDOW = (WS_EX_WINDOWEDGE Or WS_EX_CLIENTEDGE)
WS_EX_PALETTEWINDOW = (WS_EX_WINDOWEDGE Or _
WS_EX_TOOLWINDOW Or WS_EX_TOPMOST)
End Enum
#End Region
#Region " GetWindowLong Diverses Declaration"
<DllImport("user32.dll", CharSet:=CharSet.Ansi, EntryPoint:="GetWindowLong")> _
Private Shared Function GetWindowLong32(ByVal hWnd As IntPtr, ByVal nIndex As Integer) As Integer
End Function
<DllImport("user32.dll", CharSet:=CharSet.Ansi, EntryPoint:="GetWindowLong")> _
Private Shared Function GetWindowLongPtr(ByVal hWnd As IntPtr, ByVal nIndex As Integer) As IntPtr
End Function
<DllImport("user32.dll", CharSet:=CharSet.Ansi, EntryPoint:="GetWindowLong")> _
Private Shared Function GetWindowLong64(ByVal hWnd As IntPtr, ByVal nIndex As Integer) As Long
End Function
#End Region
#Region " GetClassLong Diverses Declaration"
<DllImport("user32.dll", CharSet:=CharSet.Ansi, EntryPoint:="GetClassLong", SetLastError:=True)> _
Private Shared Function GetClassLong32(ByVal hWnd As IntPtr, ByVal nIndex As Integer) As Integer
End Function
<DllImport("user32.dll", CharSet:=CharSet.Ansi, EntryPoint:="GetClassLong", SetLastError:=True)> _
Private Shared Function GetClassLongPtr(ByVal hWnd As IntPtr, ByVal nIndex As Integer) As IntPtr
End Function
<DllImport("user32.dll", CharSet:=CharSet.Ansi, EntryPoint:="GetClassLong", SetLastError:=True)> _
Private Shared Function GetClassLong64(ByVal hWnd As IntPtr, ByVal nIndex As Integer) As Long
End Function
#End Region
<DllImport("user32.dll", CharSet:=CharSet.Ansi, EntryPoint:="SendMessage")> _
Private Shared Function SendMessagePtr(ByVal hwnd As IntPtr, _
ByVal wMsg As Int32, _
ByVal wParam As Integer, _
ByVal lParam As Integer) As IntPtr
End Function
'-sendmessage
Private Declare Function SendMessage _
Lib "user32" _
Alias "SendMessageA" _
(ByVal hwnd As IntPtr, _
ByVal wMsg As Int32, _
ByVal wParam As Integer, _
ByVal lParam As System.Text.StringBuilder) As Integer
Private Declare Function SendMessage _
Lib "user32" _
Alias "SendMessageA" _
(ByVal hwnd As IntPtr, _
ByVal wMsg As Int32, _
ByVal wParam As Integer, _
ByVal lParam As Integer) As Integer
Private Const WM_SETTEXT = &HC
Private Const WM_GETTEXT = &HD
Private Const WM_GETTEXTLENGTH = &HE
Private Const WM_SETICON = &H80
Private Const WM_GETICON = &H7F
Private Const ICON_SMALL = 0
Private Const ICON_BIG = 1
Private Const Icon_BIG_XP = 2
Private Enum enGetWindowLong
GWL_EXSTYLE = (-20)
GWL_HINSTANCE = (-6)
GWL_HWNDPARENT = (-8)
GWL_ID = (-12)
GWL_STYLE = (-16)
GWL_USERDATA = (-21)
GWL_WNDPROC = (-4)
End Enum
Private Enum enGetWindowLongPtr
GCLP_MENUNAME = (-8)
GCLP_HBRBACKGROUND = (-10)
GCLP_HCURSOR = (-12)
GCLP_HICON = (-14)
GCLP_HMODULE = (-16)
GCLP_WNDPROC = (-24)
GCLP_HICONSM = (-34)
End Enum
Private Const GCL_CBCLSEXTRA = -20
Private Const GCL_CBWNDEXTRA = -18
Private Const GCL_HCURSOR = -12
Private Const GCL_HICON = -14
Private Const GCL_HMODULE = -16
Private Const GCL_MENUNAME = -8
Private Const GCL_STYLE = -26
Private Const GCL_WNDPROC = -24
Private Const GCL_HICONSM = -34
Private myHwndPtr As IntPtr
#End Region
#Region " Procédures"
#Region " Publiques"
''' -----------------------------------------------------------------------------
''' <summary>
''' Crée une nouvelle instance de la classe.
''' </summary>
''' <param name="hwndptr">Hwndptr qui sera traité</param>
''' <remarks>
''' </remarks>
''' <history>
''' Proviste 28/12/2004 Created
''' </history>
''' -----------------------------------------------------------------------------
Public Sub New(ByVal hwndptr As IntPtr)
NewInst(hwndptr)
End Sub
''' -----------------------------------------------------------------------------
''' <summary>
''' Crée une nouvelle instance de la classe
''' </summary>
''' <param name="hwnd"></param>
''' <remarks>
''' </remarks>
''' <history>
''' Proviste 28/12/2004 Created
''' </history>
''' -----------------------------------------------------------------------------
Public Sub New(ByVal hwnd As Long)
NewInst(New IntPtr(hwnd))
End Sub
#End Region
#Region " Privées"
Private Sub NewInst(ByVal hwndptr As IntPtr)
myHwndPtr = hwndptr
End Sub
#End Region
#End Region
#Region " Property"
''' -----------------------------------------------------------------------------
''' <summary>
''' Cette propriété renvoie ou définie le texte associé à un hwnd.
''' </summary>
''' <value>Valeur de type string</value>
''' <remarks>
''' </remarks>
''' <history>
''' Proviste 28/12/2004 Created
''' </history>
''' -----------------------------------------------------------------------------
Public Property WindowText() As String
Get
Dim wdsTxtBuilt As System.Text.StringBuilder
Dim wdsTxtLength As Integer
wdsTxtLength = SendMessage(myHwndPtr, WM_GETTEXTLENGTH, 0, 0) + 1
wdsTxtBuilt = New System.text.StringBuilder(Chr(0), wdsTxtLength)
SendMessage(myHwndPtr, WM_GETTEXT, wdsTxtLength, wdsTxtBuilt)
Return wdsTxtBuilt.ToString
End Get
Set(ByVal Value As String)
SendMessage(myHwndPtr, WM_SETTEXT, Value.Length, New System.Text.StringBuilder(Value))
End Set
End Property
''' -----------------------------------------------------------------------------
''' <summary>
''' Retourne une valeur booléene pour savoir si l'objet associée au hwnd ( à priori une feuille ) est affichée dans la barre des tâche.
''' </summary>
''' <value>True : la form associée au hwnd passé en paramètre est affichée dans la barre des tâches</value>
''' <remarks>
''' </remarks>
''' <history>
''' Proviste 01/12/2005 Created
''' </history>
''' -----------------------------------------------------------------------------
Public ReadOnly Property ShownInTaskBar() As Boolean
Get
If myHwndPtr.Size = 8 Then 'win64
Dim wStyles As Long
wStyles = GetWindowLong64(myHwndPtr, enGetWindowLong.GWL_STYLE)
If (wStyles And enWindowStyles.WS_VISIBLE) = enWindowStyles.WS_VISIBLE Then
Dim wStylesEx As Long
wStylesEx = GetWindowLong32(myHwndPtr, enGetWindowLong.GWL_EXSTYLE)
If (wStylesEx And enWindowStyles.WS_EX_TOOLWINDOW) = enWindowStyles.WS_EX_TOOLWINDOW Then
Return False
Else
Return ((wStyles And enWindowStyles.WS_EX_APPWINDOW) = enWindowStyles.WS_EX_APPWINDOW) OrElse _
((wStyles And enWindowStyles.WS_POPUP) = enWindowStyles.WS_POPUP)
End If
Else
Return False
End If
Else
Dim wStyles As Integer
wStyles = GetWindowLong32(myHwndPtr, enGetWindowLong.GWL_STYLE)
If (wStyles And enWindowStyles.WS_VISIBLE) = enWindowStyles.WS_VISIBLE Then
Dim wStylesEx As Integer
wStylesEx = GetWindowLong32(myHwndPtr, enGetWindowLong.GWL_EXSTYLE)
If (wStylesEx And enWindowStyles.WS_EX_TOOLWINDOW) = enWindowStyles.WS_EX_TOOLWINDOW Then
Return False
Else
Return ((wStyles And enWindowStyles.WS_EX_APPWINDOW) = enWindowStyles.WS_EX_APPWINDOW) OrElse _
((wStyles And enWindowStyles.WS_POPUP) = enWindowStyles.WS_POPUP)
End If
Else
Return False
End If
End If
End Get
End Property
''' -----------------------------------------------------------------------------
''' <summary>
''' Retourne une valeur booléene pour savoir si l'objet associé au hwnd est visible ( indépendement du fait qu'il soit caché ou non )
''' </summary>
''' <value>Renvoie True si l'objet est visible</value>
''' <remarks>
''' </remarks>
''' <history>
''' Proviste 01/12/2005 Created
''' </history>
''' -----------------------------------------------------------------------------
Public ReadOnly Property Visible() As Boolean
Get
If myHwndPtr.Size = 8 Then 'win64
Return ((GetWindowLong64(myHwndPtr, enGetWindowLong.GWL_EXSTYLE) And enWindowStyles.WS_VISIBLE) = enWindowStyles.WS_VISIBLE)
Else
Return ((GetWindowLong32(myHwndPtr, enGetWindowLong.GWL_EXSTYLE) And enWindowStyles.WS_VISIBLE) = enWindowStyles.WS_VISIBLE)
End If
End Get
End Property
''' -----------------------------------------------------------------------------
''' <summary>
''' Renvoie ou définie le handle de l'icone associé à la fenetre
''' </summary>
''' <value></value>
''' <remarks>
''' </remarks>
''' <history>
''' Proviste 01/12/2005 Created
''' </history>
''' -----------------------------------------------------------------------------
Public ReadOnly Property hIcon() As IntPtr
Get
Dim hIcn As IntPtr
hIcn = SendMessagePtr(myHwndPtr, WM_GETICON, ICON_BIG, 0)
If hIcn.ToString = "0" Then
Return GetClassLongPtr(myHwndPtr, GCL_HICON)
Else
Return hIcn
End If
End Get
' Set(ByVal Value As IntPtr)
' 'MsgBox(SetClassLong(myHwndPtr, GCL_HICON, Value))
' End Set
End Property
''' -----------------------------------------------------------------------------
''' <summary>
''' Renvoie ou définie le handle de l'icone 16*16 associé à la fenetre
''' </summary>
''' <value></value>
''' <remarks>
''' </remarks>
''' <history>
''' Proviste 01/12/2005 Created
''' </history>
''' -----------------------------------------------------------------------------
Public ReadOnly Property hIconSmall() As IntPtr
Get
Dim hIcn As IntPtr
hIcn = SendMessagePtr(myHwndPtr, WM_GETICON, ICON_SMALL, 0)
If hIcn.Equals(IntPtr.Zero) Then
Return GetClassLongPtr(myHwndPtr, GCL_HICONSM)
Else
Return hIcn
End If
End Get
' Set(ByVal Value As IntPtr)
'
' End Set
End Property
#End Region
End Class
Conclusion
Merci au vieux coq pour son aide :D
Historique
- 04 novembre 2005 11:35:54 :
- j'ai corrigé deux fautes d'orthographe.
Sources du même auteur
Sources de la même categorie
Commentaires et avis
Discussions en rapport avec ce code source dans le forum
[?]!!!!! Help !!!!!!!! j'ai besoin de masquer la barre de tache de windobe [ par OverDarck ]
S'il quelqun pouvais me donner un code qui permet de masquer la barre de teche se serait cool pour m'aider a finir un prog !!!za511@aol.com
Le haut de la position de la barre de tache [ par MEGATRIX ]
Comment connaitre le haut de la position de la barre de tache ?
Docker une feuille dans la taskbar, comme la barre Quicklaunch [ par Bouh ]
Hello,Tout d'abord, je profite de ce premier post pour remercier tous ceux qui font ce site ou qui y participent, car il m'a beaucoup servi durant mon
empêcher l'accès à la barre des tâches et à Task Manager sous NT 4 [ par noisy ]
JE développe mon application sous Win NT 4J'aimerais emêcher l'accès à la barre des tâches ainsi qu' à Task Manager (je ne peux pas utiliser la source
Prob: form depassant sur barre de tache... [ par wico2002 ]
Question: je me fais un jeux et le form du plateau de jeux embarque par dessus la barre ds tache. mais moi je ne veux pas... comment faire pour quelle
comment simuler la barre de tache windows ? [ par martinkk ]
j'ai remplacé dans le fichier system.ini dans la section [boot], shell=explorer.exe par shell=monprog.exe (mon programme).le problème est que la barre
Réduire un formulaire en VBA [ par daffy21 ]
Sur un Prog Excel en macro, je voudrais pouvoir réduire l'application dans la barre de tache, mais comme un formulaire est affiché, la fonction ne fon
Barre des tache de windows [ par Robinwood01 ]
Comment fait ton pour savoir si la barre du menu demarré de windows est en haut ou en bas avec Visual Basic ?Car j'ai une fenetre que j'aimerais place
Détecté si la barre de tache est caché ou visible [ par cosmic ]
BonjoursJ'ai besoin de votre aide.Je voudrais savoir s'il éxiste un moyen de détecté si la barre de tache est visible ou caché.Et non pas un code qui
fenetre en arrière plan comme la barre de tache ?? [ par PBDLpc ]
bonjour, je voudrais faire une barre du style barre mac, mais je sais pas commetn faire que les fenetres de windows ne viennent pas dessus ni en deess
|
Derniers Blogs
COMMENT MAPPER UNE VUE SQL SUR UNE COLLECTION DE COMPLEX TYPE?COMMENT MAPPER UNE VUE SQL SUR UNE COLLECTION DE COMPLEX TYPE? par Matthieu MEZIL
Avec EF, les vues doivent être mappées sur des entity types. Le problème c'est que les entity types doivent avoir une clé. Avec EF, nous avons les complex type qui n'ont pas de clé mais les vues ne peuvent pas être mappées dessus. Avec EF4, il est possibl...
Cliquez pour lire la suite de l'article par Matthieu MEZIL [WF4] UN BINDING ACTIVITY/ACTIVITYDESIGNER QUI PASSE MAL?[WF4] UN BINDING ACTIVITY/ACTIVITYDESIGNER QUI PASSE MAL? par JeremyJeanson
Certain d'entre vous on peut être vécu cette situation embarrassante après quelques temps passer avec WF4 : Au début avec mon " ActivityDesigner" , tout allait bien. Et puis un jour j'ai au des problèmes de " Binding" . Alors nous sommes allé sur le site ...
Cliquez pour lire la suite de l'article par JeremyJeanson MYTIC - SHAREPOINT 2010 : DéJà UN MYTHE MICROSOFT ?MYTIC - SHAREPOINT 2010 : DéJà UN MYTHE MICROSOFT ? par junarnoalg
La prochaine session de MyTIC aura lieu à Namur, le 23 mars prochain. Pendant presque une heure, nous parlerons de SharePoint 2010. Voici un aperçu du programme.
Accueil : 17h30 Début de la session : 18h00 - Les nouvelles int...
Cliquez pour lire la suite de l'article par junarnoalg
Logiciels
Academy System (10.9.4.0)ACADEMY SYSTEM (10.9.4.0)Logiciel de gestion des établissements.
- élèves/étudiants (inscription, dossier, absence...)
-... Cliquez pour télécharger Academy System Xilisoft Convertisseur Vidéo Ultimate (5.1.39.0305)XILISOFT CONVERTISSEUR VIDéO ULTIMATE (5.1.39.0305)Xilisoft Convertisseur Vidéo Ultimate est un outil puissant de conversion vidéo, facile à utilise... Cliquez pour télécharger Xilisoft Convertisseur Vidéo Ultimate Xilisoft DVD Ripper Ultimate (5.0.64.0304)XILISOFT DVD RIPPER ULTIMATE (5.0.64.0304)Xilisoft DVD Ripper Ultimate est un logiciel excellent pour copier et convertir DVD vers presque ... Cliquez pour télécharger Xilisoft DVD Ripper Ultimate Rigs of Rods (63.3)RIGS OF RODS (63.3)c'est un jeu de multi-simulation camions,autobus voitures, avions, bateaux, hélicoptère avec défo... Cliquez pour télécharger Rigs of Rods
|