Extract Pages Dialog From Thumbnail Context View Menu

PDF-XChange Viewer SDK for Developer's
(ActiveX and Simple DLL Versions)

Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange

dconner
User
Posts: 28
Joined: Fri Feb 07, 2014 10:27 pm

Extract Pages Dialog From Thumbnail Context View Menu

Post by dconner »

Hi Guys,

When you right-click over the thumbnails in and select "extract pages..." from the pop-up context view, is it possible to trap the dialog and show your own form instead?

If not by your code then, is it okay to just trap the created form, using windows messages, to force it closed, and then show a custom form instead?


Thanks,

Dave
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2445
Joined: Thu Jun 30, 2005 4:11 pm

Re: Extract Pages Dialog From Thumbnail Context View Menu

Post by Vasyl - PDF-XChange »

Hi, Dave.

Sorry but not easy way for that. You may replace existing context menu by your own by intercepting the notify:

Code: Select all

OnEvent(type, name.. )
{
      if (type == PXCVA_OnNamedNotify AND name == "Notifications.ContextMenu")
      {
           string menuName;
           pdfViewer.GetProperty("Notifications.ContextMenu", out menuName, 0);
           if (menuName == "Thumbnails")
           {
                 menu = CreateMenu(menuItems);
                 int id = TrackPopupMenu(menu, ReturnCmd=true); 
                 if (id == 0)
                   return;
                 if (id == 36038) // extract pages
                 {     
                      // show your own dialog, setup params in "Operations.ExtractPages" location and execute ''ExtractPages" operation with NoUI flag
                      id = -1; // to prevent default processing
                 }
                 pdfViewer.SetProperty("Notifications.ContextMenu.UserChoice", id, 0); // to continue default processing
           }
      }
}

int menuItems[] =
{
     36037, // Insert Pages...
     36038, // Extract Pages...
     36038, // Extract Pages...
     36039, // Replace Pages..
     33081, // Delete Pages..
     0, // separator
     33080, // Rotate Pages..
     33082, // Crop Pages...
     0, // sep
     57607, // Print..
     32945, // Export to Images..
     0, // sep
     33413, // Zoom In
     33414, // Zoom Out
     0, // sep
     36548, // Highlight Visible Area
     36549, // Interactive Highlighted Area
     0, // sep
     33003, // Properties...
};
HTH.
PDF-XChange Co. LTD (Project Developer)

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
dconner
User
Posts: 28
Joined: Fri Feb 07, 2014 10:27 pm

Re: Extract Pages Dialog From Thumbnail Context View Menu

Post by dconner »

Hey guys, I tried it out in C# and this is what I got:

private void axCoPDFXCview2_OnEvent(object sender,
AxPDFXCviewAxLib._IPDFXCviewEvents_OnEventEvent e)
{
if (e.name == "Notifications.ContextMenu")
{
object menuName;
axCoPDFXCview2.GetProperty("Notifications.ContextMenu", out menuName, 0);
if (menuName != null)
{
logger.log("Event: " + e.name + "," + e.type.ToString() + "," + e.flags.ToString() + "," + menuName.ToString());
if ((string)menuName == "Thumbnails")
{
.............................


This is the logger output from the event:

8/18/2014 2:37:20 PM : Event: Notifications.ContextMenu,4,0,0

However, I noticed menuName is always "0", no matter which context menu I triggered (on the form or the thumbnail view).

Any ideas?


Thanks
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2445
Joined: Thu Jun 30, 2005 4:11 pm

Re: Extract Pages Dialog From Thumbnail Context View Menu

Post by Vasyl - PDF-XChange »

Sorry, I mistaken slightly. Should be:

axCoPDFXCview2.GetProperty("Notifications.ContextMenu.MenuName", out menuName, 0);
PDF-XChange Co. LTD (Project Developer)

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
dconner
User
Posts: 28
Joined: Fri Feb 07, 2014 10:27 pm

Re: Extract Pages Dialog From Thumbnail Context View Menu

Post by dconner »

I got it now!

Change:

axCoPDFXCview2.GetProperty("Notifications.ContextMenu", out menuName, 0);

To:

axCoPDFXCview2.GetProperty("Notifications.ContextMenu.MenuName", out menuName, 0);


Thanks for your help guys.
dconner
User
Posts: 28
Joined: Fri Feb 07, 2014 10:27 pm

Re: Extract Pages Dialog From Thumbnail Context View Menu

Post by dconner »

Missed your post!

:-)
User avatar
John - Tracker Supp
Site Admin
Posts: 5223
Joined: Tue Jun 29, 2004 10:34 am

Re: Extract Pages Dialog From Thumbnail Context View Menu

Post by John - Tracker Supp »

:)
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.

Best regards
Tracker Support
http://www.tracker-software.com