Help files .NET applications
-
What kind of help files does .NET support?? I am converting my application from java to C#.. In the older case i have a .hlp file for providing help..But i found C# doesnt support .hlp file..so i decided to convert this to .chm file.. So before i do this i want to know whether C# really doesnt support .hlp files or not??? I have tried MSDN and couldnt get any info saying it doesnt support .hlp..instead i found many articles on .chm.. Thanks in advance Sudhakar
-
What kind of help files does .NET support?? I am converting my application from java to C#.. In the older case i have a .hlp file for providing help..But i found C# doesnt support .hlp file..so i decided to convert this to .chm file.. So before i do this i want to know whether C# really doesnt support .hlp files or not??? I have tried MSDN and couldnt get any info saying it doesnt support .hlp..instead i found many articles on .chm.. Thanks in advance Sudhakar
It supports CHM, but you can use whatever help you want if you provide the implementation by handling the
HelpRequested
event (or overridingOnHelpRequested
in derivative controls). IMO, CHMs are much better anyway. It's a better interface, easier to write for (you can use any HTML too and the HTML Help Workshop, where writing .hlp files is bit more of a pain).Microsoft MVP, Visual C# My Articles
-
It supports CHM, but you can use whatever help you want if you provide the implementation by handling the
HelpRequested
event (or overridingOnHelpRequested
in derivative controls). IMO, CHMs are much better anyway. It's a better interface, easier to write for (you can use any HTML too and the HTML Help Workshop, where writing .hlp files is bit more of a pain).Microsoft MVP, Visual C# My Articles
Thanks Stewart.. I already had the code for the above events.. but i have the problem with the following.. -------- I have my old application in java(Microsoft VJ++) and this application uses winhelp file(.hlp) to provide help for the application. This application has a form and a help control on that..when i clicked it , it displays the help related to the form..Internally the code looks like this.. Help help = new Help(); help.showHelp(string helpfilename.hlp, string topic id); Ex; helpfilename looks like "x.hlp" Topic id as "906" --- I have converted the above application to .NET framework..I am using C# as the language.. So i want to know the equivalent function for the above.. I tried using the following code as a replacement for the above. HelpNavigator navigator = HelpNavigator.Topic; System.Windows.Forms.Help.ShowHelp(this, "helpfilename.hlp", navigator, "topic id"); So i used this code: HelpNavigator navigator = HelpNavigator.Topic; System.Windows.Forms.Help.ShowHelp(this, "x.hlp", navigator, "906"); But the above code is not poping up anything.. Can anyone plz help me.. Thanks Sudhakar
-
Thanks Stewart.. I already had the code for the above events.. but i have the problem with the following.. -------- I have my old application in java(Microsoft VJ++) and this application uses winhelp file(.hlp) to provide help for the application. This application has a form and a help control on that..when i clicked it , it displays the help related to the form..Internally the code looks like this.. Help help = new Help(); help.showHelp(string helpfilename.hlp, string topic id); Ex; helpfilename looks like "x.hlp" Topic id as "906" --- I have converted the above application to .NET framework..I am using C# as the language.. So i want to know the equivalent function for the above.. I tried using the following code as a replacement for the above. HelpNavigator navigator = HelpNavigator.Topic; System.Windows.Forms.Help.ShowHelp(this, "helpfilename.hlp", navigator, "topic id"); So i used this code: HelpNavigator navigator = HelpNavigator.Topic; System.Windows.Forms.Help.ShowHelp(this, "x.hlp", navigator, "906"); But the above code is not poping up anything.. Can anyone plz help me.. Thanks Sudhakar
As I mentioned before, the help classes in .NET only work with HTML Help 1.x files (.chm). If you want to open a WinHelp file (.hlp), you should P/Invoke the
WinHelp
[^]:[DllImport("user32.dll", CharSet=CharSet.Auto)]
private static extern bool WinHelp(
IntPtr hWndMain, // Handle to main form: use form's Handle property
string lpszHelp, // .hlp filename
[MarshalAs(UnmanagedType.SysUInt)] IntPtr uCommand, // HELP enum constants
[MarshalAs(UnmanagedType.SysUInt)] IntPtr dwData); // User-defined dataThe last two params are processor-dependent types, which is why they are defined each as an
IntPtr
. To pass these values correctly, you'd use whateverint
orlong
(doesn't really matter) and pass them to the constructor for theIntPtr
like so:IntPtr param1 = new IntPtr(/* some value */ 1);
This doesn't make a pointer to one - just wraps the value 1 in a processor-dependent integer. This is for portability on 32- and 64-bit processors (something a lot of examples fail to take into account). You can find the enum constants (and what to pass into
dwData
depending on the constant used foruCommand
) in the documentation for theWinHelp
function at http://msdn.microsoft.com/library/en-us/shellcc/platform/shell/reference/functions/winhelp.asp[^]. These constants are defined in WinUser.h in the Platform SDK (installed by default with VS.NET).Microsoft MVP, Visual C# My Articles
-
As I mentioned before, the help classes in .NET only work with HTML Help 1.x files (.chm). If you want to open a WinHelp file (.hlp), you should P/Invoke the
WinHelp
[^]:[DllImport("user32.dll", CharSet=CharSet.Auto)]
private static extern bool WinHelp(
IntPtr hWndMain, // Handle to main form: use form's Handle property
string lpszHelp, // .hlp filename
[MarshalAs(UnmanagedType.SysUInt)] IntPtr uCommand, // HELP enum constants
[MarshalAs(UnmanagedType.SysUInt)] IntPtr dwData); // User-defined dataThe last two params are processor-dependent types, which is why they are defined each as an
IntPtr
. To pass these values correctly, you'd use whateverint
orlong
(doesn't really matter) and pass them to the constructor for theIntPtr
like so:IntPtr param1 = new IntPtr(/* some value */ 1);
This doesn't make a pointer to one - just wraps the value 1 in a processor-dependent integer. This is for portability on 32- and 64-bit processors (something a lot of examples fail to take into account). You can find the enum constants (and what to pass into
dwData
depending on the constant used foruCommand
) in the documentation for theWinHelp
function at http://msdn.microsoft.com/library/en-us/shellcc/platform/shell/reference/functions/winhelp.asp[^]. These constants are defined in WinUser.h in the Platform SDK (installed by default with VS.NET).Microsoft MVP, Visual C# My Articles
Thanks Stewart.. I have tried with the approach u mentioned and i am able to display my help successfully.. Initially i thought we can use .NET classes to display winhelp files.. But with ur comments i realized we have to use windows api's to display these files.. Thanks Once again.. Sudhakar