解决unity发布exe在win7电脑上部显示输入法的问题。
[DllImport("user32.dll")]
public static extern IntPtr FindWindow(string className, string windowName);
[DllImport("user32.dll")]
internal static extern IntPtr SetForegroundWindow(IntPtr hWnd);
[DllImport("user32.dll")]
internal static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
private void GetFocusWin()
{
//System.Diagnostics.Process currentProcess = System.Diagnostics.Process.GetCurrentProcess();
//IntPtr hWnd = currentProcess.MainWindowHandle;
IntPtr hWnd = FindWindow(null, "TestGPU1");
if (hWnd != IntPtr.Zero)
{
SetForegroundWindow(hWnd);
ShowWindow(hWnd, 10); // SW_SHOWDEFAULT = 10, SW_MAXIMIZE = 3, SW_SHOW = 5
}
else
{
Debug.LogWarning("GetFocusWin() failed, hWnd is 0!");
}
}
博客聚焦于信息技术领域,主要讲述了解决Unity发布的exe程序在Win7电脑上不显示输入法的问题,为相关开发人员提供了解决思路。
4798

被折叠的 条评论
为什么被折叠?



