473,394 Members | 1,866 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Tutorial: How to Use HTML Help in .NET

In case any of you have been as frustrated with the Help implimentation in
..NET as me, here's a way around the stupidity of using the current window as
the parent for the help window (yes, you can't go back and forth and look in
the help file and then do what it says in the program! That would be to damn
easy!).

I found the best possible way to do all of this stuff. You could extend this
to handle events etc. if you wished but this is all I needed.

Here's all you need:

[DllImport("hhctrl.ocx", CharSet=CharSet.Auto, SetLastError=true)]

static extern IntPtr HtmlHelpW(

IntPtr hwnd,

string HelpFile,

int Command,

int TopicID);

[DllImport("hhctrl.ocx", CharSet=CharSet.Auto, SetLastError=true)]

static extern IntPtr HtmlHelpA(

IntPtr hwnd,

string HelpFile,

int Command,

int TopicID);

[DllImport("user32.dll", CharSet=CharSet.Auto, SetLastError=true)]

static extern IntPtr GetDesktopWindow();

private const int HH_DISPLAY_TOC = 0x0001;

private const int HH_DISPLAY_INDEX = 0x0002;

private const int HH_DISPLAY_SEARCH = 0x0003;

private const int HH_DISPLAY_TOPIC = 0x000;

So you would call it like this:

if (System.Environment.OSVersion.Platform == System.PlatformID.Win32NT) {

HtmlHelpW(GetDesktopWindow(), "help.chm", HH_DISPLAY_TOPIC, 342342);

} else {

HtmlHelpA(GetDesktopWindow(), "help.chm", HH_DISPLAY_TOPIC, 342342);

}

GetDesktopWindow() forces it to be bound to the desktop so no stupidity.

The A is for Win9x and the W is for NT. (obviously)

If anyone is interested, I'll write up a small class.

James Hancock
Nov 15 '05 #1
2 2974
James,
The A is for Win9x and the W is for NT. (obviously)


The whole point of using CharSet.Auto is that you don't have to pick A
or W version of an API manually, the runtime does that for you. So a
single declaration without the A or W suffix should work.

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Nov 15 '05 #2
Tried that. It doesn't for some reason. My guess is becasue it's an OCX that
it's introping with and not a .dll

James Hancock

"Mattias Sjögren" <ma********************@mvps.org> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
James,
The A is for Win9x and the W is for NT. (obviously)


The whole point of using CharSet.Auto is that you don't have to pick A
or W version of an API manually, the runtime does that for you. So a
single declaration without the A or W suffix should work.

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.

Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
by: Alf P. Steinbach | last post by:
Just because there seems to be a lack of post-standard _correct_ tutorials: <url: http://home.no.net/dubjai/win32cpptut/>. Disclaimer: written this evening so perhaps there are "bugs" in the...
28
by: Alf P. Steinbach | last post by:
A few days ago I posted an "Hello, world!" tutorial, discussed in <url: http://groups.google.no/groups?threadm=41ba4c0a.76869078@news.individual.net>. As I wrote then: <quote> because there...
7
by: Newsscanner | last post by:
Hello, I am learning PHP/MySQL at the moment. I found what looked like an excellent tutorial site, but the first program I wrote already left me with an error to which I cannot find an answer. I...
15
by: binnyva | last post by:
Hello Everyone, I have just compleated a JavaScript tutorial and publishing the draft(or the beta version, as I like to call it) for review. This is not open to public yet. The Tutorial is...
156
by: jacob navia | last post by:
There is a C tutorial at http://www.cs.virginia.edu/~lcc-win32 It is written to go with the compiler, available at the same URL. I have added quite a bit of material, and I would be glad if...
18
by: Xah Lee | last post by:
i've started to read python tutorial recently. http://python.org/doc/2.3.4/tut/tut.html Here are some quick critique: quick example: If the input string is too long, they don't truncate it,...
10
by: Safalra | last post by:
When a poster in a forum I frequent said they were beginning to learn HTML, I thought I should direct them to a good HTML tutorial so that they wouldn't start using <blink> and the like....
11
by: Magnus Lycka | last post by:
While the official Python Tutorial has served its purpose well, keeping it up to date is hardly anyones top priority, and there are others who passionately create really good Python tutorials on...
9
by: julie.siebel | last post by:
Hello all! As embarrassing as it is to admit this, I've been designing db driven websites using javascript and vbscript for about 6-7 years now, and I am *horrible* at form validation. To be...
7
by: Turbo | last post by:
I have a written a detailed html tutorial here:- http://sandy007smarty.seo.iitm.ac.in/2006/09/26/html-tutorial/ I know there are a couple of html tutorials out there. But its a tutorial without...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.