HTML ページを通常の exe と通信するために、C# で Windows Messaging を実装しようとしています。私がしなければならないことは、特定のクラス名とウィンドウ名を持つ新しいウィンドウを作成して、他のプロセスが Windows メッセージを Activex アプリケーションに送信できるようにすることです。
[DllImport("user32.dll", SetLastError = true)]
static extern IntPtr CreateWindowEx(
WindowStylesEx dwExStyle,
string lpClassName,
string lpWindowName,
WindowStyles dwStyle,
int x,
int y,
int nWidth,
int nHeight,
IntPtr hWndParent,
IntPtr hMenu,
IntPtr hInstance,
IntPtr lpParam);
IntPtr temp = CreateWindowEx(0, "privateclassname", "privatewindowname",
WindowStyles.WS_CHILD | WindowStyles.WS_VISIBLE, 0, 0, 1, 1,
IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero);
これは私が試してきたことですが、temp は適切なウィンドウ ハンドルではなく常に 0 になります。このコードの何が問題になっていますか? hWndParentパラメータが疑われます。親のハンドルがわからないか、存在さえしないため、0 を指定します。前もって感謝します