Esempio n. 1
0
        private void btnStart_Click(object sender, EventArgs e)
        {
            ProcessUtils.LDPath = txtPath.Text;
            if (ProcessUtils.LDPath == "")
            {
                MessageBox.Show("请先选择雷电模拟器路径");
                return;
            }
            int count = int.Parse(txtCount.Text);

            for (int i = 0; i < count; i++)
            {
                int       id      = ProcessUtils.Run(i);
                IntPtr    idp     = (IntPtr)id;
                Process[] process = Process.GetProcessesByName("dnplayer");
                foreach (var p in process)
                {
                    if (!processIdList.Contains(p.Id))
                    {
                        Thread.Sleep(500);
                        processIdList.Add(p.Id);
                        var handle = p.MainWindowHandle;
                        AppContainer.SetParent(handle, Handle);
                        AppContainer.SetWindowLong(new HandleRef(appContainer1, handle), GWL_STYLE, WS_VISIBLE);
                        break;
                    }
                }
                //Thread.Sleep(200);
            }
        }
Esempio n. 2
0
        private void lblEmbedHandle_Click(object sender, EventArgs e)
        {
            var frmHandle = new FormHandle();

            if (frmHandle.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                var handle = frmHandle.GetHandle();
                AppContainer.SetParent(handle, this.Handle);
                AppContainer.SetWindowLong(new HandleRef(this.appBox, handle), GWL_STYLE, WS_VISIBLE);
            }
        }