hi,
how do i when i click on label make it press the f1 key so that my .hlp file will load
cheers
Merlin ?
Printable View
hi,
how do i when i click on label make it press the f1 key so that my .hlp file will load
cheers
Merlin ?
Do you mean you want your help file to popup with the user clicks on label1, just like pressing F1?
If it is, you can call the code that the F1 key uses in the label's click event.
Sunny
Sunnyl:
How do you do that..when your app is running, manually click F1 and see what happens..."Nothing".
I had been under the impression that he had already created a help file, which was already readily accessible by pressing F1, and he had wanted to simulate that keypress by clicking a label. That was how I had translated his question to be.
Sunny
zmerlinz
This may be of interest to you.
http://www.vb-world.net/articles/helpapi/
OK..I thought perhaps you had something I could use
with this code as this will trigger the key event but that is all.......Oh well, It never hurts to ask..Thanks.
Wayne
' trap keys and use your code for their events
Code:Option Explicit
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case vbKeyF1: MsgBox "F1 pressed."
End Select
End Sub
Private Sub Form_Load()
Form1.KeyPreview = True
End Sub
Private Sub Label1_Click()
Call Form_KeyDown(vbKeyF1, 0)
End Sub
There's a SendKeys statement it's to send one or more keystrokes to the active window as if typed at the keyboard.
SendKeys "{F1}",True
{F1} is the code for f1, if u want more code for other key, just ask.
Hope it help
I think setting the help file in the properties of the Project will make it accesable via F1, otherwise use or the CommonDialog, or use ShellExecute API to open the HLP file.
You can ask for code if ya want!
cheers sebs that is what i was after, sorry to all about wording the question, i was on the 'net at school and had to be quick
Cheers
Merlin ?
Go to Project > Properties and whatever is listed under Help File Name will open when the user hits F1.Quote:
Originally posted by HeSaidJoe
Sunnyl:
How do you do that..when your app is running, manually click F1 and see what happens..."Nothing".
Megatron
'ok, that what I was after. Now for and encore, can you see any reason this won't work. I insert the path and file for
the api help dialog.
I use this code and it messages ME but the api help file
dialog doesn't open
If I manually press F1 then it messages Me and the api help
file dialog opens
Code:Option Explicit
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If vbKeyF1 Then MsgBox "ME"
End Sub
Private Sub Form_Load()
Form1.KeyPreview = True
End Sub
Private Sub Label1_Click()
Call Form_KeyDown(vbKeyF1, 0)
End Sub
It's because when you use Call Form_KeyDown(vbKeyF1, 0) you are actually calling this event not the WM_KEYDOWN message. The help file will only display if the WM_KEYDOWN message is sent.
As a work around, send the WM_KEYDOWN message or use the SendKeys function.
thanks