Files
jlibwinapi/src/org/synthuse/WinPtr.java
Edward Jakubowski 1721d2a130 Fixed highlighting around WPF and Silverlight, fixed windows commands to use WPF runtimeIds,Adding Windows Message hook feature
When targeting WPF and silverlight applications synthuse will now target
each object with a red rectangle, just like it does with native win 32
applications.
Windows commands like setfocus and such are now supported with UIA
objects like (WPF, WinForm, Silverlight).
Adding support for hooking in to the Message Queue of a target window to
see what Messages are being sent, this will allow one to possible resend
the messages back for automation purposes.  This feature is not fully
working yet, but is close.
2014-05-21 08:12:11 -04:00

71 lines
1.4 KiB
Java

/*
* Copyright 2014, Synthuse.org
* Released under the Apache Version 2.0 License.
*
* last modified by ejakubowski7@gmail.com
*/
package org.synthuse;
import com.sun.jna.platform.win32.WinDef.HWND;
public class WinPtr {
public HWND hWnd = null;
public String hWndStr = "";
public String runtimeId = "";
public String hmenuStr = "";//store menu handle
public int hmenuPos = -1;//store menu position or id
public WinPtr() {
}
public WinPtr(HWND hWnd) {
this.hWnd = hWnd;
this.hWndStr = Api.GetHandleAsString(hWnd);
}
public WinPtr(String runtimeId) {
this.runtimeId = runtimeId;
}
public boolean isWin32() {
return (hWnd != null || !hWndStr.equals(""));
}
public boolean isWpf() {
return (!runtimeId.equals(""));
}
public boolean isEmpty() {
return (hWnd == null && hWndStr.equals("") && runtimeId.equals(""));
}
public static boolean isWpfRuntimeIdFormat(String runtimeIdTest) {
return (runtimeIdTest.contains("-"));
}
public void convertToNativeHwnd()
{
if (isWpfRuntimeIdFormat(runtimeId)){
hWndStr = runtimeId.split("-")[1];
hWnd = Api.GetHandleFromString(hWndStr);
}
}
public String toString() {
if (isWin32() && !hWndStr.equals(""))
return hWndStr;
else if (isWin32() && hWnd != null)
{
hWndStr = Api.GetHandleAsString(hWnd);
return hWndStr;
}
else if (isWpf())
return runtimeId;
else
return null;
}
}