Global shortcut key doesn't activate Salamander

Discussion of bugs and problems found in Altap Salamander. In your reports, please be as descriptive as possible, and report one incident per report. Do not post crash reports here, send us the generated bug report by email instead, please.
Jan Rysavy
ALTAP Staff
ALTAP Staff
Posts: 5229
Joined: 08 Dec 2005, 06:34
Location: Novy Bor, Czech Republic
Contact:

Global shortcut key doesn't activate Salamander

Post by Jan Rysavy »

I have been using Salamander 2 for years and just upgraded to Salamander 3.
On rev 2.0 I had a shortcut on my desktop and assigned it a shortcut key of
ctrl-shift-s. It worked fine. However, with Salamander 3 the shortcut will
launch the program if it's not running, but when it is running the shortcut
does not switch to it.

Can you tell me how to fix this. It is such a big problem I will have to
uninstall rev 3 and revert to rev 2 if I cannot get it to work. I used this
feature constantly throughout the day.
Jan Rysavy
ALTAP Staff
ALTAP Staff
Posts: 5229
Joined: 08 Dec 2005, 06:34
Location: Novy Bor, Czech Republic
Contact:

Re: Global shortcut key doesn't activate Salamander

Post by Jan Rysavy »

I can confirm this problem on Windows 7. When I hit Ctrl+Shift+Alt+S first time, AS3.08 is started and activated. I open another application, hit shortcut key again. Active application will lost focus, title bar is deactivated, but Salamander stays deactivated too.

I can reproduce the same problem with Altap Salamander 2.54 and latest Thunderbird.

It works fine for Notepad. MS Paint has another problem: a new instance is started each time I press the shortcut.
User avatar
SvA
Posts: 483
Joined: 29 Mar 2006, 02:41
Location: DE

Re: Global shortcut key doesn't activate Salamander

Post by SvA »

Is this with the "allow only one instance" option set or using the -O command line option? Otherwise, why should the system behave this way in the first place?

Is there documentation on what Microsoft does to prevent focus stealing and what a programmer must do to actually control program focus? If yes, you ought to follow that; if no - well, do you want to enter this arm's race?
Jan Rysavy
ALTAP Staff
ALTAP Staff
Posts: 5229
Joined: 08 Dec 2005, 06:34
Location: Novy Bor, Czech Republic
Contact:

Re: Global shortcut key doesn't activate Salamander

Post by Jan Rysavy »

It is with "Allow only one instance ..." option turned off. You can try on notepad.exe, there is some heuristics in Windows trying to activate running instance (on global shortcut key) instead of starting a new one.

Unfortunately I'm unable to find any information about this feature.
User avatar
SelfMan
Posts: 1142
Joined: 05 Apr 2006, 20:51
Contact:

Re: Global shortcut key doesn't activate Salamander

Post by SelfMan »

Jan I would say that this is a duplicate of a post I wrote in the Czech section in january and havent got a reply yet. Though the shortcut is not identical, but similar as I am using CTRL+ALT+S
User avatar
SvA
Posts: 483
Joined: 29 Mar 2006, 02:41
Location: DE

Re: Global shortcut key doesn't activate Salamander

Post by SvA »

Jan Rysavy wrote:It is with "Allow only one instance ..." option turned off. You can try on notepad.exe, there is some heuristics in Windows trying to activate running instance (on global shortcut key) instead of starting a new one.

Unfortunately I'm unable to find any information about this feature.
Well, then I checked this with the wrong application (WebServiceStudio). Either no attempt was made there, or it failed miserably.
I conclude: this behavior is not reliable and should therefore not be used. Anyway, which instance of AS do you expect to get activated, if you run more than one?
Jan Rysavy
ALTAP Staff
ALTAP Staff
Posts: 5229
Joined: 08 Dec 2005, 06:34
Location: Novy Bor, Czech Republic
Contact:

Re: Global shortcut key doesn't activate Salamander

Post by Jan Rysavy »

In case of multiple notepad.exe or cacl.exe instances is activated the one with higher z-order placement of the main window.

I assume this is intended behavior, unfortunately somehow broken in Salamander and Thunderbird. The question is what window is activated instead, maybe it is some off-screen window from our process.
User avatar
SelfMan
Posts: 1142
Joined: 05 Apr 2006, 20:51
Contact:

Re: Global shortcut key doesn't activate Salamander

Post by SelfMan »

Anything helpfull in here? MSDN on Global Hot Keys

EDIT:
Also this forum has som usefull info, although its for C#.
Jan Rysavy
ALTAP Staff
ALTAP Staff
Posts: 5229
Joined: 08 Dec 2005, 06:34
Location: Novy Bor, Czech Republic
Contact:

Re: Global shortcut key doesn't activate Salamander

Post by Jan Rysavy »

I can reproduce this problem also in Windows 10.

I wrote small test to show handle of focused window. It is really window opened from Salamander process, it has class name WorkerW. It definitely isn't our window nor our registered class name. https://www.google.com/search?q=workerw+window+class
workerw.png
workerw.png (65.28 KiB) Viewed 13242 times
In this case it has Instance Handle 0x75B20000 and Window Proc 0x75A36A95.

From https://msdn.microsoft.com/en-us/library/aa233565
Instance Handle: The instance handle of the module that registered the class. Instance handles are not unique.
Window Proc: The current address of the WndProc function for windows of this class. This differs from Window Proc on the General tab if the window is subclassed.
workerw_instance.png
workerw_instance.png (12.02 KiB) Viewed 13242 times
So WorkerW class was registered by shlwapi.dll and window procedure is in user32.dll.
Window Proc on the General tab is 0x769698C5, that means the window is subclassed and window proc is in shell32.dll.

Conclusion: it really is some utility window created by Windows. It is activated instead of our main window.
User avatar
SelfMan
Posts: 1142
Joined: 05 Apr 2006, 20:51
Contact:

Re: Global shortcut key doesn't activate Salamander

Post by SelfMan »

Jan Rysavy wrote:Conclusion: it really is some utility window created by Windows. It is activated instead of our main window.
Isnt it becuase the WorkerW thread should receive the window handle of the Salamander instance and then set the focus to it?.
I am not a VC++ coder so please bare with me. According different posts the WorkerW is a "more reliable" replacement for Progman. So what now?
Jan Rysavy
ALTAP Staff
ALTAP Staff
Posts: 5229
Joined: 08 Dec 2005, 06:34
Location: Novy Bor, Czech Republic
Contact:

Re: Global shortcut key doesn't activate Salamander

Post by Jan Rysavy »

I have no idea. WorkerW window is some system window created inside Salamander process. It probably isn't documented, I didn't find API to interact with. And it looks like it is activated instead of Salamander main window. There are other system windows opened from Salamander process, for example "Default IME" with class "IME", or "MSCTFIME UI".

Btw, I tested Thunderbird today and now it works as expected.

Problem can be related to graphics driver, to some system wide utility, Windows update, or some Windows state.
User avatar
SelfMan
Posts: 1142
Joined: 05 Apr 2006, 20:51
Contact:

Re: Global shortcut key doesn't activate Salamander

Post by SelfMan »

WorkerW is a WorkerWindow class/object, but for some reason there is almost no documentation to be found.
Jan Rysavy
ALTAP Staff
ALTAP Staff
Posts: 5229
Joined: 08 Dec 2005, 06:34
Location: Novy Bor, Czech Republic
Contact:

Re: Global shortcut key doesn't activate Salamander

Post by Jan Rysavy »

It seems the problem is not related to WorkerW window. Now I can reproduce this problem with Thunderbird (again) and activated window is "thunderbirdMessageWindow". Window activation process is non-trivial.
Post Reply