VB6
私は、現在実行中のソフトウェアの形式のハンドルを取得し、いくつかのAPI関数を使用して外部から変更することができたことを覚えています。C#で行うことは可能ですか?どうやって?問題は、このソフトウェアが別の言語であるということです。一部を英語に変更したい。
1713 次
2 に答える
2
Win32 API から使用FindWindow
してみてください:SetWindowText
FindWindow
c# 署名:
[DllImport("user32.dll", SetLastError = true)]
static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
SetWindowText
c# 署名:
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
public static extern bool SetWindowText(IntPtr hwnd, String lpString);
およびサンプルのタラ:
SetWindowText(Process.GetCurrentProcess().MainWindowHandle, "Hello W");
于 2012-11-07T09:07:00.353 に答える
1
1) WinForms には Control クラスに "Handle" プロパティがあります (すべてのコントロールと Form クラスはそこから派生します ( MSDN 記事)
2) WPF では HWND ハンドルが公開されていませんが、WindowInteropHelperクラスを使用して取得できます。
次のように取得できます。
WindowInteropHelper wih = new WindowInteropHelper(YourWindow);
IntPtr hwndHandle = wih.Handle;
于 2012-11-07T08:47:42.773 に答える