|
-
Mar 12th, 2000, 04:15 AM
#1
Thread Starter
Addicted Member
I am in the process of designing an app which will totally hide it's self, by hiding from the (taskbar, task list, and form1.visible=False). My problem is that I need to set a hot key that will watch for the specific key presses to set Form1.Visible=True. I believe I need to declare a Public Const and Declare, only I do not know what the Public Const and Declare are for the ".visible". Below is similar (naturally my original code is quite lengthy), code to the code I plan to use: (Code below is from VB-World's site)
Module Code
Declare Function SendMessage Lib "user32" Alias _
"SendMessageA" (ByVal hwnd As Long, _
ByVal wMsg As Long, ByVal wParam As Long, _
lParam As Long) As Long
Declare Function DefWindowProc Lib "user32" _
Alias "DefWindowProcA" (ByVal hwnd As Long, _
ByVal wMsg As Long, ByVal wParam As Long, _
ByVal lParam As Long) As Long
'^-^-What does DefWindowProcA stand for?-^-^
Public Const WM_SETHOTKEY = &H32
'I don't need all these Const/Declares,
'but I do need ones for ".Visible" or
'mayhaps I just need to adjust my code,
'But I am so confused, I can't seem to get
'the hotkeys to work for my app.
Public Const WM_SHOWWINDOW = &H18
Public Const HK_SHIFTA = &H141 'Shift + A
Public Const HK_SHIFTB = &H142 'Shift * B
Public Const HK_CONTROLA = &H241 'Control + A
Public Const HK_ALTZ = &H45A
'The value of the key-combination has to
'declared in lowbyte/highbyte-format
'That means as a hex-number: the last two
'characters specify the lowbyte (e.g.: 41 = a),
'the first the highbyte (e.g.: 01 = 1 = Shift)
'^-^-What does this mean?-^-^
Form Code
Private Sub Form_Load()
Me.WindowState = vbMinimized
'Let windows know what hotkey you want for
'your app, setting of lParam has no effect
erg& = SendMessage(Me.hwnd, WM_SETHOTKEY, _
HK_ALTZ, 0)
'Check if succesfull
If erg& <> 1 Then
MsgBox "You need another hotkey", vbOKOnly, _
"Error"
End If
'Tell windows what it should do, when the hotkey
'is pressed -> show the window!
'The setting of wParam and lParam has no effect
erg& = DefWindowProc(Me.hwnd, WM_SHOWWINDOW, 0, 0)
End Sub
'When the user presses ALT+Z Form1.visible should be "=True" is shown.
I Need to adjust this code to make Form1.visible=True once ALT Z has been pressed. Can anyone help me out?
I appreciate any time and effort spent,
Daniel Christie
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|