PropertyPage custom help file

S

Sunny

Hi,
I have VS.Net 2003 C# addin for Outlook 2000.

Works OK, after a lot of troubles, I have made a custom property page to
work. But I can not make Outlook to invoke my help.chm file for that
page.

I'm setting the HelpFile parameter with full path to my help.chm in
GetPageInfo method, but no result :(

It just discards F1 button.

Any help?

Cheers
Sunny
 
K

Ken Slovak - [MVP - Outlook]

I don't know if this helps because I don't use C#, but in a VB 6 property
page I set both HelpFile and HelpContext. I also include the declarations
for help in a code module and initialize the settings.

' in a code module
Declare Function HtmlHelp Lib "hhctrl.ocx" Alias "HtmlHelpA" _
(ByVal hwndCaller As Long, ByVal pszFile As String, _
ByVal uCommand As Long, ByVal dwData As Long) As Long

Public Const HH_DISPLAY_TOPIC = &H0
Public Const HH_SET_WIN_TYPE = &H4
Public Const HH_GET_WIN_TYPE = &H5
Public Const HH_GET_WIN_HANDLE = &H6
Public Const HH_DISPLAY_TEXT_POPUP = &HE ' Display string resource ID or
text in a pop-up window.
Public Const HH_HELP_CONTEXT = &HF ' Display mapped numeric value in
dwData.
Public Const HH_TP_HELP_CONTEXTMENU = &H10 ' Text pop-up help, similar to
WinHelp's HELP_CONTEXTMENU.
Public Const HH_TP_HELP_WM_HELP = &H11 ' text pop-up help, similar to
WinHelp's HELP_WM_HELP


'GetPageInfo method
Private Sub PropertyPage_GetPageInfo(HelpFile As String, HelpContext As
Long)
On Error Resume Next

'Call help here
HelpFile = g_strWinDir
HelpContext = 1070
End Sub

'in my initialization calls
g_strWinDir = basRegistryPP.GetWinDir 'call registry function to find
"Windows" folder
g_strWinDir = g_strWinDir & "\help\remindermanager.chm"
App.HelpFile = g_strWinDir
 
S

Sunny

Hi Ken, thanks for the input. Some questions inline:

I don't know if this helps because I don't use C#, but in a VB 6 property
page I set both HelpFile and HelpContext. I also include the declarations
for help in a code module and initialize the settings.

' in a code module
Declare Function HtmlHelp Lib "hhctrl.ocx" Alias "HtmlHelpA" _
(ByVal hwndCaller As Long, ByVal pszFile As String, _
ByVal uCommand As Long, ByVal dwData As Long) As Long

I've never done COM/ActiveX VB programing, so, what is a code module.
I.e. where exactly you put that function? And where from you call it?
'in my initialization calls
g_strWinDir = basRegistryPP.GetWinDir 'call registry function to find
"Windows" folder
g_strWinDir = g_strWinDir & "\help\remindermanager.chm"
App.HelpFile = g_strWinDir

Where you put that initialization calls. And what is "App" ?

I guess I can do the interop call to that .ocx, but I do not know where
and when.

Thanks again for your help.

Sunny
 
K

Ken Slovak - [MVP - Outlook]

A code module is a place that stores code that is accessible to the entire
program. For a C-like language I suppose it could be a header file or any
place else you can declare various constants and reference the Help library
OCX.

App is the application (COM addin) in VB code. That has a property called
HelpFile. I have no idea what C# provides for that. I call the
initialization code when my addin starts up, in the InitHandler class that
is called from the On_Connection event handler.

That is how it's done in COM programming. Using the Interop I have no idea
what equivalent functions are provided. See if there's any information about
this for .NET languages at
http://www.microeye.com/resources/res_outlookvsnet.htm
 
S

Sunny

Hi Ken,
pls, read inline:

A code module is a place that stores code that is accessible to the entire
program. For a C-like language I suppose it could be a header file or any
place else you can declare various constants and reference the Help library
OCX.
Ok, I've got the idea. I know where to place this. And I know how to get
reference to that function in the .ocx file. The only confusion is, that
I can not see where from you call this HtmlHelp function in your code.
App is the application (COM addin) in VB code. That has a property called
HelpFile. I have no idea what C# provides for that. I call the
initialization code when my addin starts up, in the InitHandler class that
is called from the On_Connection event handler.

I can not see COMAddIn class to have HelpFile property. I do not see it
for the Application object as well. Some more help to find it?
That is how it's done in COM programming. Using the Interop I have no idea
what equivalent functions are provided. See if there's any information about
this for .NET languages at
http://www.microeye.com/resources/res_outlookvsnet.htm

I can not find anything related there. But with interop theoretically :)
there should be a way to repeat anything from the COM world. So if I
know exactly how it is done in VB, maybe I can repeat it in C#.

Please, if you have a very sample addin, which just creates a very
simple property page with a help, please, send me the VB code, so I can
take a look. If you do not want to post in the group, use:
sunnyXicebergwirelessOcom. Replace X with @ and O with "."

Thanks again
Sunny
 
K

Ken Slovak - [MVP - Outlook]

I don't call the HTMLHelp function. Once I set App.HelpFile to the help file
name and path it's automatically called when PropertyPage_GetPageInfo is
called. I just set HelpFile and HelpContext in that event handler. That
might be what you have to do in your code. The way I'm doing it calls Help
when F1 is used in the property page.

There's not a lot of code, and everything I do was shown earlier in the
thread, but I'll repeat it here:

' in code module for initializations
Dim g_strWinDir As String

g_strWinDir = basRegistryPP.GetWinDir 'call to get Windows folder from
Win32 API
g_strWinDir = g_strWinDir & "\help\remindermanager.chm"
App.HelpFile = g_strWinDir 'this is VB specific and App refers to the COM
addin DLL

' in property page
Private Sub PropertyPage_GetPageInfo(HelpFile As String, HelpContext As
Long)
On Error Resume Next
'Call help here
HelpFile = g_strWinDir
HelpContext = 1070
End Sub

'in code module so consts and function declaration are public
'HTML Help API
Declare Function HtmlHelp Lib "hhctrl.ocx" Alias "HtmlHelpA" _
(ByVal hwndCaller As Long, ByVal pszFile As String, _
ByVal uCommand As Long, ByVal dwData As Long) As Long

Public Const HH_DISPLAY_TOPIC = &H0
Public Const HH_SET_WIN_TYPE = &H4
Public Const HH_GET_WIN_TYPE = &H5
Public Const HH_GET_WIN_HANDLE = &H6
Public Const HH_DISPLAY_TEXT_POPUP = &HE ' Display string resource ID or
text in a pop-up window.
Public Const HH_HELP_CONTEXT = &HF ' Display mapped numeric value in
dwData.
Public Const HH_TP_HELP_CONTEXTMENU = &H10 ' Text pop-up help, similar to
WinHelp's HELP_CONTEXTMENU.
Public Const HH_TP_HELP_WM_HELP = &H11 ' text pop-up help, similar to
WinHelp's HELP_WM_HELP

If this doesn't help you might have more luck posting in an HTML Help
newsgroup.
 
S

Sunny

Hi Ken,

App.HelpFile = g_strWinDir 'this is VB specific and App refers to the COM
addin DLL

' in property page
Private Sub PropertyPage_GetPageInfo(HelpFile As String, HelpContext As
Long)
On Error Resume Next
'Call help here
HelpFile = g_strWinDir
HelpContext = 1070
End Sub


Thanks again for the info.

I guess that "this is VB specific and App refers to the COM addin DLL"
means that the ActiveX control, created by you should handle the Help
system.
Than here are my 2 new :) questions:

1. What means 1070?

And,

2. What happens if you specify "" (empty string) as a filename in the
GetPageInfo function? I ask this, just to see if I'm on the right track
understanding who handles the F1 key - Outlook or your ActiveX by itself
(because of all these settings and the App object).

Cheers and have a nice weekend
Sunny
 
K

Ken Slovak - [MVP - Outlook]

1070 is the context ID I assigned to that Help page and the ActiveX control
that provides the property page. The help calls come to the property page
and are handled there.

I have no idea what happens if you supply a null string for the help file
name, probably an error or Outlook Help would be displayed or a blank help
window.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top