Et que tout cela soit dans 1 timer car j'en aurai besoin sans que l'application soit active.
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionme.hide
Private Sub Timer1_Tick(sender As System.Object, e As System.EventArgs) Handles Timer1.Tick 'ici End Sub
me.show
Public Class Form1 Private Sub Timer1_Tick(sender As System.Object, e As System.EventArgs) Handles Timer1.Tick ' code à trouvez pour que si j'appuie sur la touche "a" ou autre, la fenêtre est montrer. End Sub Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click Me.Hide() End Sub End Class
Private Sub Form1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Me.KeyPress If e.KeyChar "a" Or e.KeyChar "A" Then Me.Show() End If End Sub
Private Const MOD_ALT = &H1 Private Const MOD_CONTROL = &H2 Private Const MOD_SHIFT = &H4 Private Const PM_REMOVE = &H1 Private Const WM_HOTKEY = &H312 Private Type Msg hWnd As Long Message As Long wParam As Long lParam As Long End Type Private Declare Function RegisterHotKey Lib "user32" (ByVal hWnd As Long, ByVal id As Long, ByVal fsModifiers As Long, ByVal vk As Long) As Long Private Declare Function UnregisterHotKey Lib "user32" (ByVal hWnd As Long, ByVal id As Long) As Long Private Declare Function PeekMessage Lib "user32" Alias "PeekMessageA" (lpMsg As Msg, ByVal hWnd As Long, ByVal wMsgFilterMin As Long, ByVal wMsgFilterMax As Long, ByVal wRemoveMsg As Long) As Long Private Declare Function WaitMessage Lib "user32" () As Long Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long Private Sub ProcessMessages() Dim Message As Msg Do WaitMessage If PeekMessage(Message, Me.hWnd, WM_HOTKEY, WM_HOTKEY, PM_REMOVE) Then toto = FindWindow(vbNullString, "Calculatrice") If toto = 0 Then Shell ("calc.exe"), vbNormalFocus Else PostMessage toto, &H10, 0&, 0& End If End If DoEvents Loop End Sub Private Sub Form_Activate() Me.Hide RegisterHotKey Me.hWnd, &HBFFF&, 0, vbKeyA ProcessMessages End Sub Private Sub Form_Unload(Cancel As Integer) Call UnregisterHotKey(Me.hWnd, &HBFFF&) End Sub
Public Class Form1 Private Declare Function key Lib "User32" Alias "GetAsyncKeyState" (ByVal Key As Keys) As Keys Private Sub Timer1_Tick(sender As System.Object, e As System.EventArgs) Handles Timer1.Tick If key(Keys.A) Then Me.TopMost = True Me.TopMost = False End If End Sub End Class
Me.TopMost = True Me.TopMost = False