Option Explicit
'Code geschrieben von Daniel Klann
#If vb7 Then
Private Declare PtrSafe Function CallNextHookEx Lib "user32" (ByVal hHook As LongLong, ByVal ncode As LongLong, ByVal wParam As LongLong, lParam As Any) As LongLong
Private Declare PtrSafe Function GetModuleHandle Lib "kernel32" Alias "GetModuleHandleA" (ByVal lpModuleName As String) As LongLong
Private Declare PtrSafe Function SetWindowsHookEx Lib "user32" Alias "SetWindowsHookExA" (ByVal idHook As LongLong, ByVal lpfn As LongLong, ByVal hmod As LongLong, ByVal dwThreadId As LongLong) As LongLong
Private Declare PtrSafe Function UnhookWindowsHookEx Lib "user32" (ByVal hHook As LongLong) As LongLong
Private Declare PtrSafe Function SendDlgItemMessage Lib "user32" Alias "SendDlgItemMessageA" (ByVal hDlg As LongLong, ByVal nIDDlgItem As LongLong, ByVal wMsg As LongLong, ByVal wParam As LongLong, ByVal lParam As LongLong) As LongLong
Private Declare PtrSafe Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hWnd As LongLong, ByVal lpClassName As String, ByVal nMaxCount As LongLong) As LongLong
Private Declare PtrSafe Function GetCurrentThreadId Lib "kernel32" () As LongLong
Public Function NewProc(ByVal lngCode As LongLong, ByVal wParam As LongLong, ByVal lParam As LongLong) As LongLong
Private hHook As LongLong
#Else
Private Declare Function CallNextHookEx Lib "user32" (ByVal hHook As Long, ByVal ncode As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function GetModuleHandle Lib "kernel32" Alias "GetModuleHandleA" (ByVal lpModuleName As String) As Long
Private Declare Function SetWindowsHookEx Lib "user32" Alias "SetWindowsHookExA" (ByVal idHook As Long, ByVal lpfn As Long, ByVal hmod As Long, ByVal dwThreadId As Long) As Long
Private Declare Function UnhookWindowsHookEx Lib "user32" (ByVal hHook As Long) As Long
Private Declare Function SendDlgItemMessage Lib "user32" Alias "SendDlgItemMessageA" _
(ByVal hDlg As Long, ByVal nIDDlgItem As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Private Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hWnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long
Private Declare Function GetCurrentThreadId Lib "kernel32" () As Long
Private hHook As Long
#End If
Private Const EM_SETPASSWORDCHAR = &HCC
Private Const WH_CBT = 5
Private Const HCBT_ACTIVATE = 5
Private Const HC_ACTION = 0
Dim RetVal
Public Function NewProc(ByVal lngCode As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Dim strClassName As String, lngBuffer As LongLong
If lngCode < HC_ACTION Then
NewProc = CallNextHookEx(hHook, lngCode, wParam, lParam)
Exit Function
End If
strClassName = String$(256, " ")
lngBuffer = 255
If lngCode = HCBT_ACTIVATE Then
RetVal = GetClassName(wParam, strClassName, lngBuffer)
If Left$(strClassName, RetVal) = "#32770" Then
SendDlgItemMessage wParam, &H1324, EM_SETPASSWORDCHAR, Asc("*"), &H0
End If
End If
CallNextHookEx hHook, lngCode, wParam, lParam
End Function
Public Function InputBoxDK(Prompt, Optional Title, Optional Default, Optional XPos, _
Optional YPos, Optional HelpFile, Optional Context) As String
Dim lngModHwnd As LongLong, lngThreadID As LongLong
lngThreadID = GetCurrentThreadId
lngModHwnd = GetModuleHandle(vbNullString)
hHook = SetWindowsHookEx(WH_CBT, AddressOf NewProc, lngModHwnd, lngThreadID)
InputBoxDK = InputBox(Prompt, Title, Default, XPos, YPos, HelpFile, Context)
UnhookWindowsHookEx hHook
End Function
Sub MdpEntrer()
Dim Mdp As String
'Mdp = InputBoxDK("Entrer le mot de passe", "Demande")
'
'If Mdp <> "Apbp67120" Then
'MsgBox "Le mot de passe est incorrect", vbCritical
'Exit Sub
'ElseIf Mdp = "Apbp67120" Then
Feuil1.Visible = True
Feuil1.Activate
Feuil2.Visible = xlSheetHidden
Feuil3.Visible = xlSheetHidden
Feuil5.Visible = xlSheetHidden
Feuil6.Visible = xlSheetHidden
Feuil8.Visible = xlSheetVeryHidden
Feuil1.Range("A1:X52").Select
ActiveWindow.Zoom = True
Cells(1, 1).Select
'End If
End Sub
Sub MdpConsulter()
Feuil5.Visible = True
Feuil3.Visible = True
Feuil5.Activate
Feuil1.Visible = xlVeryHidden
Feuil2.Visible = xlVeryHidden
With Feuil5.Cells
.EntireColumn.Hidden = False
.EntireRow.Hidden = False
.Clear
.Interior.ColorIndex = xlNone
'.HorizontalAlignment = xlCenter
'.VerticalAlignment = xlCenter
'.ColumnWidth = 15
'.RowHeight = 15
End With
Feuil5.Cells.Clear
ThisWorkbook.Sheets("BDD").Range("A1").CurrentRegion.Copy Sheets("Vue_listes_artistes").Range("A1")
'Rows("1:2").Select
'Range("A2").Activate
'Selection.EntireRow.Hidden = True
UserForm9.Show
Range("A1").Select
Selection.AutoFilter
End Sub