PDA

View Full Version : Using foxitreader_ax.ocx with BCB6 crashes.


deathaxe
September 9th, 2007, 03:41 AM
Hello guys,

I need PDF ability in my application in order to display help information. As I like Foxit Reader very much for its speed I wanted to use it in my application too.

I am using Borland C++ Builder 6. Using the "Import ActiveX" function from its main menu I installed the foxitreader activex control as a package. When adding the new component to a TForm object it is shown correctly, but as soon as I try to call OpenFile(...) from the source code, the operation fails with an access violation.

I compared the examples for foxit's api with the imported library code. Doing so I realized the following:
While strings in api examples are ANSI, Borland C++ Builder's import library uses UNICODE parameters.

May this be the reason?

Can anybody help me with this problem, pleeaaase?


My using code is:

Boolean TAlertHelp::OpenPdf(TWinControl* AOwner, const WideString& HelpFile)
{
...
FPdf = new TPdf(AOwner);
FPdf->Align = alClient;
FPdf->Parent = AOwner;
FPdf->Visible = True;
#ifdef ACROBAT_PDF
FPdf->src = HelpFile;
FPdf->setShowToolbar(False);
#else
FPdf->OpenFile(HelpFile, L""); // this is the crash causing line
FPdf->ShowTitleBar(False);
FPdf->ShowToolBar(False);
#endif
...
}

william
September 23rd, 2007, 07:32 PM
Hi Deathaxe,

Our developer has tested the OpenFile method under Unicode and found no problem.
Are you sure that you have configured your compiler to fully use Unicode?

deathaxe
September 26th, 2007, 05:31 AM
Hmm, :1_07: ... is there an option for the compiler in borland c++ builder 6? I am using Tnt Delphi Controls to make my whole application unicode enabled.
The unicode using foxit classes were generated by borland automatically, so I was sure it handles them correctly using unicode strings for parameters. Putting the _UNICODE definition into the project's options page does not solve the problem. As I did not install any service packs for c++ builder (they are no longer available for german versions) and you proofed your library to work, I am sure the prolbem is caused by ****f...g borland itself. Which version of cüü builder did your tester use?

Dunno118
November 27th, 2007, 05:14 AM
I installed it as a standard Active X control using the Import ActiveX control.

PDFView->OpenFile((WideString)s, WideString(""));

All of the other functions work as expected. Trying to write to the Read only properties of the control will cause it to crash though.

william
January 15th, 2008, 06:10 PM
Hi Dunno118,

Your program should not write to Read only properties.