According to the SDK the HtmlHelp command, HH_DISPLAY_TOPIC is used like this:


HWND hwnd =
HtmlHelp(
GetDesktopWindow(),
"c:\\help.chm::/intro.htm>mainwin",
HH_DISPLAY_TOPIC,
NULL) ;

Can anybody tell me how to translate "c:\\help.chm::/intro.htm>mainwin", into assembly? I want to display specific topics in the chm file.

best regards,

czDrillard
Posted on 2004-03-16 08:32:04 by czDrillard
Isn't it just a string?
Posted on 2004-03-16 08:34:21 by roticv
iirc if is a c string the \\ will be onl y one \ because of the scape characters used, like \n \t... etc. (Dunno)
Posted on 2004-03-16 08:42:25 by rea
Normally you do it this way, I have never used \\ in the filename and have not had any problems with it, but then I only use keyword lookups though it should make no difference.

invoke GetDesktopWindow

invoke HHCtrl.OCX:HtmlHelpA, eax, [pTopicString], HH_DISPLAY_TOPIC, NULL
mov [hHHwin],eax


In MASM you will need the lib from HTMLHelp workshop in order to use HTMLHelpA.

include htmlhelp.inc

includelib "\Program Files\HTML Help Workshop\lib\htmlhelp.lib"
Posted on 2004-03-16 09:07:19 by donkey
well its little bit tricky to find those urls
but it available in the properties windows
the url to my help default in my computer is
the one at (start--->help)
ms-its:C:\WINNT\Help\Ntdef.chm::/default.htm

copy paste this into a browser window and youll see the main help page

one more url to try out
ms-its:C:\WINNT\Help\concepts.chm::/whatsnew_o.htm

well the path is my path may not work for you
if it doesnt work then open a help file and right click and get properties
it will show the correct url

and yes as roticv said it is a string
so you can define it like this

useless_help db "ms-its:C:\WINNT\Help\concepts.chm::/whatsnew_o.htm",0

push offset useless_help

regards
Posted on 2004-03-16 09:13:36 by bluffer
hgb is correct.

In C, the backslash "\" character must be "escaped" by doubling it, because it is the escape character. So in MASM, the double backslash will be replaced by a single backslash.
Posted on 2004-03-16 14:25:37 by tenkey
You might try to canonicalize the string

canonicalize FRAME pString,pOutString,DoPercent

uses ebx,esi,edi
mov edi,[pOutString]
mov esi,[pString]
mov ebx,[DoPercent]

L0:
mov al,[esi]
cmp al,0
je >>.DONE

; Chars
cmp al,"a"
jb >
cmp al,"z"
jbe >.NORMAL
:
cmp al,"A"
jb >
cmp al,"Z"
jbe >.NORMAL
:
cmp al,"0"
jb >
cmp al,"9"
jbe >.NORMAL
:

; Allowed
cmp al,"-"
je >.NORMAL
cmp al,"_"
je >.NORMAL
cmp al,"."
je >.NORMAL
cmp al,"!"
je >.NORMAL
cmp al,"-"
je >.NORMAL
cmp al,"*"
je >.NORMAL
cmp al,27h
je >.NORMAL
cmp al,"("
je >.NORMAL
cmp al,")"
je >.NORMAL

; Reserved
cmp al,";"
je >.NORMAL
cmp al,"/"
je >.NORMAL
cmp al,"?"
je >.NORMAL
cmp al,":"
je >.NORMAL
cmp al,"@"
je >.NORMAL
cmp al,"&"
je >.NORMAL
cmp al,"="
je >.NORMAL
cmp al,"+"
je >.NORMAL
cmp al,"$"
je >.NORMAL
cmp al,","
je >.NORMAL

.REPLACE
cmp al,"%"
jne >
or ebx,ebx
jz >.NORMAL
:
movzx edx,al
invoke wsprintf,edi,"%%%0.2X",edx
add esp,12
add edi,3
inc esi
jmp <<L0

.NORMAL
movsb
jmp <<L0

.DONE
mov B[edi],0
ret
ENDF
Posted on 2004-03-16 14:35:46 by donkey
What does "canonicalize" mean? I suppose it doesn't mean "turn something into a canon"?
Posted on 2004-03-16 16:13:39 by Sir Fartsalot
Canonical means "conforming to recognized rules". It is a word that derives from the "canons" of the church.
Posted on 2004-03-16 19:51:48 by donkey
First, thanks for all the replies, second none seem to work.
I tries pasting ms-its with full path and name of the page I wanted to display in my browser and got The page cannot be displayed message.

I tried declaring the same thing as a string and using a pointer to it in my program and got the same message.

Is it even possible to display a specific topic page in HtmlHelp using MASM?

btw, what does :: mean in C

best regards,

czDrillard
Posted on 2004-03-17 08:49:34 by czDrillard
Hi czDrillard,

I am not sure what your doing but it is a fairly simple thing. Like I said I have never needed to use \\ in the file name or any tricks like that....

invoke GetDesktopWindow

mov ebx,eax
invoke HHCtrl.OCX:HtmlHelpA, ebx, "C:\WINNT\Help\printing.chm", HH_DISPLAY_TOPIC, \
"print_print_document.htm"


Would be how to display the Printing a document topic from windows help, the URL displayed when you right click on the page is:

C:\WINNT\Help\printing.chm::/print_print_document.htm
Posted on 2004-03-17 09:34:28 by donkey
useless_help db "ms-its:C:\WINNT\Help\concepts.chm::/whatsnew_o.htm",0


i dunno why this does not work for you it worked for me when i tried it

did you find any *.chm file and right to find its properties
it will show you an url and its the path (yes it is the path) to that specific page in the whole of help file

it is like you type a string for CreateFile (*,*,"c:\my useless progs\my useless apps\my useless aplication.exe")

and once you define it as

my_help_string db "ms-its:C:\WINNT\Help\concepts.chm::/whatsnew_o.htm",0

or what_ever_you_feel_like_naming_it db "******",0

then you should be able to access it

;(
Posted on 2004-03-17 11:57:04 by bluffer
:: is the scope resolution operator.

\\ is translated to \ at compile time by the C compiler. During actual runtime, the string only contains one backslash.
Posted on 2004-03-17 20:12:07 by iblis
I know this should be a simple thing to do but nothing works:(

I tried your suggestion, Donkey, using invoke HHCtrl.OCX:HtmlHelpA... this causes assembly error: undefined symbol HHCtrl. Strange because both htmlhelp.inc and htmlhelp.lib are included.

Btw, I'm using windows 98 but that shouldn't matter.

Any help appreciated.

best regards,

czDrillard
Posted on 2004-03-18 21:31:15 by czDrillard

I know this should be a simple thing to do but nothing works:(

I tried your suggestion, Donkey, using invoke HHCtrl.OCX:HtmlHelpA... this causes assembly error: undefined symbol HHCtrl. Strange because both htmlhelp.inc and htmlhelp.lib are included.

Btw, I'm using windows 98 but that shouldn't matter.

Any help appreciated.

best regards,

czDrillard


Sorry, I use GoAsm, it doesn't work that way in MASM. As I said above, in MASM you need import libraries. Make sure you use the import lib that comes with HTMLHelp workshop not the one with MASM32 ! The HHCtrl.ocx is used by GoAsm to specify exactly which library to search for the function, it is not needed as the LIB does that in MASM.

include htmlhelp.inc

includelib "C:\Program Files\HTML Help Workshop\lib\htmlhelp.lib"

invoke HtmlHelpA,.....
Posted on 2004-03-18 21:38:08 by donkey
Finally! got it working:alright:

After spending most of the week thus flunking my chem test I found that the topic path was wrong.

In HtmlHelp topic files list all topic files are appended with Html\. So to open page SpecificHelpPage.htm you must point to Html\SpecificHelpPage.htm

Edit: Not to mislead I should say that Html\ is the path to the htm files used when HtmlHelp file is compiled. It could be named something else.

Thanks everybody for all the help and best regards,

czDrillard
Posted on 2004-03-20 11:54:29 by czDrillard