Solved

-DEFAULT WINHELP TO CONTENTS PAGE-

Posted on 1999-01-20
12
319 Views
Last Modified: 2012-08-14
I've written a help project, which works fine in all respects, and from VB can get it to display any topic etc. If I open Explorer and double click the .HLP file then it opens up correctly, dislaying the contents tab and giving it focus. However, no matter what I try I cant seem to get VB to default to the contents tab. The code, and variations of it I've tried is as follows :

IRETCDE = WinHelp(Me.hwnd, "C:\MyHelp.hlp", HELP_CONTENTS, CLng(0))

This kinda works, except that it brings up the first topic defined in the help project file and not the Contents tab. From this window I can go to the Contents tab and everything works, but I just cant get it to default to the Contents tab. In the above code then Iretcde returns 1.
I'm sure it must be something really simple, but I just cant figure it out. If I try to open it using a Shell command then it works fine, but I know it must be possible using code similar to the above. The problem using Shell is also working out if it's still open or not.

 All help appreciated, but please don't lock the question unless you have the most brilliant answer.

Many thanks in advance,
Dave
0
Comment
Question by:dgb001
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
12 Comments
 
LVL 1

Author Comment

by:dgb001
ID: 1469702
Edited text of question
0
 
LVL 4

Expert Comment

by:mcix
ID: 1469703
Try:
IRETCDE = WinHelp(Me.hwnd, "C:\MyHelp.hlp", HELP_CONTENTS, "")
0
 
LVL 1

Author Comment

by:dgb001
ID: 1469704
I think that's code for a 16-bit call, the 32 bit call doesn't use a string as the last parameter. Therefore using 0 (zero) as in the example is effectively the same. I'll take a look and see if it works, but I don't think it will. Thanks for your comment anyway. I'll reject it for now to allow other folks to answer, but if it does turn out that you're right then of course you'll get the points.

Dave

0
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 
LVL 4

Expert Comment

by:mcix
ID: 1469705
Here is the Declare I use:

Declare Function WinHelp Lib "user32" Alias "WinHelpA" (ByVal hwnd As Long, ByVal lpHelpFile As String, ByVal wCommand As Long, dwData As Any) As Long
0
 
LVL 4

Expert Comment

by:mcix
ID: 1469706
Try this:

Private Const HELP_FINDER = &HB&
Temp = WinHelp(0, "c:\windows\odbcjet.hlp", HELP_FINDER, "")
0
 
LVL 1

Author Comment

by:dgb001
ID: 1469707
Hmmm, I just tried using it mcix but still defaults to a help topic page rather than the contents window. Also tried using the Declare which you posted, but same thing. You seem to have some knowledge of Help files etc (this is my first time putting Help together) - is there something I need to do to the Help project file (.prj) or the Contents file (.cnt) to get it to work the way I want ? Like I said it works fine if I double-click on it in Explorer. What value have you got HELP_CONTENTS set to ? I'm not around tomorrow or tonight, so this will be my last time in here until Friday, so please don't think I'm being rude if you post something and I dont answer for a couple of days. Hope you can help. Thanks, Dave

0
 
LVL 4

Expert Comment

by:mcix
ID: 1469708
Private Const HELP_CONTENTS = &H3

Without seeing your help file, it's next to impossible to see if there's anything wrong there....

Maybe someone else has an idea...
0
 
LVL 1

Expert Comment

by:dnavarro
ID: 1469709
Are you using a .CNT file with your .HLP file?
0
 
LVL 1

Author Comment

by:dgb001
ID: 1469710
Hi mcix. Just got back and seen the additional comments- looks like I was adding a comment at the same time as you, so where I said I tried it and didn't work was in response to the Declare and the first comment. I'll try the second comment tonight and let you know. Thanks for your comments.

dnavarro, yes, I am using a .CNT file with the help project. Any ideas ?

0
 
LVL 1

Author Comment

by:dgb001
ID: 1469711
You're a life-saver mcix, your second suggestion works a treat. Post it as an answer and I can give you the points.

Private Const HELP_FINDER = &HB&
Temp = WinHelp(0, "c:\windows\odbcjet.hlp", HELP_FINDER, "")

For my own curiosity, can you explain why this works and the other one doesn't, because I've looked around in several places and they all suggested the first solution, but havn't seen anything like your second suggestion, which works.

Many, many thanks. Very much appreciated at the end of a long, long week.
Dave

0
 
LVL 4

Accepted Solution

by:
mcix earned 150 total points
ID: 1469712
Declare Function WinHelp Lib "user32" Alias "WinHelpA" (ByVal hwnd As Long, ByVal lpHelpFile As String, ByVal wCommand As Long, dwData As Any) As Long
Private Const HELP_FINDER = &HB&

Temp = WinHelp(0, "c:\windows\odbcjet.hlp", HELP_FINDER, "")

As it turns out... Microsoft has obsoleted the HELP_CONTENTS constant with WinHelp 4.0.

I am glad it worked out...

0
 

Expert Comment

by:load_o_crap
ID: 1469713
Wow, cool responses man.. you guys have been really helpfu; thanks... I havent tested the codes yest but by the way your answerimg them thety should be correct
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month11 days, 8 hours left to enroll

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question