Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 334
  • Last Modified:

-DEFAULT WINHELP TO CONTENTS PAGE-

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
dgb001
Asked:
dgb001
1 Solution
 
dgb001Author Commented:
Edited text of question
0
 
mcixCommented:
Try:
IRETCDE = WinHelp(Me.hwnd, "C:\MyHelp.hlp", HELP_CONTENTS, "")
0
 
dgb001Author Commented:
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
mcixCommented:
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
 
mcixCommented:
Try this:

Private Const HELP_FINDER = &HB&
Temp = WinHelp(0, "c:\windows\odbcjet.hlp", HELP_FINDER, "")
0
 
dgb001Author Commented:
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
 
mcixCommented:
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
 
dnavarroCommented:
Are you using a .CNT file with your .HLP file?
0
 
dgb001Author Commented:
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
 
dgb001Author Commented:
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
 
mcixCommented:
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
 
load_o_crapCommented:
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now