- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
你好,我是韩国的初学者。
我在做。程序。程序在一个窗体上运行三个exe(c++、c#开发),将程序放到面板中。
现在我把C++或者其他语言的程序放到面板里。但是,用C#构建的windows程序在面板上是不保留的。这是我的部分代码:
[DllImport("user32.dll")]
static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);
[DllImport("user32.dll")]
static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
[DllImport("user32.dll")]
static extern bool MoveWindow(IntPtr Handle, int x, int y, int w, int h, bool repaint);
static readonly int GWL_STYLE = -16;
static readonly int WS_VISIBLE = 0x10000000;
private void Form1_Load(object sender, EventArgs e)
{
try
{
Process p = Process.Start("C:\\Users\\sonmi\\OneDrive\\Japan_Bunge_alpha\\Japan_Bunge_alpha\\bin\\Debug\\Japan_Bunge_alpha"); //C# program
Process p2 = Process.Start("C:\\Users\\sonmi\\Desktop\\astana_test\\astana\\Server\\Server_CES"); //C++ program
p.WaitForInputIdle();
Thread.Sleep(100);
SetParent(p.MainWindowHandle, this.Handle);
SetWindowLong(p.MainWindowHandle, GWL_STYLE, WS_VISIBLE);
MoveWindow(p.MainWindowHandle, 0, 0, panel1.Width, panel1.Height, true);
p2.WaitForInputIdle();
SetParent(p2.MainWindowHandle, panel2.Handle);
SetWindowLong(p2.MainWindowHandle, GWL_STYLE, WS_VISIBLE);
MoveWindow(p2.MainWindowHandle, 0, 0, panel2.Width, panel2.Height, true);
}
我现在已经使用了两个面板,但在这次测试结束后我会添加更多。我不知道问题出在哪里。
最佳答案
对于 C# 应用程序,您可以将应用程序加载到当前的 AppDomain 中,并将其视为一个库。为此,将其添加到您的项目引用中。如何初始化并将其放入面板取决于引用的应用程序的设计方式。
您可能必须自己初始化该应用程序的主窗体并以这种方式设置父窗体。
关于C# 在窗体面板中打开其他程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47120055/
对于一个科学实验,我写了一个turtle.py ,它会打开一个 800x480 的窗口并绘制一个缓慢增长的黑点。 turtle.py以 C:\Users\kaza>python C:\Users\ka
我开发了一个 swing 应用程序,但每次运行应用程序时都会打开一个新窗口。我希望如果一个窗口已经打开,则其他窗口不允许打开。 最佳答案 Here是一个 Java 单一应用实例的例子: A singl
有没有办法检测主进程中 Electron 的结构? process.platform 似乎也在 x64 机器上返回 win32,我没有在文档中找到任何获取架构的选项。 最佳答案 你试过 process
public short[] HanningWindow(short[] signal_in ,int pos ,int size) { for (int i= pos; i < pos+si
我有一个具有这些属性的 Electron 窗口: mainWindow = new BrowserWindow({ width: 800, height: 600, title: "Aqu
我有一个 Ubuntu 工作站,我正在尝试引导一个 Windows 节点。 Windows 节点在端口 2222 上打开了 ssh。我一直在关注 http://docs.opscode.com/plu
我是一名优秀的程序员,十分优秀!