1 [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] 2 static extern int GetClassName(IntPtr hWnd, StringBuilder lpClassName, int nMaxCount);
1 StringBuilder sb = new StringBuilder(256); 2 GetClassName(hMainWnd, sb,sb.Capacity);//WindowsForms10.STATIC.app.0.3598b65_r16_ad1 来截取后面系统编译生成的后缀
3 string suffix = string.IsNullOrEmpty(sb.ToString()) ? "" : sb.ToString().Replace("WindowsForms10.Window.8.app","");//之后按 已确定窗口类+后缀 查找