Enable just CTRL-C keyboard for copy

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
asamrith@gmail.com
User
Posts: 91
Joined: Fri Sep 16, 2016 12:03 am

Enable just CTRL-C keyboard for copy

Post by asamrith@gmail.com »

I've disabled all shortcuts but now I only want CTRL-C on for users. Is there a quick way to just allow only CTRL-C keyboard shortcut to work? Thanks
asamrith@gmail.com
User
Posts: 91
Joined: Fri Sep 16, 2016 12:03 am

Re: Enable just CTRL-C keyboard for copy

Post by asamrith@gmail.com »

How do I implement below in the pdf-xchange editor sdk to allow the copy shortcut?
SetProperty("Commands["Copy"].Shortcut.Use", "true"|"false", 0);
viewtopic.php?f=36&t=6725&p=30816&hilit ... cut#p30816
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Enable just CTRL-C keyboard for copy

Post by Sasha - Tracker Dev Team »

Hello asamrith@gmail.com,

From what I see from your previous posts, you have used the LockAccels method. If so, then the way would be to unlock the accels before the command execution and lock them afterwards. For this, you can implement a custom events handler for the needed views (PagesView, BookmarksView etc.). Here's a sample for this one:
https://gist.github.com/Polaringu/648a34daff6bd284a773
The two methods that interest you are OnPostEvent and OnPreEvent. Basically you should listen to the WM_KEYDOWN/WM_KEYUP events (not exactly sure which one of them - you can do this for both) and see whether it's an Ctrl+C pressed. If so, then OnPreEvent should unlock the Accels and the OnPostEvent should lock them back.
All of this should give you the result that you need.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
asamrith@gmail.com
User
Posts: 91
Joined: Fri Sep 16, 2016 12:03 am

Re: Enable just CTRL-C keyboard for copy

Post by asamrith@gmail.com »

What worked for me was from this post where I used the e_pagesView_keyboard event to listen and capture keystroke. Thanks as always for your help.
if (e.nEventID == nIDS[(int)IDS.e_pagesView_keyboard])
{
IntPtr outPtr = new IntPtr(e.pEvent.Param2);
PDFXEdit.IUIX_Event evt = (PDFXEdit.IUIX_Event)System.Runtime.InteropServices.Marshal.GetObjectForIUnknown(outPtr);
if (evt.Code == 0x0100) //#define WM_KEYDOWN 0x0100
{
//Here you have the WM_KEYDOWN message with it's wParam and lParam as Param1 and Param2
}
}
viewtopic.php?f=66&t=27736&p=107745&hil ... rd#p107745
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Enable just CTRL-C keyboard for copy

Post by Sasha - Tracker Dev Team »

:)
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Post Reply