Jerome_H

Hi everybody,

I request yours advices, helps for my problem.

I have 2 forms applications.

They communicate with remoting.

In the first window form application opened at the screen, an user perform an action.

This action send a message, with remoting technology, to the second application.

But this second application is also started but she is at the background on my screen.

That means in the task bar of windows, the selected one is the first application.

The second one receives the remoting message and begin its treatment.

This treatment displays some information in the visual controls on the form.

I would like my second application come on the top of the screen when she receives the remoting message.

And she will be selected in the tasks bar.

I try to use the window message with WM_SHOW, WM_SWHOWWINDOW, WM_ACTIVATE ....

But that does not work :-(

If somebody has an idea for my problem ...

Thansk in advance

Jerome



Re: Windows Forms General Send an application to the foreground in the tasks bar

Oleh Svintsitskyy

Hi Jerome_H,

Ensure that second application's form is visible and call its Form.Activate() method.

Regards,

Oleh.





Re: Windows Forms General Send an application to the foreground in the tasks bar

nobugz

That's unlikely to work, you'll just end up with a blinking taskbar button. You may need to P/Invoke the AllowSetForegroundWindow() API function from the top app to specifically grant the bottom app to steal the focus.





Re: Windows Forms General Send an application to the foreground in the tasks bar

Jerome_H

Hello,

Perfect, that works fine with the Form.Activate().
I don't know why I didn't think about that

Thanks
Jerome




Re: Windows Forms General Send an application to the foreground in the tasks bar

Jerome_H

Hi all,

Finally, the Form.Activate() don't work correctly.

So I used the following methods:
- AllowSetForegroundWindow
- SetForegroundWindow

That works well but not all the time.
Once on two, the application stay in the taskbar with a blinking status.

Why
Do you have an idea

Thanks in advance
Jerome