现在需要获取应用程序窗口的类名 通过spy++查看的时候,应用窗口属性类名为#32770 (对话框),写在代码无法获取,该如何去修改这个类名
protected void startNotePad() throws Exception {
//"notepad.exe"为待启动的程序名
//executeProg("C://Program Files (x86)//Doxent//Doxent.exe");
executeProg("D://diaodutai//Multimedia Dispatch Platform//Dolphin.exe");
//等待NotePad.exe启动并且初始化完毕,需要根据实际情况调整sleep的时间
Thread.sleep(1000);
//"Notepad"为被嵌套程序窗口的ClassName(Win32级别),可以使用Spy++等工具查看
//int notepadHwnd = OS.FindWindow(new TCHAR(0,"ComboBox",true),null);
int notepadHwnd = OS.FindWindow(new TCHAR(0,"ComboBox",true),null);
//&~WS_BORDER去掉内嵌程序边框,这样看起来更像一个内嵌的程序。如果需要显示边框,则将这两行代码删除
int oldStyle = OS.GetWindowLong(notepadHwnd, OS.GWL_STYLE);
OS.SetWindowLong(notepadHwnd, OS.GWL_STYLE, oldStyle&~OS.WS_BORDER);
//composite为承载被启动程序的控件
OS.SetParent(notepadHwnd, composite.handle);
//窗口最大化
OS.SendMessage(notepadHwnd, OS.WM_SYSCOMMAND, OS.SC_MAXIMIZE, 0);
}