|
-
May 8th, 2013, 06:26 AM
#1
Thread Starter
Hyperactive Member
HTML Help with F1
Hi
From what I have read it seems that the question I am about to ask
has been aired before by me and many others, but I am asking again
to try to fully resolve the problem.
I have a full HTML help file for my project and I want the user to be able
to call the help with F1 key
As it stands now when the project opens with the Parent Form F1 will not
work, open any child form and F1 works for that form,close the child form
F1 works for the Parent form and any of the other child form's. In other words
as I wanted.
Q. Why does the parent form F1 not work when the project starts?
Next point when I try to compile the project to an *.exe I get an error with
Code:
VB6
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyF1 Then
HtmlHelp hWnd, App.HelpFile, "AddressBook.chm", HH_HELP_CONTEXT, ByVal 20&
End If
End Sub
HtmlHelp Wrong Number of Arguments or an Invalid Properties Assignment
Can you help please
-
May 8th, 2013, 06:43 AM
#2
Re: HTML Help with F1
Hoping it's the same API call but I think you have one argument too many.
Your code shows five arguments:
Code:
HtmlHelp hWnd, App.HelpFile, "AddressBook.chm", HH_HELP_CONTEXT, ByVal 20&
(1) (2) (3) (4) (5)
but, taken from http://p2p.wrox.com/pro-vb-6/62929-l...-help-vb6.html
Code:
Private Declare Function HTMLHelp Lib "HHCtrl.ocx" Alias "HTMLHelpA" _
(ByVal hWndCaller As Long, _
ByVal pszFile As String, _
ByVal uCommand As Long, _
ByVal dwData As Long) As Long
HtmlHelp hWnd, "HHDemo.chm", HH_HELP_CONTEXT, ByVal 100&
(1) (2) (3) (4)
Regards, Phill W.
-
May 8th, 2013, 06:44 AM
#3
Re: HTML Help with F1
The HtmlHelp API requires just 4 parameters. The pszFile parameter (2nd parameter) "specifies the file path to either a compiled help (.chm) file, or a topic file within a specified help file." Therefore, you should pass either "AddressBook.chm" or App.HelpFile, not both. You can assign the full path of "AddressBook.chm" to App.HelpFile if you want and pass App.HelpFile instead.
As for your main question, sorry but I have no idea why the Form behaves like that.
On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)
-
May 8th, 2013, 09:20 AM
#4
Thread Starter
Hyperactive Member
Re: HTML Help with F1
Hi Bonnie West & Phil W
Thanks for the posts yes of course messing around with the API and
got it all screwed up. Now compiles OK.
Just hope someone out there in VBForums can answer my other question.
Problem is I do not think HTML is top of the list with the Pro's
-
May 10th, 2013, 09:26 AM
#5
Thread Starter
Hyperactive Member
Re: HTML Help with F1
Hi
Still trying to find my problem about F1, could somebody tell me
what I am doing wrong, when a form loads it invokes the HTMLHelp
[Code]
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyF1 Then
HtmlHelp hWnd, "AddressBook.chm", HH_HELP_CONTEXT, ByVal 20&
End If
End Sub
[\Code]
If I add a breakpoint to the code above and run the project,load the
form and Press F1 the help file loads but the breakpoint does not work
why?
-
May 10th, 2013, 09:40 AM
#6
Re: HTML Help with F1
On which line did you set the breakpoint?
On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)
-
May 10th, 2013, 09:43 AM
#7
Thread Starter
Hyperactive Member
Re: HTML Help with F1
Hi Bonnie West
All of them, 1 at a time
-
May 10th, 2013, 10:06 AM
#8
Re: HTML Help with F1
Can you describe exactly what "does not work" with the breakpoint? I tried your code minus the HtmlHelp line and I was able to step through the code as expected.
On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)
-
May 10th, 2013, 11:11 AM
#9
Thread Starter
Hyperactive Member
Re: HTML Help with F1
Hi Bonnie West
Sure
As you know from my earlier post this help works well except
for the Parent Form when the project loads to that form, load
any other form in the project (all Childs) and then the F1 help
call will work, so I thought I would see if the F1 was not being called
from the Parent Form and it was not, so I loaded a child form, closed it
and then tried F1 on the Parent form again and the help opened, but it
did not fire the keydown at all.
I next put breakpoints on all other forms on all keydown's and although
the help opened no keydown event flagged a breakpoint.(weird)
So I then put breakpoints on all help calls which included all cmd's
in the Menu Editor and the end result was the same,help opened
but no keydown event flagged.
I then rechecked all the Menu Editor cmd's and they stopped at the
breakpoints as I expected.
I then put a rem on the keydown event and ran the project again
and the help still opens as before at the moment I am lost.
So then I posted but from what you said it should break at the F1
Keydown. Q Do you use MZ Tools, does that have something I
can use to find out whats happening.
Last edited by RocketRon; May 10th, 2013 at 11:15 AM.
-
May 10th, 2013, 11:27 AM
#10
Re: HTML Help with F1
Is your Parent Form's KeyPreview set to True? If possible, can you attach your project?
EDIT
About the MZ-Tools add-in, I have it but I don't use it often enough to be familiar with its usage. Sorry.
Last edited by Bonnie West; May 10th, 2013 at 11:32 AM.
On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)
-
May 10th, 2013, 11:33 AM
#11
Thread Starter
Hyperactive Member
Re: HTML Help with F1
Hi Bonnie West
KeyPreview is set to True
Very big project even for a Zipped file I will make a
test project, let you know when ready to send.
-
May 13th, 2013, 05:48 AM
#12
Thread Starter
Hyperactive Member
Re: HTML Help with F1
Hi Bonnie West
OK I have been trying to find why I cannot get F1 to work on my
Parent Form, I have made some progress but have not resolved
the problem yet.
I have the Form Load
Code:
Private Sub Form_Load()
Set Titles = New clsTitles
uName = VBA.Environ("USERNAME")
myStrList = False
Cancel = False
ChDir App.Path
With Me
.Height = 8600
.Width = 11500
.Left = (Screen.Width - .Width) / 2
.Top = (Screen.Height - .Height) / 2
.Caption = vbTab & txtOwner & "'s " & " Address Book"
' .HelpContextID = 34234
End With
Call GridWidth
'Show first form
frmabFront.Show vbModal, Me
End Sub
**Next**
Private Sub Form_Activate()
Dim xCancel As Control
sbAddress.Panels.Item(1).Text = "R.J.R. Computer Solutions :- " & _
"Address Book - Version :- " & App.Major _
& "." & App.Minor & "." & App.Revision
If Cancel = True Then
rCount = 10
tmrClose.Enabled = True
End If
End Sub
When I start the project with no break points F1 will not fire the KeyDown
Code:
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyF1 Then
HtmlHelp hWnd, "AddressBook.chm", HH_HELP_CONTEXT, ByVal 20&
End If
End Sub
put a break point anywhere in the form activate and it works fine
any ideas?
-
May 13th, 2013, 08:06 AM
#13
Re: HTML Help with F1
I've noticed something in your Parent Form's Load event:
Code:
Private Sub Form_Load()
. . .
'Show first form
frmabFront.Show vbModal, Me '<-- Is this intentional?
End Sub
You do know that until frmabFront is hidden or unloaded, your Parent Form won't show itself?
I can't see anything in your posted code that might be causing F1 to be ignored. There's probably something else in your code that's the real culprit.
On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)
-
May 13th, 2013, 11:05 AM
#14
Thread Starter
Hyperactive Member
Re: HTML Help with F1
Hi Bonnie West
frmabFront controls all the login stuff if I rem it out there
is no difference and after login I unload it.
Do you see a wrong approach in the way I have done it?
-
May 13th, 2013, 01:42 PM
#15
Re: HTML Help with F1
 Originally Posted by RocketRon
Do you see a wrong approach in the way I have done it?
Well, I just found it rather odd. But now that you've explained what it's for, I suppose there's nothing wrong with showing frmabFront modally in Form_Load.
On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)
-
May 14th, 2013, 02:12 AM
#16
Thread Starter
Hyperactive Member
Re: HTML Help with F1
Hi Bonnie West
I am a self taught VB user so I guess my approach is very basic and
often what I have gleamed from books, I would be happy to read
what you really think, thats how to learn. would you be prepared to
expand on your quote.
"Well, I just found it rather odd. But now that you've explained what it's for, I suppose there's nothing wrong with showing frmabFront modally in Form_Load."
-
May 14th, 2013, 02:31 AM
#17
Re: HTML Help with F1
 Originally Posted by Bonnie West
Well, I just found it rather odd. But now that you've explained what it's for, I suppose there's nothing wrong with showing frmabFront modally in Form_Load.
Although, if that login form is suppose to be the first shown form in the project it probably should be shown using "sub main".
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
https://get.cryptobrowser.site/30/4111672
-
May 14th, 2013, 02:54 AM
#18
Re: HTML Help with F1
 Originally Posted by RocketRon
... I would be happy to read
what you really think, thats how to learn. would you be prepared to
expand on your quote.
Well, I believe the normal way is to show the login form first before loading the main form. That way, the login form is quickly displayed to the user rather than waiting first for the main form to load. You could load (but not show it yet) the main form in the Form_Activate of the login form. When the user clicks OK (or something like that), you can now unload the login form and make the main form visible. With the way you've done it, I guess that, if your main form doesn't take too long to load, then it really doesn't matter to the end user.
On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)
-
May 14th, 2013, 02:57 AM
#19
Re: HTML Help with F1
 Originally Posted by Nightwalker83
Although, if that login form is suppose to be the first shown form in the project it probably should be shown using "sub main".
Yes, that's how it's typically done. Show the login form first before loading the main form.
On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)
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
|