Before asking my question let me say that i've read about 30 threads here and in other forums and none of the solutions has worked for me :(
So, here's the thing. I'm doing a Hud for online poker rooms. So, my program needs to show a form on top of every window the poker room creates.
The problem is if I want to stack more than one "table windows" (those that the poker app creates), if my hud is set to topmost, there are ALL huds in top of ALL tables, but what I'd like is to have in the z-order is Hud-Table-Hud-Table-Hu... and so on.
I have tried several methods both using windows forms functions and windows api:
this.SetDesktopLocation(rct.Left + p.X, rct.Top + p.Y);
//Or
Win32Utils.SetParent(this.Handle, this.Table.Handle);
//Or
Win32Utils.SetWindowPos(this.Handle, (int)this.Table.Handle, rct.Left + p.X, rct.Top + p.Y, this.Width, this.Height, (int)1);
//Or
Win32Utils.SetZOrder(this.Handle, this.Table.Handle);
In case of SetZOrder, here's the code:
public static void SetZOrder(IntPtr targetHwnd, IntPtr insertAfter)
{
IntPtr nextHwnd = IntPtr.Zero;
SetWindowPos(targetHwnd, insertAfter, 0, 0, 0, 0, SetWindowPosFlags.SWP_NOMOVE | SetWindowPosFlags.SWP_NOSIZE | SetWindowPosFlags.SWP_NOACTIVATE);
}
So I don't know what else to try.
Note: If I use SetParent, the poker app freezes.
A picture. My app is the window on the bottom, and create the small forms on the upper left corner of poker app windows: