🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.nativeapi
8 messages
8 total messages Started by Analian Fri, 26 May 2006 09:11
Using CHM files in BCB6
#3545
Author: Analian
Date: Fri, 26 May 2006 09:11
42 lines
2354 bytes
Since there isn't a native support for .chm files in BCB6, I did some search 
in google groups about doing it and finally I ended with a piece of code 
like this:

bool TForm1::DisplayHelp(void)  {
    AnsiString HelpFile = "a.chm";

    RunProgram(HelpFile, "");
}
//--------------------------------------------------------------------------

bool TForm1::RunProgram(AnsiString Name, AnsiString Parameters)  {
    SHELLEXECUTEINFO execinfo ;

    memset (&execinfo, 0, sizeof (execinfo)) ;
    execinfo.cbSize = sizeof (execinfo) ;
    execinfo.lpVerb = "open" ;
    execinfo.lpFile = Name.c_str () ;
    execinfo.lpParameters = Parameters.c_str () ;
    execinfo.fMask = SEE_MASK_NOCLOSEPROCESS ;
    execinfo.nShow = SW_SHOWDEFAULT ;

    ShellExecuteEx(&execinfo);
}
//--------------------------------------------------------------------------

That's okay, it displays the .chm file but I'd like to do two things more, 
which I didn't figure how to do:

1) Since the .chm file is organized in pages (chapters maybe, not sure what 
the word is), I'd like to be able to programatically open it at a specific 
page (say, "Welcome").
With .hlp files I used HelpJump to do that but I can't do it with .chm 
files.
So how do I do it?

2) How to make sure only one instance of this .chm file is actually run?
Writing to the registry comes in mind, but is there a more clever way to do 
it?

Thank you,
Analian 
Re: Using CHM files in BCB6
#3547
Author: JD
Date: Fri, 26 May 2006 17:51
16 lines
1198 bytes
"Analian" <analian@mail.bg> wrote:
>
> Since there isn't a native support for .chm files in BCB6, I
> did some search in google groups about doing it and finally
> I ended with a piece of code like this:

I would suggest that you *not* try to manage it yourself. Use
this instead:

    http://www.helpware.net/downloads/

It's quite reliable and one of a very few 3rd party components
that we use.

~ JD
Re: Using CHM files in BCB6
#3548
Author: Remy Lebeau (TeamB)
Date: Fri, 26 May 2006 18:00
20 lines
1677 bytes
"Analian" <analian@mail.bg> wrote in message
news:4476c656$1@newsgroups.borland.com...

> Since there isn't a native support for .chm files in BCB6

Actually, there is, in a way.  BCB6 was the first version to implement a new
plugin architecture for the VCL's Help system.  There is an
ICustomHelpViewer interface that you can derive from to support any Help
technology you want.  There is a whole chapter in the VCL documentation that
explains how to use ICustomHelpViewer, and the RegisterViewer() function.

The VCL ships with a default ICustomHelperViewer implementation that uses
WinHelp.  There are several third-party HTMLHelp implementations available,
or you can write your own.  Sample code has been posted several times
before, which you can search for in the newsgroup archives at
http://www.deja.com.


Gambit
Re: Using CHM files in BCB6
#3550
Author: JF Jolin
Date: Fri, 26 May 2006 20:50
31 lines
2037 bytes
> That's okay, it displays the .chm file but I'd like to do two things more, which I didn't figure how to do:
>
> 1) Since the .chm file is organized in pages (chapters maybe, not sure what the word is), I'd like to be able to
> programatically open it at a specific page (say, "Welcome").
> With .hlp files I used HelpJump to do that but I can't do it with .chm files.
> So how do I do it?

execinfo.lpFile = "hh.exe";                    // Executable in \WINDOWS\system32 for Html Help
AnsiString HelpFile = "a.chm::/topic.htm";     // topic.htm is a topic inside a.chm

for more info
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/htmlhelp/html/vsconhtlink6.asp


> 2) How to make sure only one instance of this .chm file is actually run?
> Writing to the registry comes in mind, but is there a more clever way to do it?


::FindWindow(NULL, "My title help");           // returns not NULL if that help title is already open

more info on a similar topic: Prevent multiple instances of the program from running

http://web.archive.org/web/20030626080800/www.bcbdev.com/faqs/faq74.htm


That should do it.

Your welcome !

-- 
JF Jolin
Re: Using CHM files in BCB6
#3555
Author: Analian
Date: Sat, 27 May 2006 11:22
37 lines
2382 bytes
> execinfo.lpFile = "hh.exe";                    // Executable in 
> \WINDOWS\system32 for Html Help
Actually I've got a \WINDOWS\hh.exe, rather than \WINDOWS\system32\hh.exe

So you say to
    execinfo.lpFile = "hh.exe";
but with
> AnsiString HelpFile = "a.chm::/topic.htm";     // topic.htm is a topic 
> inside a.chm
I actually do
    execinfo.lpFile = "a.chm::/topic.htm";
I don't understand what do you mean here.

I tried
execinfo.lpFile = "a.chm::/topic.htm";
where topic.htm exists in my a.chm, which I've compiled with HelpMaker and 
manually checked that topic.htm exists,
but when I ShellExecuteEx with this execinfo I get
"Windows cannot access the specified device, path, or file. You may not have 
the appropriate permissions to access the item"
which isn't good.

> for more info
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/htmlhelp/html/vsconhtlink6.asp

I checked this out, but I couldn't find the mentioned 'execfile' macro 
there, neither compile it.
Maybe I'm missing a header file?

> ::FindWindow(NULL, "My title help");           // returns not NULL if that 
> help title is already open
This works fine, thanks.

> http://web.archive.org/web/20030626080800/www.bcbdev.com/faqs/faq74.htm
I couldn't browse to this link, "Error 400 Bad request".

Analian
Re: Using CHM files in BCB6
#3558
Author: Bob Gonder
Date: Sat, 27 May 2006 16:15
15 lines
1447 bytes
Analian wrote:

>I actually do
>    execinfo.lpFile = "a.chm::/topic.htm";
>I don't understand what do you mean here.

hh.exe is the executable you want to run. Place it in lpFile

"a.chm::/topic.htm" is the file you want hh.exe to act upon, place it
in lpParameters.

>"Windows cannot access the specified device, path, or file. You may not have 
>the appropriate permissions to access the item"

It has been mentioned recently that "a.chm" must be local.
Re: Using CHM files in BCB6
#3557
Author: JF Jolin
Date: Sat, 27 May 2006 20:14
76 lines
3560 bytes
>> execinfo.lpFile = "hh.exe";                    // Executable in \WINDOWS\system32 for Html Help
> Actually I've got a \WINDOWS\hh.exe, rather than \WINDOWS\system32\hh.exe
>
> So you say to
> execinfo.lpFile = "hh.exe";
> but with
>> AnsiString HelpFile = "a.chm::/topic.htm";     // topic.htm is a topic inside a.chm
> I actually do
> execinfo.lpFile = "a.chm::/topic.htm";
> I don't understand what do you mean here.

When you go like this: execinfo.lpFile = "a.chm"
The executable is chosen by the mean of the extension of the file.
Which is also the very last portion of the string.

When you go like this: execinfo.lpFile = "hh.exe"
The executable is forced to be hh.exe
And it must be on the path (environment variable (Path) ).
Otherwise specify the full access:  execinfo.lpFile = "c:\\somewhere\\hh.exe"

From here we can control the exact parameter we want to pass to hh.exe
Which is: execinfo.lpParameters = "a.chm::/topic.htm"

> I tried
> execinfo.lpFile = "a.chm::/topic.htm";

windows is confused about what/how to launch

> where topic.htm exists in my a.chm, which I've compiled with HelpMaker and manually checked that topic.htm exists,
> but when I ShellExecuteEx with this execinfo I get
> "Windows cannot access the specified device, path, or file. You may not have the appropriate permissions to access the item"
> which isn't good.

I forgot to mention. a.chm and topic.htm must be
present in the directory: execinfo.lpDirectory
Even if topic.htm is already included in a.chm

If you want to use only a.chm
Here is how to do it.
a.chm must contain a valid map ID.

Look in Html Maker under Test-HtmlHelp-API
with HH_HELP_CONTEXT an 10000 (could be an other number)
When you have a successfull test there.

Make a test with a Dos prompt like
hh.exe -mapid 10000 a.chm

And finally replace: execinfo.lpParameters = "a.chm::/topic.htm"
with:                execinfo.lpParameters = "-mapid 10000 a.chm"


>> for more info
>> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/htmlhelp/html/vsconhtlink6.asp
>
> I checked this out, but I couldn't find the mentioned 'execfile' macro there, neither compile it.
> Maybe I'm missing a header file?

The execfile macro is used with Office 2000 applications.
And have the same behavior as ShellExecute.

>> ::FindWindow(NULL, "My title help");           // returns not NULL if that help title is already open
> This works fine, thanks.

good

>> http://web.archive.org/web/20030626080800/www.bcbdev.com/faqs/faq74.htm
> I couldn't browse to this link, "Error 400 Bad request".
>

Sometime I can access it. Sometime I cannot.

Good day

-- 
JF Jolin
Re: Using CHM files in BCB6
#3565
Author: JF Jolin
Date: Mon, 29 May 2006 18:02
10 lines
1202 bytes
> I forgot to mention. a.chm and topic.htm must be
> present in the directory: execinfo.lpDirectory
> Even if topic.htm is already included in a.chm

I posted too fast.
There is no need for duplication.
a.chm alone is sufficient.

-- 
JF Jolin
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads