Launch program from within MediaPortal, how to deal with MP always on top (1 Viewer)

Dragy

Portal Pro
April 27, 2009
778
333
32
Home Country
Netherlands Netherlands
It's about my plugin, Opera Mobile Launcher.

So, I launch Opera Mobile and there is a problem when people have the "always on top" option enabled in MP. Opera Mobile starts behind MP...

I can hide MP by calling this before I start Opera:
ShowWindowAsync(MediaPortalHwnd, 0);

But then.. I don't know how to restore MP again after I close Opera... Well.. in one case I can, when I press the back button on the MCE remote. MP still receives that command when it's hidden.. But that does not count for people who don't use the MCE remote.. So there has to be another way..

What I actually want to do, is let MP send all keys it receives to Opera. For this, MediaPortal has to be the Main Window, but Opera has to be the top most window... How the hell can I achieve that? I tried a lot of p/invoke functions, but none of them really work.. Or could someone give me an exact combination?
 

Dragy

Portal Pro
April 27, 2009
778
333
32
Home Country
Netherlands Netherlands
Cool, do you know where I can find the source code?
 

Dragy

Portal Pro
April 27, 2009
778
333
32
Home Country
Netherlands Netherlands
Wow, I got it! The main problem was actually finding the CORRECT Hwnd of Opera Mobile. I already had one, but I found out that Opera was not the only window with the classname I searched for. After this, I solved my problem with this:
Code:
        TaskBarHwnd = FindWindow("Shell_traywnd", "");
        SetWindowPos(TaskBarHwnd, IntPtr.Zero, 0, 0, 0, 0, SWP_HIDEWINDOW);   // Hide Taskbar

        SetForegroundWindow(MediaPortalHwnd); //mediaportal to foreground
        SetWindowPos(MediaPortalHwnd, OperaHwnd, 0, 0, SystemInformation.PrimaryMonitorSize.Width, SystemInformation.PrimaryMonitorSize.Height, SWP_HIDEWINDOW); //mediaportol on top, but hidden
This works when MP is always on top and when it isn't. I can type and MP gets all the keypresses, but I don't see MP, but Opera! Perfect. This is how it must be.

Case closed.
 

Users who are viewing this thread

Top Bottom