Skip to main content

Past Blast

Featured Products

Windows Mobile Developer Controls
Windows Mobile Developer Controls
Stay in touch using the DEVBUSS RSS feeds.
 

News

Windows Mobile Developer Controls
Sapphire Soltuions

Part 2: Building a better world with Windows CE logo certification

Written by Carl Davis  [author's bio]  [read 34645 times]
Edited by Derek

Page 1  Page 2  Page 3 

Help, I need somebody…

I want to focus the rest of this article on working with the help system. I see a number of eVB applications that fail to integrate with TOC or end up adding their own Help button. I know I was guilty of this too, since I hadn't spent much time exploring the help system early on.

Our project this time will be a simple help file that you can use as a template for your own help files. I will also add a link to this help file to the Help TOC. This will allow users to see my application listed along side all the others when they select "Help" from the Start menu on the Today screen (Figure 3). Finally, I'll add some context sensitive help to our application. When the user selects help from the start menu and my form is active, I'll display the appropriate help information using the help viewer built into the Pocket PC.

First, let's create a help file for our application. Listing 1 shows a fairly generic HTML file. I borrowed this form from Microsoft's existing help files.

<HTML>
<HEAD>
<META HTTP-EQUIV="Htm-Help" Content="helptest.htm#Main_Contents">
<title>Playing with Help!</title>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<!-- PegHelp -->
<P><A NAME="Main_Contents"></A><B>Inbox Help</B>
<!-- CS topic for list view-->
<ul></ul><b>Concepts</b><br>
<A HREF="test.htm#one">Topic One</A><BR>
<A HREF="test.htm#two">Topic Two</A><BR>
<A HREF="test.htm#three">Topic Three</A><BR>
<P>&nbsp;<!-- PegHelp --><hr><!-- *****Topic Break**** -->
<P><A NAME="one"></A><B>Topic One</B><br>
<ul></ul>
This is topic one....
<P><B>See Also</B><BR>
<A HREF="test.htm#two">Topic Two</A><BR>
<P>&nbsp;<!-- PegHelp --><hr><!-- *****Topic Break**** -->
<P><A NAME="two"></A><B>Topic Two</B><br>
<ul></ul>
This is topic number two....
<P><B>See Also</B><BR>
<A HREF="test.htm#one">Topic one</A><BR>
<P>&nbsp;<!-- PegHelp --><hr><!-- *****Topic Break**** -->
<P><A NAME="three"></A><B>Topic Three</B><br>
<ul></ul>
This is topic number three....
<P><B>See Also</B><BR>
<A HREF="test.htm#one">Topic one</A><BR>
<P>&nbsp;<!-- PegHelp --><hr>
</BODY></HTML>

Listing 1

Each section is separated from others using the <!-- PegHelp --> comment. When the help page is displayed, only the table of contents is shown. When the user selects each link, the other sections are shown. You can find more information in the embedded tools help file.

I don't like the idea of using graphics in my help files. Images can take up valuable space on my handheld. Ideally, your application will be easy to use and people will rarely look at the help file. Also, if you allow context sensitive help, users won't need screen shots. Give them an easy to ready description of the functions on the form. So, in my mind, graphics aren't really an efficient use of space on my handheld.

With the help file completed, we need to publish a link to it. Some installation programs help with this automatically. Unfortunately the wizard included with the embedded tools doesn't. To overcome this limitation, I'll create a small routine in the program that I'll use to publish help the first time the program is called. Listing 2 shows the routine we'll add to our application.

' Publishes a link to a help file in the TOC directory.
Private Sub PublishHelp(ByVal title As String, ByVal helpFileLink As String)

Dim helpFile As String
Dim helpLink As String

' A .lnk file is place under windows\help with the name
' as it should appear in the TOC.
helpFile = "\windows\help\" + title + ".lnk"

' .lnk file contains number of characters in link, # char
' and then the link. Link can be to anywhere.
helpLink = CStr(Len(helpFileLink)) + "#" + helpFileLink

On Error Resume Next

File1.Open helpFile, fsModeOutput, fsAccessWrite, fsLockWrite
If (Err.Number > 0) Then
MsgBox "Unable to open >>" + helpFile + "<< for writing."
File1.Close
Exit Sub
End If

File1.LinePrint helpLink
If (Err.Number > 0) Then
MsgBox "Unable to print link string."
File1.Close
Exit Sub
End If

File1.Close
On Error GoTo 0

MsgBox "Wrote >>" + helpLink + "<< to link file.", vbInformation, "Success!"

End Sub

Listing 2

To add your help file to the TOC, we need to create a link file (.lnk) and save it in the help directory under the windows folder (\windows\help). The text for the link used when the TOC is displayed is simply the name of the link file. Thus for our test help file, we'll create a link file called "devBuzz Teaching Help File.lnk".

Previous Page  Next Page