StrokesPlus.net
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
blumina  
#1 Posted : Friday, September 20, 2019 1:16:09 AM(UTC)
blumina

Rank: Newbie

Reputation:

Groups: Approved
Joined: 9/19/2019(UTC)
Posts: 6
Germany

Hi,
contact me again.

The program call via 2x Ctrl does not work with:

//Send Control down and up twice
sp.SendControlDown();
sp.Sleep(5);
sp.SendControlUp();
sp.Sleep(5);
sp.SendControlDown();
sp.Sleep(5);
sp.SendControlUp();


The CTRL key has to be pressed 2x very fast.
Is there another solution?



The program call works perfectly with:
sp.RunProgram("C:\\Program Files (x86)\\Copernic\\DesktopSearch\\Copernic.DesktopSearch.exe", "", "open", "normal", true, false, false);

Bye Blumina
Rob  
#2 Posted : Friday, September 20, 2019 8:23:49 AM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 401
United States

Thanks: 5 times
Was thanked: 78 time(s) in 68 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 code


Unfortunately, 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 anyway
So 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 8:48:44 AM(UTC)  | Reason: Not specified

blumina  
#3 Posted : Monday, September 23, 2019 2:47:14 AM(UTC)
blumina

Rank: Newbie

Reputation:

Groups: Approved
Joined: 9/19/2019(UTC)
Posts: 6
Germany

Too bad it doesn't work with a shortcut.
But many thanks for testing ... maybe there is a solution of copernic with another shortcut.

Bye blumina
Rob  
#4 Posted : Monday, September 23, 2019 2:21:03 PM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 401
United States

Thanks: 5 times
Was thanked: 78 time(s) in 68 post(s)
Do you mean this one doesn't work?

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);

Note that you might need to change "Copernic Desktop Search" to whatever the title of the main window is, if there's a German translation for Copernic which reads differently.

Edited by user Monday, September 23, 2019 2:21:59 PM(UTC)  | Reason: Not specified

blumina  
#5 Posted : Monday, October 7, 2019 1:06:49 PM(UTC)
blumina

Rank: Newbie

Reputation:

Groups: Approved
Joined: 9/19/2019(UTC)
Posts: 6
Germany

Unfortunately, the notification was in the spam folder ... so I could test the solution only now

Unfortunately the script does not work.
The program is in the German version also "Copernic Desktop Search"

blumina

Edited by user Monday, October 7, 2019 1:08:00 PM(UTC)  | Reason: Not specified

Rob  
#6 Posted : Monday, October 7, 2019 1:25:06 PM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 401
United States

Thanks: 5 times
Was thanked: 78 time(s) in 68 post(s)
Well that's odd, it worked fine for me on my computer. So without you doing some message debugging on your end, there's not much I'll be able to do to help :/
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.