Opening documents using op.openDoc - handle error + display "cannot open the document" dialog ...  SOLVED

PDF-XChange Editor SDK for Developers

Moderators: TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan

Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.

When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
Post Reply
zarkogajic
User
Posts: 1372
Joined: Thu Sep 05, 2019 12:35 pm

Opening documents using op.openDoc - handle error + display "cannot open the document" dialog ...

Post by zarkogajic »

Hi support,

Attempting to open, for example, a ZIP file with the EU Editor, the following dialog appears:

image.png

I'm opening document from code using "op.openDoc" operation.

When a document cannot be opened the IOperation's Do method will raise an OLE Exception with some Hresult.

[Q1] How can I display the above dialog when the Do method fails?

[Q2] What is the Hresult error raised ("82190003" is the value) - is it any of standard OLE return values or system error codes?

-žarko
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Opening documents using op.openDoc - handle error + display "cannot open the document" dialog ...

Post by Sasha - Tracker Dev Team »

Hello žarko,

As for the question 2 - you can read the forum rules and there would be a method with the help of which you can get the error description string.
As for the dialog - that is a simple message box that is shown by using the https://sdkhelp.pdf-xchange.com/vi ... ShowMsgBox method.
The IDs of the strings are msg.OpenDocError.Text for text, and you should specify the file name in place of the %1. As for the title - the ID is msg.OpenDocError.Hdr.
The styles are UIX_MsgBox_IconError | UIX_MsgBox_AppModal | UIX_MsgBox_StdButtonsAsCommands and UIX_MsgBox_IgnoreCancel or UIX_MsgBox_Close for buttons.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
zarkogajic
User
Posts: 1372
Joined: Thu Sep 05, 2019 12:35 pm

Re: Opening documents using op.openDoc - handle error + display "cannot open the document" dialog ...

Post by zarkogajic »

Great, thanks Alex!

zarkogajic
User
Posts: 1372
Joined: Thu Sep 05, 2019 12:35 pm

Re: Opening documents using op.openDoc - handle error + display "cannot open the document" dialog ...

Post by zarkogajic »

Alex,

How do I go from "msg.OpenDocError.Hdr" to the actual string?

Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Opening documents using op.openDoc - handle error + display "cannot open the document" dialog ...  SOLVED

Post by Sasha - Tracker Dev Team »

Hello žarko,

This method gives the localized string:
https://sdkhelp.pdf-xchange.com/vi ... etLocalStr

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Post Reply