WPF and regular Win32 windows are now supported
Added support for dragging target on WPF windows and building simple xpath statements. Fixed some null results in native library and increased performance of enumerating wpf windows. Still need to tweak filters for picking up Silverlight handles too.
This commit is contained in:
52
src/org/synthuse/WinPtr.java
Normal file
52
src/org/synthuse/WinPtr.java
Normal file
@@ -0,0 +1,52 @@
|
||||
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 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 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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user