the title says all.
i found that some methods are like this:
.data
calculator db "C:\WINDOWS\system32\calc.exe",0
the definetion must have absolute path, and i want to run the .chm file(the same directory as the application file) from the help topic menu, how can i do it?
thanks in advance.
http://en.wikibooks.org/wiki/Windows_Programming/Compiled_HTML_Help seems to explain how to open html help files.
Stan
Thanks Stan :U
there is still a question.
how to convert the htmlhelp.h to htmlhelp.inc?
i tried the 'h2inc' application, but it errors at line 170...
I see there's a htmlhelp.inc file in the masm include files, but that one seems a bit limited.
Sec, I'll translate it manually. (only 400 lines :wink)
Stan
Ok, here it is. Enjoy!
And correct my errors, if any.
Stan
[attachment deleted by admin]
hi stan,
thanks your kindly help. but what's the problem?
htmlhelp.lib(init.obj) : error LNK2001: unresolved external symbol __imp__RegCloseKey@4
htmlhelp.lib(init.obj) : error LNK2001: unresolved external symbol __imp__RegQueryValueExA@24
htmlhelp.lib(init.obj) : error LNK2001: unresolved external symbol __imp__RegOpenKeyExA@20
firmware.exe : fatal error LNK1120: 3 unresolved externals
NMAKE : fatal error U1077: 'C:\WINDOWS\system32\cmd.exe' : return code '0x460'
Stop.
INCLUDELIB Advapi32.lib
thanks Greg, it's ok, but there is still a question: how can i link to the help file in the current directory?
I define the help file liake this:
szHelpFile db "D:\Project\program\help.chm",0
the help menu can only be valid when the help file exists at the D:\Project\program directory. when I move the folder which contains the application and help file, the help menu is invalid. so, how can i make it move-and-run? i try to define is as:
szHelpFile db ".\help.chm",0
but it error..
Must be ..\help.chm I think.
Quote from: Eric4ever on June 02, 2006, 05:15:00 AM
thanks Greg, it's ok, but there is still a question: how can i link to the help file in the current directory?
If the help file should always be in the same folder as the running app, use:
invoke GetCurrentDirectory, (returnbufferlength), (returnbufferpointer)
Then you'll have to concatenate your "\help.chm" onto the end of whatever's returned. Make sure you check whether there's already a "\" on the end of that, I'm not sure whether the path returning API routines add it.
Ian_B
Would using GetModuleFileName be a better idea? I always use that to evaluate the .ini location of my app.
Shantanu is correct, GetCurrentDirectory does not necessarily return the directory the calling app is running from, whereas GetModuleFileName does. I found that out the hard way. :wink
local @szBuffer[128]:byte
invoke GetModuleFileName,NULL,addr @szFileName,MAX_PATH
......
the GetModuleFileName retrieves the full path and filename, what should I do the in the next step in order to prepare for the invoke of htmlhelp?
thanks in advance.
Include SHLWAPI include and library and use PathRemoveFileSpec(szPath) and PathCombine(szBuffer, szPath, szFile).
Cheers,
Zooba :U
i'm sorry, zooba, i cannot catch it.
Could you give me some examples to learn?
Or just run through the string byte-by-byte looking for either the null-byte end of string or a second "\" after the first "\" character in the drivespec ("C:\"), which is probably all the SHLWAPI stuff does anyway, and will save you a slow external API call and an include. Then simply truncate the string by adding a null-byte after the "\" if you found one, or a "\" and a null-byte if you didn't.
EDIT: forgot you are definitely getting a full file name after the path with this function. You just need code like this, definitely too minimal to waste calling SHLWAPI functions for:
lea ebx, TestPathSpec ; a buffer MAX_PATH chars in length
invoke GetModuleFileName, NULL, ebx, MAX_PATH
lea ecx, [ebx+2] ; first check pos is slash at end of C:\
test eax, eax
jz FatalPathError
@@:
mov al, [ecx]
add ecx, 1
test al, al ; is it the string end
jz @F
cmp al, "\" ; is it a path delimiter
jne @B
mov edx, ecx ; save last path delimiter found
jmp @B
@@:
mov [edx], al ; null-terminate path
sub edx, ebx ; get path length including last delimiter
Ian_B