Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: 64-bit vcl.HtmlHelpViewer error when Linking with runtime package = false



Permlink Replies: 4 - Last Post: Jan 1, 2015 5:05 AM Last Post By: Dale Chant
sverker johansson

Posts: 12
Registered: 9/28/08
64-bit vcl.HtmlHelpViewer error when Linking with runtime package = false
Click to report abuse...   Click to reply to this thread Reply
  Posted: Dec 23, 2014 12:32 PM
Problem with vcl.HtmlHelpViewer under 64-bit
I use C++Builder EX7, Windows 8.1 64-bit

My test program looks like (64-bit Windows)

//---------------------------------------------------------------------------
#include "vcl.HTMLHelpViewer.hpp"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "vcl.HTMLHelpViewer"
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
char exeFileName[2000];
exeFileName[0]= 0
HINSTANCE hhA = NULL; // "
GetModuleFileNameA( hhA, exeFileName, 2000);
char *p;
p = strrchr(exeFileName, '
');
if(p)
{
*(p+1) = 0x00;
}

AnsiString astHelpTxtName = exeFileName;
astHelpTxtName += "CpPpXBarR_Graphic.chm";

if(FileExists(astHelpTxtName))
HelpFile = astHelpTxtName;

}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
Application->HelpContext(10);

}

If I compile it with Package option:
Linking with runtime package = true
The help work fine but if I sets the option to false I get the error message:
"File
CpPpXBarR_Graphic.chm is not a Windows help filer or is the file damaged"


Sverker

Edited by: sverker johansson on Dec 27, 2014 11:17 AM

Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: 64-bit vcl.HtmlHelpViewer error when Linking with runtime package =false
Click to report abuse...   Click to reply to this thread Reply
  Posted: Dec 23, 2014 12:50 PM   in response to: sverker johansson in response to: sverker johansson
sverker wrote:

My test program looks like (64-bit Windows)

Why are you handling the help filename using Ansi instead of Unicode? Like
everything else in the RTL/VCL, the HelpFile property uses Unicode since
CB2009 onward.

You can also simply your string handling by letting the RTL do the work for
you.

Try this:

__fastcall TForm1::TForm1(TComponent* Owner)
    : TForm(Owner)
{
    String HelpTxtName = ExtractFilePath(Application->ExeName) + L"CpPpXBarR_Graphic.chm";
    if (FileExists(HelpTxtName))
        HelpFile = HelpTxtName; // alternatively: Application->HelpFile = 
HelpTxtName;
}


--
Remy Lebeau (TeamB)
sverker johansson

Posts: 12
Registered: 9/28/08
Re: 64-bit vcl.HtmlHelpViewer error when Linking with runtime package =false
Click to report abuse...   Click to reply to this thread Reply
  Posted: Dec 24, 2014 1:40 AM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
Remy Lebeau (TeamB) wrote:
sverker wrote:

My test program looks like (64-bit Windows)

Why are you handling the help filename using Ansi instead of Unicode? Like
everything else in the RTL/VCL, the HelpFile property uses Unicode since
CB2009 onward.

You can also simply your string handling by letting the RTL do the work for
you.

Try this:

__fastcall TForm1::TForm1(TComponent* Owner)
    : TForm(Owner)
{
    String HelpTxtName = ExtractFilePath(Application->ExeName) + L"CpPpXBarR_Graphic.chm";
    if (FileExists(HelpTxtName))
        HelpFile = HelpTxtName; // alternatively: Application->HelpFile = 
HelpTxtName;
}


--
Remy Lebeau (TeamB)

Thanks but
Sorry I get the same bad result if the Runtime Package: Link with runtime packages = false for the 64-bit project.
/Sverker
Dale Chant

Posts: 13
Registered: 4/6/08
Re: 64-bit vcl.HtmlHelpViewer error when Linking with runtime package = false
Click to report abuse...   Click to reply to this thread Reply
  Posted: Dec 29, 2014 10:44 PM   in response to: sverker johansson in response to: sverker johansson
I have a similar problem. A default VCL Form application with a button handler as

#include <vcl.h>
#pragma hdrstop

#include "Unit1.h"
//---------------------------------------------------------------------------

#include "vcl.HTMLHelpViewer.hpp"
#pragma package(smart_init)
#pragma link "vcl.HTMLHelpViewer"
#pragma resource "*.dfm"

TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1:TForm1(TComponent* Owner)
: TForm(Owner)
{
}
void __fastcall TForm1::Button1Click(TObject *Sender)
{
Application->HelpFile = L"C:
Docs
MyHelpFile.chm";
Application->HelpContext(437);
}

1. Works OK as win32 compile - topic 437 appears
2. Prompts as "Why can't I get Help from this program" if win64 compile and Link with runtime packages false (system is looking for a *.hlp)
3. Fails with "Project has stopped working. Windows is looking for a solution" if win64 compile and Link with runtime packages true.

For #3, the CHM frame window appears, but with no content. Then I crash.
Dale Chant

Posts: 13
Registered: 4/6/08
Re: 64-bit vcl.HtmlHelpViewer error when Linking with runtime package = false
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 1, 2015 4:58 AM   in response to: Dale Chant in response to: Dale Chant
For what it's worth, I've resorted to this as a work-around:

PROCESS_INFORMATION pi;
STARTUPINFOW si={sizeof(si)};
CreateProcessW(NULL, L"hh.exe -mapid <ID> <path to CHM>", NULL, NULL, false, 0, NULL, NULL, &si, &pi);

where <ID> is the context topic ID as integer, and <path to CHM> is the full path and CHM file name.
At least it actually works.

Edited by: Dale Chant on Jan 1, 2015 5:04 AM
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02