Solved

-DEFAULT WINHELP TO CONTENTS PAGE-

Posted on 1999-01-20
12
312 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
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VBS file using code from 2nd file (txt or vbs) 4 56
VBA: Select SQL query based on a config Sheet v2 11 55
How to make an ADE file by code? 11 111
backup program with robocopy 6 92
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

759 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