|
You last visited: Today at 16:20
Advertisement
[VB 2010] Me.Hide() Timer
Discussion on [VB 2010] Me.Hide() Timer within the .NET Languages forum part of the Coders Den category.
10/25/2013, 14:58
|
#1
|
elite*gold: 0
Join Date: Oct 2013
Posts: 78
Received Thanks: 18
|
[VB 2010] Me.Hide() Timer
Guten Tag epvp,
hab ein Problem undzwar,
möchte ich wenn die Form sich öffnet, das Sie sich nach paar Sekunden, sich minimiert und wieder maximiert.
Kein Problem.
Deshalb mache ich bei Form_Load:
Starter.Start()
Und in dem Timer ist folgendes:
Me.Hide()
Me.Show()
Starter.Stop()
Stoppen ist weil es sich dann die ganze Zeit minimiert und maximiert.
Timer:
Enabled = False
Interval = 18000 (18 Sekunden)
Nun habe ich hier ein Befehl:
Case Keys.Delete
Me.Hide()
Case Keys.Insert
Me.Show()
Das Problem ist jetzt das diese nicht ausgeführt werden, denn:
Wenn ich eines der Tasten drücke passiert es aber es wird dann wieder angezeigt.
Ich glaube das hat was mit dem Timer zutun aber ich weiß nicht was.
|
|
|
10/25/2013, 15:14
|
#2
|
elite*gold: 5
Join Date: Mar 2008
Posts: 460
Received Thanks: 436
|
Du hast ja keinen Fokus auf dein Programm, daher verläuft spätestens das Maximieren im Nirvana.
Du musst dein Keyboard Global Hooken, damit dein Programm dies erkennt.
Google einfach mal nach "Global Keyboard Hook" oder so ähnlich.
Pass aber auf, denn dabei wird dein Programm ziemlich leicht als Virus erkannt. Da es ja Tastenabfragen abgreift.
|
|
|
10/25/2013, 15:18
|
#3
|
elite*gold: 0
Join Date: Oct 2013
Posts: 78
Received Thanks: 18
|
Habe sowas hier:
Code:
Imports System.Runtime.InteropServices
Public Class WolfSeedD3D
#Region "Hook"
Private Declare Sub keybd_event Lib "user32" ( _
ByVal bVk As Byte, _
ByVal bScan As Byte, _
ByVal dwFlags As Integer, _
ByVal dwExtraInfo As Integer)
Private Const KEYEVENTF_KEYUP = &H2
Private Delegate Function HOOKPROCDelegate( _
ByVal nCode As Integer, _
ByVal wParam As IntPtr, _
ByRef lParam As KBDLLHOOKSTRUCT) As IntPtr
Private HookProc As New HOOKPROCDelegate(AddressOf KeyboardHookProc)
Private Declare Unicode Function GetModuleHandleW Lib "kernel32.dll" ( _
ByVal lpModuleName As IntPtr) As IntPtr
Private Declare Unicode Function SetWindowsHookExW Lib "user32.dll" ( _
ByVal idHook As Integer, _
ByVal lpfn As HOOKPROCDelegate, _
ByVal hMod As IntPtr, _
ByVal dwThreadId As UInteger) As IntPtr
' Für das Löschen des Hooks wird diese Funktion verwendet:
Private Declare Unicode Function UnhookWindowsHookEx Lib "user32.dll" ( _
ByVal hhk As IntPtr) As UInteger
Private Declare Unicode Function CallNextHookEx Lib "user32.dll" ( _
ByVal hhk As IntPtr, _
ByVal nCode As Integer, _
ByVal wParam As IntPtr, _
ByRef lParam As KBDLLHOOKSTRUCT) As IntPtr
Private Const WM_KEYDOWN As Int32 = &H100 ' Konstante für WM_KEYDOWN
Private Const WM_KEYUP As Int32 = &H101 ' Konstante für WM_KEYUP
Private Const HC_ACTION As Integer = 0 ' Konstante für HC_ACTION
Private Const WH_KEYBOARD_LL As Integer = 13 ' Konstante für WH_KEYBOARD_LL
Public PrevWndProc As Integer
Private mHandle As IntPtr
<StructLayout(LayoutKind.Sequential)> Public Structure KBDLLHOOKSTRUCT
Public vkCode As Keys
Public scanCode, flags, time, dwExtraInfo As UInteger
Public Sub New(ByVal key As Keys, _
ByVal scancod As UInteger, _
ByVal flagss As UInteger, _
ByVal zeit As UInteger, _
ByVal extra As UInteger)
vkCode = key
scanCode = scancod
flags = flagss
time = zeit
dwExtraInfo = extra
End Sub
End Structure
Public Property KeyHookEnable() As Boolean
Get
Return mHandle <> IntPtr.Zero
End Get
Set(ByVal value As Boolean)
If KeyHookEnable = value Then Return
If value Then
mHandle = SetWindowsHookExW(WH_KEYBOARD_LL, HookProc, _
GetModuleHandleW(IntPtr.Zero), 0)
Else
UnhookWindowsHookEx(mHandle)
mHandle = IntPtr.Zero
End If
End Set
End Property
Private Function KeyboardHookProc(ByVal nCode As Integer, _
ByVal wParam As IntPtr, _
ByRef lParam As KBDLLHOOKSTRUCT) As IntPtr
Dim fEatKeyStroke As Boolean
If nCode = HC_ACTION Then
fEatKeyStroke = Hook(lParam.vkCode)
If fEatKeyStroke Then
Return New IntPtr(1)
Exit Function
End If
Return CallNextHookEx(mHandle, nCode, wParam, lParam)
End If
End Function
#End Region
Dim DoubleHookProtect As Short = 1
Private Function Hook(ByVal keyCode As Integer)
If DoubleHookProtect = 1 Then
DoubleHookProtect = 2
Else
DoubleHookProtect = 1
Return False
End If
|
|
|
10/31/2013, 11:42
|
#4
|
elite*gold: 0
Join Date: Jan 2010
Posts: 990
Received Thanks: 127
|
Guck dir RegisterHotKey an.
Ein lowlevelkeyboard hook ist dafür nicht nötig.
|
|
|
Similar Threads
|
[VB 2010] Timer Problem
03/02/2012 - .NET Languages - 1 Replies
Erledigt
|
Job Timer (Taxi Timer, etc)
09/01/2011 - SRO Hacks, Bots, Cheats & Exploits - 2 Replies
A small utility to keep track of jobs that need timing.
http://img834.imageshack.us/img834/6076/jt01.png
Always read the changelog!
To get access to Job Timer, register at "www.error- soft.net" ( without the spaces between the - )
Press thanks if this helps at all.
|
[Hilfe] VB 2010 Timer auf Knopfdruck starten
04/25/2011 - .NET Languages - 3 Replies
Hallo E*Pvpers,
wie kann ich in VB2010 machen das das Programm anhält, bis man z.B. F12 gedrückt hat?
Eine andere Lösung für mich wäre, wenn das Programm auch einfach z.B. 3 Sekunden anhält, dafür habe ich aber kein Befehl gefunden. "Sleep" gibst ja nicht mehr in 2010.
Bedanke mich schon mal, für eure Antworten.
Gruß, Mbcool
|
All times are GMT +1. The time now is 16:21.
|
|