Moved Configuration Button and catch HMENU exception
Moved the configuration button to the Advanced->Settings Menu. Also catching a cast exception from HWND to HMENU on some windows.
This commit is contained in:
@@ -43,8 +43,6 @@ import java.util.List;
|
|||||||
|
|
||||||
import org.synthuse.Api.User32Ex;
|
import org.synthuse.Api.User32Ex;
|
||||||
import org.synthuse.DragTarget.dragEvents;
|
import org.synthuse.DragTarget.dragEvents;
|
||||||
import org.synthuse.views.SynthuseConfigPanel;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//public class SynthuseDlg extends JDialog {
|
//public class SynthuseDlg extends JDialog {
|
||||||
@@ -205,13 +203,20 @@ public class SynthuseDlg extends JFrame {
|
|||||||
MsgHook.createMsgHookWinThread(lastHwndLong, lastDragPid);
|
MsgHook.createMsgHookWinThread(lastHwndLong, lastDragPid);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
if (event.getActionCommand() == "Settings") {
|
||||||
|
if(configDialog==null) {
|
||||||
|
createConfigDialog();
|
||||||
|
}
|
||||||
|
configDialog.setVisible(true);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
JMenuItem mnMessageHook = new JMenuItem("Message Hook");
|
JMenuItem mnMessageHook = new JMenuItem("Message Hook");
|
||||||
mnMessageHook.addActionListener(menuListener);
|
mnMessageHook.addActionListener(menuListener);
|
||||||
menu.add(mnMessageHook);
|
menu.add(mnMessageHook);
|
||||||
JMenuItem mnSettings = new JMenuItem("Settings");
|
JMenuItem mnSettings = new JMenuItem("Settings");
|
||||||
mnSettings.setEnabled(false);
|
mnSettings.setEnabled(true);
|
||||||
mnSettings.addActionListener(menuListener);
|
mnSettings.addActionListener(menuListener);
|
||||||
menu.add(mnSettings);
|
menu.add(mnSettings);
|
||||||
|
|
||||||
@@ -298,22 +303,6 @@ public class SynthuseDlg extends JFrame {
|
|||||||
lblTarget.setIcon(imageIcon);
|
lblTarget.setIcon(imageIcon);
|
||||||
panel.add(lblTarget, c);
|
panel.add(lblTarget, c);
|
||||||
|
|
||||||
final JButton btnConfig = new JButton("Cfg");
|
|
||||||
|
|
||||||
btnConfig.addActionListener(new ActionListener() {
|
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
if(configDialog==null) {
|
|
||||||
createConfigDialog();
|
|
||||||
}
|
|
||||||
configDialog.setVisible(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
c.gridx = 2;
|
|
||||||
c.gridwidth = 1;
|
|
||||||
panel.add(btnConfig, c);
|
|
||||||
|
|
||||||
btnFind = new JButton("Find");
|
btnFind = new JButton("Find");
|
||||||
btnFind.addActionListener(new ActionListener() {
|
btnFind.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent arg0) {
|
public void actionPerformed(ActionEvent arg0) {
|
||||||
|
|||||||
@@ -109,7 +109,12 @@ public class WindowInfo {
|
|||||||
className = Native.toString(buffer2);
|
className = Native.toString(buffer2);
|
||||||
|
|
||||||
//check if window has a menu
|
//check if window has a menu
|
||||||
HMENU hmenu = Api.User32Ex.instance.GetMenu(hWnd);
|
HMENU hmenu = null;
|
||||||
|
try {
|
||||||
|
hmenu = Api.User32Ex.instance.GetMenu(hWnd);
|
||||||
|
} catch(Exception ex) {
|
||||||
|
//ex.printStackTrace();
|
||||||
|
}
|
||||||
if (hmenu != null) { //menu item count
|
if (hmenu != null) { //menu item count
|
||||||
int menuCount = Api.User32Ex.instance.GetMenuItemCount(hmenu);
|
int menuCount = Api.User32Ex.instance.GetMenuItemCount(hmenu);
|
||||||
if (menuCount > 0) {
|
if (menuCount > 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user