'Hotkey Credits:
'KPD-Team 2000
'URL: [url]http://www.allapi.net/[/url]
Option Explicit
'//////Start Sys Tray Info\\\\\\
Private Declare Function Shell_NotifyIcon Lib "shell32" Alias "Shell_NotifyIconA" (ByVal dwMessage As Long, pnid As NOTIFYICONDATA) As Long
Private Type NOTIFYICONDATA
cbSize As Long
hWnd As Long
uId As Long
uFlags As Long
ucallbackMessage As Long
hIcon As Long
szTip As String * 64
End Type
Private Const NIM_ADD = &H0
Private Const NIM_MODIFY = &H1
Private Const NIM_DELETE = &H2
Private Const NIF_MESSAGE = &H1
Private Const NIF_ICON = &H2
Private Const NIF_TIP = &H4
Private Const WM_LBUTTONDBLCLK = &H203
Private Const WM_LBUTTONDOWN = &H201
Private Const WM_RBUTTONUP = &H205
Dim NID As NOTIFYICONDATA
'\\\\\\End Sys Tray Info//////
'//////Start Hotkey Info\\\\\\
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 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 POINTAPI
x As Long
y As Long
End Type
Private Type Msg
hWnd As Long
Message As Long
wParam As Long
lParam As Long
time As Long
pt As POINTAPI
End Type
Private bCancel As Boolean
'\\\\\\End Hotkey Info//////
Private Sub Form_Load()
'///System Tray\\\
With NID
.cbSize = Len(NID)
.hIcon = Me.Icon
.hWnd = Me.hWnd
.szTip = "Crazy Dave's Security Suite" & vbNullChar
.ucallbackMessage = WM_LBUTTONDBLCLK
.uFlags = NIF_MESSAGE Or NIF_ICON Or NIF_TIP
.uId = 1&
End With 'Set the data
Shell_NotifyIcon NIM_ADD, NID 'Add the Icon
'\\\System Tray///
'///Hotkeys\\\
Dim ret As Long
bCancel = False
ret = RegisterHotKey(Me.hWnd, &HBFFF&, MOD_CONTROL, vbKeyT) 'register the Ctrl-T hotkey
ProcessMessages 'process the Hotkey messages
'\\\Hotkeys///
Me.Visible = False
Me.WindowState = vbMinimized
End Sub
Private Sub ProcessMessages()
Dim Message As Msg
Do While Not bCancel 'loop until bCancel is set to True
WaitMessage 'wait for a message
If PeekMessage(Message, Me.hWnd, WM_HOTKEY, WM_HOTKEY, PM_REMOVE) Then 'check if it's a HOTKEY-message
Visible = True
WindowState = vbNormal
End If 'any needed tasks upon detection of the hotkey
DoEvents 'let the operating system process other events
Loop
End Sub
Private Sub Form_Unload(Cancel As Integer)
bCancel = True
Call UnregisterHotKey(Me.hWnd, &HBFFF&) 'unregister hotkey
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then Command1_Click
End Sub
Private Sub Command1_Click()
If Text1.Text = "youdonotneedmypassword" Then
Shell "explorer.exe myFolder", vbNormalFocus
Me.Visible = False
End If
Text1.Text = ""
End Sub