خرید بک لینک

Vote count: 0

I'm trying to do a HUD for poker,

So the idea is to set Form over the poker application ( which is not my application ) and keep the form always over the table even if i move the poker table

enter image description here

So I get the IntPtr from the table using

  [DllImport("user32.dll")]
    public static exte int EnumWindows(EnumWindowsCallback lpEnumFunc, int lParam);

I need a Form for each player at the table for display the informations about a player

So I create my Form which I attach to the poker table using

[DllImport("user32.dll")]
private static exte IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);

But then when I show the Form I lost the focus ! I just can't click on the poker table or on my main frame. A solution ?

    private void displayHudForEachPlayer(IntPtr pokerTable) {


        StringBuilder windowTitle = new StringBuilder(256);
        GetWindowText(pokerTable, windowTitle, windowTitle.Capacity);

        if (windowTitle.ToString().Contains("Real money"))
        {

            HudPlayerView hudPlayer1 = new HudPlayerView();
            //hudPlayer1.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;

            Console.WriteLine(windowTitle.ToString());

            IntPtr childHandle = hudPlayer1.Handle;

            ParentWndWrapper oParentWnd = new ParentWndWrapper(pokerTable);
            SetParent(childHandle, pokerTable);

            hudPlayer1.SetBounds(0, 0, 100, 50);
            hudPlayer1.ShowDialog();
        }
    }

I tried also with

IWin32Window w = Control.FromHandle(pokerTable);
hudPlayer1.ShowDialog(w);

instead of SetParent but same result.

enter image description here

asked 23 secs ago

برچسب: نویسنده: استخدام کار تاريخ: شنبه 4 ارديبهشت 1395 ساعت: 8:13

صفحه بندی