cornelyus

Hello..

i want to add a help file to a program i have developed for windows mobile 5, .Net CF 2.0...

i am guessing i can create a .chm file with a HTML help workshop, after creating the pages with frontpage..

my question is.. how can i call from my program the help file each time i ( for example) press the help button

can u guide me in some direction thank you!


Re: .NET Compact Framework creating help on a windows mobile 5.0

Christopher Fairbairn

Hi,

The Windows Mobile platform does not by default support the use of *.chm help files. If you want to investigate using CHM files within Windows Mobile there is an article on Code Project which implements a CHM file viewer available at http://www.codeproject.com/netcf/CHMReaderNet.asp

The native help provided by built in applications (such as the calculator or file explorer etc) is actually a single HTML file with special comments placed within it to indicate seperate topics etc.

Within a Compact Framework application you can learn how to implement such help in your application by reading the following MSDN tutorial - "How To: Display user Help" - http://msdn2.microsoft.com/en-us/library/ms229662.aspx

Once you have a properly formatted HTML file you can then display it within your compact framework application by making a call such as the following one:

Code Snippet
Help.ShowHelp(this,@"\windows\myappHelp.htm#overview");

Hope this helps,

Christopher Fairbairn

PS: Did you know that the built in help is accessable via the start menu If you select the "Help" entry at the bottom of the device's start menu you will receive context sensitive help for the active application, following the how to guide mentioned above will also allow you to hook this functionality up for your application. In most cases however I also advise having a "Help" menu entry or something similiar, as in my experience most end users are not aware of how to access Help via the start menu.






Re: .NET Compact Framework creating help on a windows mobile 5.0

cornelyus

so i would only have to create a HTML file and call it with the Help.ShowHelp

i never implemented help in a HTML file... but i am assuming that i would have to create the index and all.. thing that with .chm would me made automatically no




Re: .NET Compact Framework creating help on a windows mobile 5.0

Christopher Fairbairn

Hi,

cornelyus wrote:
i never implemented help in a HTML file... but i am assuming that i would have to create the index and all.. thing that with .chm would me made automatically no

Yes you are correct in this assumption. Some of the links I referered to earlier outline the special comments that must be inserted into your HTML help file to mark the start and end of each topic.

You are responsible for creating your table of contents/index, and for listing search terms and their resultant topic for the find feature.

Hope this helps,

Christopher Fairbairn






Re: .NET Compact Framework creating help on a windows mobile 5.0

cornelyus

hello again...

i have one question...

i implemented my application and i now have a cab file to install it...

is it possible to have the help files on it and they are copied to the right folders




Re: .NET Compact Framework creating help on a windows mobile 5.0

Christopher Fairbairn

Hi,

cornelyus wrote:
i implemented my application and i now have a cab file to install it...

is it possible to have the help files on it and they are copied to the right folders

Yes this is possible. I assume since this is a Compact Framework related forum that you are producing your CAB file via Visual Studio 2005's "Smart Device CAB Project" project type.

If this is the case you should be able to add your HTML file by using the following procedure from within the IDE.

  • Within Solution Explorer right click on your deployment project and select "File System" within the "View" submenu.
  • You should see a new "File System" view appear with a tree view on the left hand side
  • Right click on the root entry - "File System on Target Machine" and select "Windows Folder" within the "Create Special Folder" sub menu.
  • This should add a "Windows Folder" to the bottom of the tree view.
  • If you click on this new entry, you should be able to right click on the right hand side of the window and select "File..." from the "Add" submenu and browse to your HTML help file.

If you right click on the file you just added you should be able to find a "Create shortcut to xyz.html" menu entry which will enable to you create a shortcut which you can use to link your help file into the main help UI of the device (by placing it in the \Windows\Help folder).

Hope this helps,

Christopher Fairbairn






Re: .NET Compact Framework creating help on a windows mobile 5.0

cornelyus

wow thank.. i guess that's exactly what i need

another question... about the help also, i have created the .lnk file, but i don't understand what they about the number of characters ...

  1. Create a shortcut file for the Help system to list your Help with the other installed Help in the system. In a text editor, create a file with a path to your Help using the following syntax:

    14#\windows\critters.htm

    The path is preceded by the number of characters in the path and the number sign (#). This should be the only line in the file. In this example, the Help for the Critters game is displayed.

why 14 i have to know this because my file will have a different name from critters..






Re: .NET Compact Framework creating help on a windows mobile 5.0

cornelyus

by the way

do u know if it's posible to add images on the htm help file




Re: .NET Compact Framework creating help on a windows mobile 5.0

Christopher Fairbairn

Hi,

Yes you can use images within your help file but there are some "traps" to be aware of. The main one is the file format, your images should be in *.2bp or *.bmp file format, i.e. you can not use JPEG or PNGs etc. Also the image URLs are relative to the \windows directory, not the location of your help file.

You should be able to include an image via a simple <img> element within your HTML help file as follows:

<img src="my_example.bmp" />

With respect to the shortcut issue, I am not sure. I think that is just a documentation "bug". All other MSDN references discussing the shortcut file format mention the same thing (the number at the front is the number of characters in the file path). However in the example you indicated this clearly isn't the case...

I wouldn't worry about it too much. In most cases you can just let the operating system create the shortcut for you. I have seen a couple of shortcuts where this number prefix is "0", and the shortcuts still seem to work. Perhaps the OS ignores this field in present versions

You may like to download the sample application I've attached to my blog posting titled "Provide Help for an application". It is available at http://www.christec.co.nz/blog/archives/74

I have updated the sample application to include examples of including images within help topics. It also shows you how to automatically create the required shortcuts as part of a CAB file setup project. The sample was designed within VS2005 to run on devices with .NET CF 2.0 installed.

Hope this helps,

Christopher Fairbairn






Re: .NET Compact Framework creating help on a windows mobile 5.0

cornelyus

thanks chris... your blog post is really nice!!

i was able to get the help file working just this afternoon, i have to try to include images also... and to get the file on the CAB file of instalation...

my htm file has different name from the msdn example, but i still used the number 14 in the shortcut, and it's working fine, so yeah i guess it doesn't matter the number to the case...

thank you for all the help.. and i was wondering .. i made another post... can u help me with that

http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=1911037&SiteID=1&mode=1




Re: .NET Compact Framework creating help on a windows mobile 5.0

stman

Hi,

I'm having issues with relative paths Windows Mobile Help. I've created a .htm file and an "images" subfolder and under Program Files\myapp\help. I have a link file in the Windows\Help folder which lists the Help under the main TOC, under Help for Added Programs. When I tap this link, it displays the "Main_Contents" topic of my Help file correctly. This topic contains only links to anchors in the same .htm file, but the links don't work unless the entire path from "Program Files" is includes as part of the href. I get a file not found message.

I've read that things are relative to the Windows folder so I tried adding a base href="" to the head section of the .htm file, but that seems to be ingored. Furthermore, search keywords are not found either, and I question why the search Type doesn't list my application. Do I have to chose Help as the Type I figured that would mean the system, and not my application.

Thanks for any insight.





Re: .NET Compact Framework creating help on a windows mobile 5.0

Christopher Fairbairn

Hi,

stman wrote:
I'm having issues with relative paths Windows Mobile Help. I've created a .htm file and an "images" subfolder and under Program Files\myapp\help. I have a link file in the Windows\Help folder which lists the Help under the main TOC, under Help for Added Programs. When I tap this link, it displays the "Main_Contents" topic of my Help file correctly. This topic contains only links to anchors in the same .htm file, but the links don't work unless the entire path from "Program Files" is includes as part of the href. I get a file not found message.

Yes I have seen this behaviour too. At present I am not aware of a solution, but bieleve there must be one, as it makes it difficult to not place your help file on the device (if you want to install to a storage card for example).

See my answer to another of your questions, for why this is probably behaving in this way.

stman wrote:
I've read that things are relative to the Windows folder so I tried adding a base href="" to the head section of the .htm file, but that seems to be ingored.

Yes this would probably be the behaviour your would see. Internally the help browser application is parsing your single *.htm file and splitting it up based upon the special comment tags you place within the file.

When the helper viewer is viewing a particular topic, the HTML rendering component is only passed the raw HTML source code for the single section it should display. I.e. it doesn't get to parse/make use of the entire *.htm file at this stage, so any tags you've placed in the header etc are not present.

Another consequence of this design, is that the HTML browser control internal to the help browser looses all knowledge of where the help file is on the file system (needed for relative links in images etc to work). The HTML viewer control is just passed a pointer to a string of HTML which could have been generated in code or downloaded etc.

The system will look within the Windows Directory, because this is the default location to look when files do not specify a path, and since Windows CE does not support relative paths, it's not possible to use a path such as "..\Program Files\MyApp\Help\sample.png" for your image etc etc.

stman wrote:
Furthermore, search keywords are not found either, and I question why the search Type doesn't list my application. Do I have to chose Help as the Type I figured that would mean the system, and not my application.

Yes, if you want to search for the keywords within your help file you should select "Help" as the search type. This will search through any help file registered with the device (i.e. return results for all applications providing help files).

Hope this helps,

Christopher Fairbairn






Re: .NET Compact Framework creating help on a windows mobile 5.0

stman

I asked for insight and I got it. Mery much appreciated... thank you. I moved everything over to the Windows folder to minimize problems.

I noticed some of the installed htm files use a stylesheet called DeviceHelp.css and use classes throughout the code. And since you mentioned "the HTML rendering component is only passed the raw HTML source code for the single section it should display. I.e. it doesn't get to parse/make use of the entire *.htm file at this stage, so any tags you've placed in the header etc are not present" (sorry, don't know how to format the nice quote blockes you did), how is it that this gets used if it's in the HEAD

Should I make reference to this same stylesheet Can I be sure it will always be there It seems to me that there is some default formatting going on anyway, even with a bare bones HTML file.





Re: .NET Compact Framework creating help on a windows mobile 5.0

icefred89

This is all very timely and useful for what I am currently doing as well. Thanks.

I have my help files functioning with the htm file in the windows folder and a shortcut in the help folder.

My issue is when I install the app to a device by copying the CAB file to it via activesync, a shortcut for the help file also appears in the programs list next to the shortcut for the program itself.

VS2005 property for the help shortcut lists the folder as windows/help. Any ideas

Thanks.