Esempio n. 1
0
        private void AddOverlayWindow(D2HostPanel panel)
        {
            D2Overlay overlay = new D2Overlay(panel, p.MainWindowHandle);

            Subscribe(overlay);
            overlay.Focus();
        }
Esempio n. 2
0
        public D2Overlay(D2HostPanel panel, IntPtr d2handle)
        {
            this.panel = panel;
            this.d2    = d2handle;
            this.Size  = panel.Size;
            panel.Controls.Add(this);
            SetStyle(ControlStyles.SupportsTransparentBackColor, true);
            SetStyle(ControlStyles.Opaque, true);
            this.BackColor = Color.Transparent;
            Focus();

            RegisterEvents();
            Cursor cur = CreateCursor(@".\Resources\d2_hand.ani");

            this.Cursor = cur;
        }
Esempio n. 3
0
        private void StartD2(string path, D2HostPanel panel)
        {
            ProcessStartInfo psi = new ProcessStartInfo(path);

            psi.Arguments = "-w -sndbkg";
            p             = Process.Start(psi);
            p.WaitForInputIdle();

            while (p.MainWindowHandle == IntPtr.Zero)
            {
                Thread.Yield();
            }

            IntPtr pt = p.MainWindowHandle;

            SafeNativeMethods.SetParent(pt, panel.Handle);                                          // Process.GetCurrentProcess().MainWindowHandle);
            int style = SafeNativeMethods.GetWindowLong(pt, GWL_STYLE);                             // get the original window style

            SafeNativeMethods.SetWindowLong(pt, GWL_STYLE, (style & ~MYSTUFF));                     // change window style (remove border)
            SafeNativeMethods.SetWindowPos(pt, IntPtr.Zero, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOZORDER); // move to the corner of the panel
            p.EnableRaisingEvents = true;
            p.Exited += P_Exited;
            //SafeNativeMethods.ShowWindow(pt, SW_SHOWMAXIMIZED); // maximize the window
        }