Hello Alexandre,
Yes, if it works under Windows then obviously we need a fix in Wine. I think you should investigate exactly how Windows does it, there are many places where we could add such checks so we need to find out exactly where Windows has them.
OK - wrote a little test program to see, how SetShellWindow() exactly works on Windows. It creates a few windows and tests, what happens when trying to register them as shell window. To run it you have to terminate Windows Explorer at first. Then the output is this the following:
first call to SetShellWindow(hwnd): SUCCESS second call to SetShellWindow(hwnd): FAILURE reset shell window by SetShellWindow(0): FAILURE third call to SetShellWindow(hwnd): FAILURE SetWindowExStyle(hwnd, WS_EX_TOPMOST): FAILURE DestroyWindow(hwnd): SUCCESS SetShellWindow(hwnd2) with WS_EX_TOPMOST: FAILURE SetShellWindow(hwnd3): SUCCESS SetWindowPos(hwnd3, HWND_TOPMOST): SUCCESS SetWindowPos(hwnd3, hwnd4: SUCCESS SetShellWindow(hwnd4): FAILURE SetWindowPos(hwnd3, hwnd5): SUCCESS
So we have to taking following rules into account for the SetShellWindow/Ex() implementation:
- SetShellWindow() only succeedes if there is not yet a registered shell window.
- A successfull call moves the window into the background. It becomes the window with the lowest Z-order. This can't be changed by a call to SetWindowPos() or similar functions. The shell window remains at the bottom for ever.
- Shell windows can't be reset by calling SetShellWindow(0). To change the shell window, the current window has to be destroyed.
- Shell windows must not have the extended style bit WS_EX_TOPMOST set. It it is set, SetShellWindow() failes. If you try to set this bit after registering a window as shell window, the bit is ignored and automatically set to zero.
- If you try to move the window into the foreground by calling SetWindowPos() with HWND_TOPMOST this call succeedes, but it does not change anything. The window remains in the background.
-- Martin Fuchs martin-fuchs@gmx.net
"Martin" == Martin Fuchs martin-fuchs@gmx.net writes:
...
Martin> cout << "first call to SetShellWindow(hwnd): " << (ret? Martin> "SUCCESS": "FAILURE") << "\n";
As plain C programm this could perhpas be included in out test suite...
Hello Uwe,
I have merged the tests into dlls/user/tests/win.c and extended them a bit. I tried them on Win XP and on WIN 98 and had to see, there are some differencies between the operating systems. So a few tests are commented out with an apropiet comment. Now all active SetShellWindow tests are passing on real windows.
Btw: Are you aware of the fact, that some of the existing old tests have problems on WIN 98? I had to disable them to run the executable successfully, because it displays a "This program performed an illegal operation and will be shut down"-box.
Greetings,
Martin
Martin> cout << "first call to SetShellWindow(hwnd): " << (ret? Martin> "SUCCESS": "FAILURE") << "\n";
As plain C programm this could perhpas be included in out test suite...