Reputation: 21
how can I show a window when I play a movie in full screen without exiting full screen mode of the movie player? I just want the window to apear on topof the movie. I know this is posible because yahoo messeger does it every time it showes you that a pearson has signed in or out , and I'm sure that there are other programs that do it also but I just can't remember now.
it can be in C/C++ mfc, win api , c# , wpf it doesn't mater.
Upvotes: 2
Views: 2710
Reputation: 613441
Just show the window with a z-order that places it on top of the full screen window. I think you can do this by calling SetWindowPos
passing HWND_TOP
. Something like this:
SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
You may want to include SWP_NOACTIVATE
as well, or possibly some of the other SWP_***
options. You can check the uFlags parameter in the SetWindowPos function for the different SWP_***
messages.
Upvotes: 3
Reputation: 21
SetForegroundWindow will bring the player out of the full screen mode , and BringWindowToTop won't work. All other methodes sugested work if the window is from the same aplication as the video player, but what I need is to put a window in from of a video player ( which is in full screen ) that is from another aplication.
Upvotes: 0
Reputation: 2104
C# Use SetForegroundWindow() of user32.dll
More on stackoverflow C# Force Form Focus
// Sets the window to be foreground
[DllImport("User32")]
private static extern int SetForegroundWindow(IntPtr hwnd);
// Activate or minimize a window
[DllImportAttribute("User32.DLL")]
private static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
private const int SW_SHOW = 5;
private const int SW_MINIMIZE = 6; private const int SW_RESTORE = 9;
private void ActivateApplication(string strAppName)
{
Process[] pList = Process.GetProcessesByName(strAppName);
if (pList.Length > 0)
{
ShowWindow(pList[0].MainWindowHandle, SW_RESTORE);
SetForegroundWindow(pList[0].MainWindowHandle);
}
}
Upvotes: 0