Rank: Administration
Groups: Translators, Members, Administrators Joined: 1/11/2018(UTC) Posts: 1,359 Location: Tampa, FL Thanks: 28 times Was thanked: 419 time(s) in 356 post(s)
|
It is not a matter of speed, there is something with the way Copernic is watching for the Control key presses which is not receiving or accepting injected input, or it might be a bitness issue (32 vs 64) in how it's hooking. For example, on my PC if I have the S+ Settings window or Spy++ focused (active window), pressing Control twice does not bring up Copernic (edit: actually, this may be due to Copernic running at a lower privilege than S+ or Spy++). But if I change to Chrome or Notepad, pressing Control twice works fine. As I was typing the text at the bottom on my comment, it gave me the idea to watch Copernic's messages when opening a second instance (like your RunProgram code). Sure enough, it posts a custom message to the already running instance. This works for me! Code://Directly send Copernic's WM_SHOWFIRSTINSTANCE message
var cds = sp.WindowFromClassOrTitle("", "Copernic Desktop Search");
var WM_SHOWFIRSTINSTANCE = 0xC0C6;
cds.PostMessageObj(WM_SHOWFIRSTINSTANCE, 0x0, 0x0);
Edit: Leaving the info below for reference/learning purposes, but use the above codeUnfortunately, without more information from the developer of Copernic, there's no way for me to know where the issue is. I tried several different methods like activating the window directly, which does bring up the window, but the inside of the is solid black, so their code must only render the UI if invoked by the program's internal code. Code:sp.WindowFromClassOrTitle("", "Copernic Desktop Search").Activate()
I also tried posting Control key messages directly to the window without success. I can see the messages are received and are identical to the messages posted when physically pressing the keys, but still it does not respond. Code:var cds = sp.WindowFromClassOrTitle("", "Copernic Desktop Search");
//Send Ctrl down then up twice via direct WinAPI messages
cds.PostMessageObj(0x0100, 0x11, 0x1D0001);
cds.PostMessageObj(0x0101, 0x11, 0xC01D0001);
cds.PostMessageObj(0x0100, 0x11, 0x1D0001);
cds.PostMessageObj(0x0101, 0x11, 0xC01D0001);
Note that this code will give you an error until the next release, I had to change the casting to uint instead of int for wParam and lParam...but it does not work anywaySo your solution is probably the best one for now, though it is a little slower than Control twice because it has to load the EXE first before Copernic sees it's already running and activates the existing instance. Edited by user Friday, September 20, 2019 2:48:44 PM(UTC)
| Reason: Not specified
|