#If VBA7 Then
#If Win64 Then 'vba7 et 64 bits
Private Declare PtrSafe Function FindWindowA Lib "user32" (ByVal lpClassName As String, ByVal lpWindowName As String) As LongPtr
Private...
Bonjour lionel,Bonjour à toutes et à tous,
@ akni : tu nous copie ton code ?
lionel,
Private Declare PtrSafe Function FindWindowA Lib "User32" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare PtrSafe Function GetWindowLongA Lib "User32" _
(ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare PtrSafe Function SetWindowLongA Lib "User32" _
(ByVal hWnd As Long, ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long
Private Sub UserForm_Activate()
Dim hWnd As Long, exLong As Long
hWnd = FindWindowA(vbNullString, Me.Caption)
exLong = GetWindowLongA(hWnd, -16)
If exLong And &H880000 Then
SetWindowLongA hWnd, -16, exLong And &HFF77FFFF
Me.Hide: Me.Show
End If
End Sub
Private Sub CommandButton1_Click()
Unload Me
End Sub
Bonjour Tout le monde,
j'ai un code qui supprime la barre de titre des userform mais il ne marche pas dans la version 64bits
Merci pour toute aide.
Merci tout le mondeBonjour Tout le monde,
j'ai un code qui supprime la barre de titre des userform mais il ne marche pas dans la version 64bits
Merci pour toute aide.
'**********************************************************************************************
' supprimer le cadre et la barre de titre du Userform
'auteur :patricktoulon
'**********************************************************************************************
'EXEMPLE
Private Sub CommandButton1_Click()
Unload Me
End Sub
Private Sub UserForm_Activate()
Dim hwnd&,H&
H = Me.InsideHeight
hwnd = ExecuteExcel4Macro("CALL(""user32"",""GetActiveWindow"",""JCC"")") 'api GetActiveWindow
ExecuteExcel4Macro ("CALL(""user32"",""SetWindowLongA"",""JJJJJ""," & hwnd & ", " & -16 & ", " & &H94080080 & ")") 'api SetWindowLongA
ExecuteExcel4Macro ("CALL(""user32"",""DrawMenuBar"",""JJJJJJ"", " & hwnd & ")")
Me.Height = H + 4
End Sub
Bonjour PatrickSalut
déjà ça m’étonnerait que tes déclarations même avec ptrsafe fonctionne correctement sur 64bits
Private Declare PtrSafe Function FindWindowA Lib "User32" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As LongPtr
Private Declare PtrSafe Function GetWindowLongA Lib "User32" _
(ByVal hWnd As LongPtr, ByVal nIndex As Long) As LongPtr
Private Declare PtrSafe Function SetWindowLongA Lib "User32" _
(ByVal hWnd As LongPtr, ByVal nIndex As Long, _
ByVal dwNewLong As Long) As LongPtr
#If VBA7 Then
#If Win64 Then
Private Declare PtrSafe Function GetWindowLong Lib "User32" Alias "GetWindowLongA" (ByVal hWnd As LongPtr, ByVal nIndex As Long) As LongPtr
Private Declare PtrSafe Function SetWindowLong Lib "User32" Alias "SetWindowLongA" (ByVal hWnd As LongPtr, ByVal nIndex As Long, ByVal dwNewLong As LongPtr) As LongPtr
Private Declare PtrSafe Function FindWindow Lib "User32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare PtrSafe Function DrawMenuBar Lib "User32" (ByVal hWnd As LongPtr) As Long
Const ver As String = "version 64 en VB7"
#Else
Const ver As String = "version 32 en VB7"
Private Declare PtrSafe Function GetWindowLong Lib "User32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare PtrSafe Function SetWindowLong Lib "User32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare PtrSafe Function FindWindow Lib "User32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare PtrSafe Function DrawMenuBar Lib "User32" (ByVal hWnd As Long) As Long
#End If
#Else
Const ver As String = "version 32 en VB6"
Private Declare Function GetWindowLong Lib "User32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "User32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function FindWindow Lib "User32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function DrawMenuBar Lib "User32" (ByVal hWnd As Long) As Long
#End If
Private Sub UserForm_Activate()
Dim hWnd As Long, exLong As Long
hWnd = FindWindow(vbNullString, Me.Caption)
exLong = GetWindowLong(hWnd, -16)
If exLong And &H880000 Then
SetWindowLong hWnd, -16, exLong And &HFF77FFFF
DrawMenuBar hWnd
Me.Hide: Me.Show
End If
MsgBox ver
End Sub
Private Sub CommandButton1_Click()
Unload Me
End Sub
#If VBA7 Then
#If Win64 Then 'vba7 et 64 bits
Private Declare PtrSafe Function FindWindowA Lib "user32" (ByVal lpClassName As String, ByVal lpWindowName As String) As LongPtr
Private Declare PtrSafe Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal Hwnd As LongPtr, ByVal nIndex As Long, ByVal dwNewLong As LongPtr) As LongPtr
Const ver$ = "version 64 bits en VBA7"
#Else 'vba7 et 32 bits
Private Declare PtrSafe Function FindWindowA Lib "user32" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare PtrSafe Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal Hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Const ver$ = "version 32 bits en VBA7"
#End If
#Else 'vba6 et 32 bits
Const ver$ = "version 32 bits en VBA6"
Private Declare PtrSafe Function FindWindowA Lib "user32" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare PtrSafe Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal Hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
#End If
Private Sub CommandButton1_Click()
Unload Me
End Sub
Private Sub UserForm_Activate()
Dim Hwnd&
Hwnd = FindWindowA(vbNullString, Me.Caption)
SetWindowLong Hwnd, -16, &H94080080
' pour ne pas utiliser l'api "DrawMenuBar"et remettre la partie visible de l'usf a la meme dimention que son inside de depart
.Height = Me.Height - (Me.Height - Me.InsideHeight) + (Me.Width - Me.InsideWidth)
MsgBox ver
End Sub
Private Sub CommandButton1_Click()
Unload Me
End Sub
Private Sub UserForm_Activate()
Dim hwnd&
H = Me.InsideHeight
hwnd = ExecuteExcel4Macro("CALL(""user32"",""GetActiveWindow"",""JCC"")") 'api GetActiveWindow
ExecuteExcel4Macro ("CALL(""user32"",""SetWindowLongA"",""JJJJJ""," & hwnd & ", " & -16 & ", " & &H94080080 & ")") 'api SetWindowLongA
Me.Height = Me.Height - (Me.Height - Me.InsideHeight) + (Me.Width - Me.InsideWidth)
End Sub