Solved

-DEFAULT WINHELP TO CONTENTS PAGE-

Posted on 1999-01-20
12
287 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
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
 
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

746 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now