1

Topic: To move a window over others.

Hello. There is a window whose  to me is known. Generally it can belong to other process. It is necessary to move a window over others (the result similar Alt + Tab on icon of given application). I can not pick up WIN API function which would yield the necessary result. Variants which I tried: 1. ShowWindow (hwnd, SW_RESTORE); It works for a case if the window is contracted, for a window which is covered by other window, happens nothing in my opinion. 2. SetForegroundWindow (hwnd); It works almost always, except one important case. At me two  one application - two identical windows are superimposed precisely one over another. If the lower application tries to "float" by means of this function,  is activated, the necessary application becomes "dark blue" (well, ostensibly receives focus), but the window remains the covered old window. 3. BringWindowToTop (hwnd); generally does nothing. How to be? There is any reliable method to "lift" a window?

2

Re: To move a window over others.

Hello, Went, you wrote: W> How to be? There is any reliable method to "lift" a window? If you in foreground then that more less  it is necessary to cause AllowSetForegroundWindow on process. And further let he somersaults further. Remaining methods are more similar to dances with a tambourine.

3

Re: To move a window over others.

Hello, Went, you wrote: ... W> How to be? There is any reliable method to "lift" a window? It is possible to fasten to foreground-window input, using AttachThreadInput and only then to float through SetForegroundWindows.

4

Re: To move a window over others.

Hello, GlebZ, you wrote: GZ> Hello, Went, you wrote: W>> How to be? There is any reliable method to "lift" a window? GZ> if you in foreground then that more less  it is necessary to cause AllowSetForegroundWindow on process. And further let he somersaults further. Remaining methods are more similar to dances with a tambourine. Changes nothing, the window all the same "does not float". Yes these Foreground already in itself dances with a tambourine, . What for to me to do any window foreground, it is necessary for me simply "alto-tabnut" the specified process.

5

Re: To move a window over others.

Hello, Carc, you wrote: the C> Can be fastened to foreground-window input, using AttachThreadInput and only then to float through SetForegroundWindows. Task Switcher and does?

6

Re: To move a window over others.

Hello, Went, you wrote: W> Hello, Carc, you wrote: the C>> Can be fastened to foreground-window input, using AttachThreadInput and only then to float through SetForegroundWindows. W> Task Switcher and does? Questions on business: And what such Task Switcher? And what it does? And how it does it? And he speaks to us "that it makes it with us" ()? And why I not the telepathist? What generally it is necessary? Simply  over the arbitrary window and to take away focus to itself or something another?

7

Re: To move a window over others.

Hello, Went, you wrote: W> Hello. There is a window whose  to me is known. Generally it can belong to other process. It is necessary to move a window over others (the result similar Alt + Tab on icon of given application). I can not pick up WIN API function which would yield the necessary result. Variants which I tried: the Variant 4: it is not necessary to steal input focus of current application. NEVER. It would be desirable to draw attention of the user - "blink dark blue" in , it absolutely legally. When to the user it will be convenient - it switches. Perhaps it now to  types the password - and here bang! and "I secretly love 50 cents" departs in .

8

Re: To move a window over others.

Hello, Mr. Delphist, you wrote: MD> the Variant 4: it is not necessary to steal input focus of current application. NEVER. Never speak "never" And if the person writes the  or other  a manager? MD> It would be desirable to draw attention of the user - "blink dark blue" in , it absolutely legally. FlashWindowEx

9

Re: To move a window over others.

Hello, Went, you wrote: W> How to be? There is any reliable method to "lift" a window? Well still it is possible SetWindowPos to try.

10

Re: To move a window over others.

Hello, Evgeniy Skvortsov, you wrote: ES> Hello, Went, you wrote: W>> How to be? There is any reliable method to "lift" a window? ES> well still it is possible SetWindowPos to try. And that it gives for "an alto-tabnut a window" on  a topic-starter?

11

Re: To move a window over others.

Hello, Went, you wrote: W> Hello, GlebZ, you wrote: GZ>> Hello, Went, you wrote: W>>> How to be? There is any reliable method to "lift" a window? GZ>> if you in foreground then that more less  it is necessary to cause AllowSetForegroundWindow on process. And further let he somersaults further. Remaining methods are more similar to dances with a tambourine. W> changes nothing, the window all the same "does not float". Yes these Foreground already in itself dances with a tambourine, . What for to me to do any window foreground, it is necessary for me simply "alto-tabnut" the specified process. The matter is that possibility program to translate a window to the foreground (foreground) it is restricted intentionally. It is meant that the user selects this window itself, and applications should follow its choice always. If the window of your application is in the foreground it can deduce a window of any other application on the foreground or transfer to other application possibility to move to the forefront (causing AllowSetForegroundWindow). If the window of your application is not in the foreground to pass to the foreground or to deduce on the foreground a window of other application simply so it cannot. If at you two copies of application with the windows, and that of them, which window is not at present in the foreground, wants to pass to the foreground it is necessary to ask to give the application second copy to the first copy possibility to pass to the foreground. If both copies of application are not in the foreground to pass to the foreground (legal methods) it will not be possible.

12

Re: To move a window over others.

Hello, VTT, you wrote: VTT> If both copies of application are not in the foreground to pass to the foreground (legal methods) it will not be possible. Why it will not be possible!?! AttachThreadInput to a window, which now in the foreground, i.e. what GetForegroundWindow and if AttachThreadInput it was completed successfully then went. Also should work. On my VinRar and does, when after background archiving  from . It there it is curious , to it  what window , rises from  and takes away focus to itself as there is nothing. Another story that is direct  (all windows successively, and is more true flows to which posess windows so to you and allow to cling to their queue of input (AttachThreadInput).

13

Re: To move a window over others.

Hello, Carc, you wrote: a C> Hello, VTT, you wrote: VTT>> If both copies of application are not in the foreground to pass to the foreground (legal methods) it will not be possible. The C> Why will not be possible!?! AttachThreadInput to a window, which now in the foreground, i.e. what GetForegroundWindow and if AttachThreadInput it was completed successfully then went. Also should work. The C> Another story that is direct  (all windows successively, and is more true flows to which posess windows so to you and allow to cling to their queue of input (AttachThreadInput). The legal method is AllowSetForegroundWindow / SetForegroundWindow. All remaining are workaround / hack. But the hardware they is explicit there is nothing. The C> On my VinRar and does, when after background archiving  from . It there it is curious , to it  what window , rises from  and takes away focus to itself as there is nothing. Anything such  does not do, after archiving the window hangs on a background.

14

Re: To move a window over others.

Hello, VTT, you wrote: VTT> the Legal method is AllowSetForegroundWindow / SetForegroundWindow. VTT> All remaining are workaround / hack. Why? AttachThreadInput than !?! I do not argue that there it is a lot of that for it it is required. Well the same OpenThread to another's flow, and it well it is direct  at once all and opened. Easily does not give  another's flow. And accordingly the circuit simply does not work. But it is a question it is sensitive other plane. VTT> but the hardware they is explicit there is nothing. The C>> On my VinRar and does, when after background archiving  from . It there it is curious , to it  what window , rises from  and takes away focus to itself as there is nothing. VTT> Anything such  does not do, after archiving the window hangs on a background. Well just rechecked (Vin7 32, ). Focus to itself  too floated as pretty of , and. And it rose over Foregtound a window, and at all therefrom whence it was launched (Total Commander and started up without  the rights)... Guards.

15

Re: To move a window over others.

Hello, VTT, you wrote: VTT> the Legal method is AllowSetForegroundWindow / SetForegroundWindow. VTT> All remaining are workaround / hack. Well here to you function which twitches on the timer. My window as pretty floats, and focus to itself takes away from whom want. But as spoke, all will depend on the rights: if successfully fulfills AttachThreadInput to another's flow. const HWND hwnd =:: GetForegroundWindow ();//who at us a foregraund-window now DWORD pid =0;//it is received ThreadID and ProcessID windows in the foreground const DWORD tid =:: GetWindowThreadProcessId (hwnd,&pid);//if a window of the foreground and so ours, that  to us  () - we and without  all can if (GetCurrentProcessId () == pid) return;//we are connected to input queue, but here  to be failure - because of safety Windows if (AttachThreadInput (GetCurrentThreadId (), tid, TRUE)) {//aha,  were connected  - well went then:: SetForegroundWindow (m_hWnd); //m_hWnd is HWND our window, whence on on the timer for the test this function:: SetActiveWindow (m_hWnd) twitches;:: SetFocus (m_hWnd);//we are disconnected from input queue to the stranger  AttachThreadInput (GetCurrentThreadId (), tid, FALSE);}

16

Re: To move a window over others.

Hello, Carc, you wrote: a C> Hello, VTT, you wrote: VTT>> the Legal method is AllowSetForegroundWindow / SetForegroundWindow. VTT>> All remaining are workaround / hack. A C> Why? AttachThreadInput than !?! And that tries to mislead system that the user carried out input in this process and to receive the privilege not due to it on window transfer on the foreground. The C>>> On my VinRar and does, when after background archiving  from . It there it is curious , to it  what window , rises from  and takes away focus to itself as there is nothing. VTT>> Anything such  does not do, after archiving the window hangs on a background. The C> Well just rechecked (Vin7 32, ). Focus to itself  too floated as pretty of , and. And it rose over Foregtound a window, and at all therefrom whence it was launched (Total Commander and started up without  the rights). . Guards. Well just rechecked (Vin10 64, about). Floated as pretty on a background, and focus to itself did not capture.

17

Re: To move a window over others.

Hello, VTT, you wrote: VTT> Hello, Carc, you wrote: a C>> Hello, VTT, you wrote: VTT>>> the Legal method is AllowSetForegroundWindow / SetForegroundWindow. VTT>>> All remaining are workaround / hack. A C>> Why? AttachThreadInput than !?! VTT> And that tries to mislead system that the user carried out input in this process and to receive the privilege not due to it on window transfer on the foreground. Brad. If to it privileges AttachThreadInput it will be completed by failure are not supposed, and quits nothing. And the system should not depend on, whether who-thread tries to mislead her, or still that where to enter. There are no privileges - both does not work. Anybody also did not argue. But a method with AttachThreadInput at all , and official API. The C>>>> On my VinRar and does, when after background archiving  from . It there it is curious , to it  what window , rises from  and takes away focus to itself as there is nothing. VTT>>> Anything such  does not do, after archiving the window hangs on a background. The C>> Well just rechecked (Vin7 32, ). Focus to itself  too floated as pretty of , and. And it rose over Foregtound a window, and at all therefrom whence it was launched (Total Commander and started up without  the rights)... Guards. VTT> well just rechecked (Vin10 64, about). Floated as pretty on a background, and focus to itself did not capture. Over whom did not float? It is necessary all successively and should not float. I already wrote that checked on the code. My application worked from under restricted , adjacent applications on a miscellaneous. My code of emerging twitched everyone one and a half second. So here  over applications with higher rights my good also did not float, for AtttachThreadInput came to an end with failure. That is expected, and I initially described it.

18

Re: To move a window over others.

Hello, Carc, you wrote: a C> Hello, VTT, you wrote: VTT>> Hello, Carc, you wrote: a C>>> Hello, VTT, you wrote: VTT>>>> the Legal method is AllowSetForegroundWindow / SetForegroundWindow. VTT>>>> All remaining are workaround / hack. A C>>> Why? AttachThreadInput than !?! VTT>> and that tries to mislead system that the user carried out input in this process and to receive the privilege not due to it on window transfer on the foreground. A C> Brad. If to it privileges AttachThreadInput it will be completed by failure are not supposed, and quits nothing. And the system should not depend on, whether who-thread tries to mislead her, or still that where to enter. There are no privileges - both does not work. Anybody also did not argue. The C>>>>> On my VinRar and does, when after background archiving  from . It there it is curious , to it  what window , rises from  and takes away focus to itself as there is nothing. VTT>>>> Anything such  does not do, after archiving the window hangs on a background. The C>>> Well just rechecked (Vin7 32, ). Focus to itself  too floated as pretty of , and. And it rose over Foregtound a window, and at all therefrom whence it was launched (Total Commander and started up without  the rights)... Guards. A C> I already wrote that checked on the code. My application worked from under restricted , adjacent applications on a miscellaneous. My code of emerging twitched everyone one and a half second. So here  over applications with higher rights my good also did not float, for the C> AtttachThreadInput came to an end with failure. That is expected, and I initially described it.  , , suffices to mold to me minuses. At you continuous . The privilege in this case is possibility to send a window on the foreground or to transfer such possibility to other process. Instead of "neglect with the rights of the manager" or what other system privilege. About interactions with the processes launched from under exclusive users and to which insulation methods can be applied, here speeches did not go at all. A C> But a method with AttachThreadInput at all , and official API. It is official API, but its usage for bypass of restrictions SetForegroundWindow is if and not , impudent workaround. If the window not in the foreground and SetForegroundWindow does not work, it and should sit further and wait, while the user himself in it switches. As a maximum, it can cause FlashWindow to draw attention of the user. VTT>> well just rechecked (Vin10 64, about). Floated as pretty on a background, and focus to itself did not capture. The C> Over whom did not float? It is necessary all successively and should not float. Yes over anybody did not float.

19

Re: To move a window over others.

Hello, Carc, you wrote: a C> And that it gives for "an alto-tabnut a window" on  a topic-starter? Well like it changes z-order at windows.

20

Re: To move a window over others.

C>> But a method with AttachThreadInput at all , and official API. VTT> It is official API, but its usage for bypass of restrictions SetForegroundWindow is if and not , impudent workaround. VTT> If the window not in the foreground and SetForegroundWindow does not work, it and should sit further and wait, while the user himself in it switches. VTT> as a maximum, it can cause FlashWindow to draw attention of the user. We considered a decision method, and at all . That it there should or should not - to solve to a topic-starter as it not so distinctly explained that that as a matter of fact it is necessary to it. Especially  a phrase "only it is necessary for me  a window". Well, and if about  if it is necessary to switch, that is  a method to raise a window from this  that the keypad, instead of  there . I mean custom actions that all the same the user that itself pushes Alt+Tab, further already  all makes. But pay attention to sending: the user presses Alt+Tab herself - i.e. at first by pens does to the necessary window foreground, but only then... Only I mean own code in this case i.e. how to add such in own application (well  the same code in another's process we do not consider though and in this case works if  certainly it turns out). But talk that initial about other was... About methods, instead of about experts, and their merits and demerits (VinRar by the way sometimes hinders such knowledge though impresses).

21

Re: To move a window over others.

Hello, Evgeniy Skvortsov, you wrote: ES> Hello, Carc, you wrote: a C>> And that it gives for "an alto-tabnut a window" on  a topic-starter? ES> well like it changes z-order at windows. Foreground from it our window does not become.

22

Re: To move a window over others.

Hello, Carc, you wrote: the C> Foreground from it our window does not become. In notes about it it is written If an application is not in the foreground, and should be in the foreground, it must call the SetForegroundWindow function. To use SetWindowPos to bring a window to the top, the process that owns the window must have SetForegroundWindow permission.

23

Re: To move a window over others.

Hello, Evgeniy Skvortsov, you wrote: ES> Hello, Carc, you wrote: the C>> Foreground from it our window does not become. ES> in notes about it it is written ES> ES> If an application is not in the foreground, and should be in the foreground, it must call the SetForegroundWindow function. ES> To use SetWindowPos to bring a window to the top, the process that owns the window must have SetForegroundWindow permission. And here it? If at present our process has no foreground-window, if a foreground-window somewhere in other process it does not help ...

24

Re: To move a window over others.

Hello, VTT. Thanks big, realized all depth of a problematics

25

Re: To move a window over others.

Hello, Carc, you wrote: a C> And what such Task Switcher? And what it does a window floating on Atl+Tab at Windows of a C>? A C> And how it it does?> And he tells a C to us "that it makes it with us" ()? A C> And why I not the telepathist? A C> That generally is necessary? A C> it is simple  over the arbitrary window and to take away focus to itself This. But I already understood an inaccuracy of the reasonings, thanks.