本文整理汇总了Java中com.sun.jna.platform.win32.Guid类的典型用法代码示例。如果您正苦于以下问题:Java Guid类的具体用法?Java Guid怎么用?Java Guid使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Guid类属于com.sun.jna.platform.win32包,在下文中一共展示了Guid类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSelectionContainer
import com.sun.jna.platform.win32.Guid; //导入依赖的package包/类
/**
* Gets the selection container
* @return The selection container
* @throws AutomationException Something has gone wrong in automation
*/
public AutomationElement getSelectionContainer() throws AutomationException {
PointerByReference pbr = new PointerByReference();
final int res = this.getPattern().getCurrentSelectionContainer(pbr);
if (res != 0) {
throw new AutomationException(res);
}
Unknown unkConditionA = makeUnknown(pbr.getValue());
PointerByReference pUnknownA = new PointerByReference();
WinNT.HRESULT resultA = unkConditionA.QueryInterface(new Guid.REFIID(IUIAutomationElement.IID), pUnknownA);
if (COMUtils.SUCCEEDED(resultA)) {
return new AutomationElement(convertPointerToElementInterface(pUnknownA));
} else {
throw new AutomationException(resultA.intValue());
}
}
示例2: getItem
import com.sun.jna.platform.win32.Guid; //导入依赖的package包/类
/**
* Gets the element associated with the grid cell
* @param x X position
* @param y Y position
* @return The Element from the grid
* @throws AutomationException Something amiss with automation
*/
public AutomationElement getItem(int x, int y) throws AutomationException {
PointerByReference cell = this.getRawItem(x, y);
Unknown uRoot = makeUnknown(cell.getValue());
PointerByReference pbr = new PointerByReference();
WinNT.HRESULT result0 = uRoot.QueryInterface(new Guid.REFIID(IUIAutomationElement.IID), pbr);
if (COMUtils.SUCCEEDED(result0)) {
return new AutomationElement(convertPointerToElementInterface(pbr));
} else {
throw new AutomationException(result0.intValue());
}
}
示例3: getExpandCollapsePatternFromItem
import com.sun.jna.platform.win32.Guid; //导入依赖的package包/类
/**
* Gets the raw pattern from the given element.
* @param item The Element
* @return The raw collapse pattern
* @throws AutomationException Failed to get pattern
*/
public IUIAutomationExpandCollapsePattern getExpandCollapsePatternFromItem(AutomationElement item)
throws AutomationException {
PointerByReference pElement = item.getPattern(PatternID.ExpandCollapse.getValue());
Unknown unkConditionA = makeUnknown(pElement.getValue());
PointerByReference pUnknownA = new PointerByReference();
WinNT.HRESULT resultA = unkConditionA.QueryInterface(new Guid.REFIID(IUIAutomationExpandCollapsePattern.IID), pUnknownA);
if (COMUtils.SUCCEEDED(resultA)) {
return IUIAutomationExpandCollapsePatternConverter.PointerToInterface(pUnknownA);
} else {
throw new AutomationException("QueryInterface failed");
}
}
示例4: test_getItem_Throws_Exception_When_Pattern_Returns_Error_From_GetItem
import com.sun.jna.platform.win32.Guid; //导入依赖的package包/类
@Test
@Ignore("Need to build up the mocking")
public void test_getItem_Throws_Exception_When_Pattern_Returns_Error_From_GetItem() throws Exception {
Grid pattern = new Grid(rawPattern);
Grid spyPattern = Mockito.spy(pattern);
doAnswer(invocation -> new WinNT.HRESULT(0)).when(mockUnknown).QueryInterface(any(Guid.REFIID.class), any(PointerByReference.class));
IUIAutomationGridPattern mockGrid = Mockito.mock(IUIAutomationGridPattern.class);
doReturn(mockUnknown)
.when(spyPattern)
.makeUnknown(any());
AutomationElement element = spyPattern.getItem(0,0);
}
示例5: testCreateFalseCondtion
import com.sun.jna.platform.win32.Guid; //导入依赖的package包/类
@Test
public void testCreateFalseCondtion() {
UIAutomation instance = UIAutomation.getInstance();
try {
PointerByReference condition = instance.createFalseCondition();
Unknown unk = new Unknown(condition.getValue());
PointerByReference pUnknown1 = new PointerByReference();
WinNT.HRESULT result = unk.QueryInterface(new Guid.REFIID(IUIAutomationCondition.IID), pUnknown1);
assertTrue("Create FalseCondition:" + COMUtils.SUCCEEDED(result), COMUtils.SUCCEEDED(result));
} catch (AutomationException ex) {
assertTrue("Ouch", false);
}
}
示例6: testCreatePropertyCondition
import com.sun.jna.platform.win32.Guid; //导入依赖的package包/类
@Test
public void testCreatePropertyCondition() {
UIAutomation instance = UIAutomation.getInstance();
Variant.VARIANT.ByValue variant = new Variant.VARIANT.ByValue();
WTypes.BSTR sysAllocated = OleAuto.INSTANCE.SysAllocString("SOMETHING");
variant.setValue(Variant.VT_BSTR, sysAllocated);
try {
try {
PointerByReference pCondition = instance.createPropertyCondition(PropertyID.AutomationId.getValue(), variant);
Unknown unk = new Unknown(pCondition.getValue());
PointerByReference pUnknown1 = new PointerByReference();
WinNT.HRESULT result = unk.QueryInterface(new Guid.REFIID(IUIAutomationCondition.IID), pUnknown1);
assertTrue("CreatePropertyCondition:" + COMUtils.SUCCEEDED(result), COMUtils.SUCCEEDED(result));
} catch (AutomationException ex) {
assertTrue("Exception", false);
}
} finally {
OleAuto.INSTANCE.SysFreeString(sysAllocated);
}
}
示例7: testCreateTrueCondition
import com.sun.jna.platform.win32.Guid; //导入依赖的package包/类
@Test
public void testCreateTrueCondition() {
UIAutomation instance = UIAutomation.getInstance();
try {
PointerByReference pCondition = instance.createTrueCondition();
PointerByReference first = new PointerByReference();
// Check whether it is a condition
Unknown unk = new Unknown(pCondition.getValue());
PointerByReference pUnk = new PointerByReference();
Guid.REFIID refiid3 = new Guid.REFIID(IUIAutomationCondition.IID);
PointerByReference pUnknown1 = new PointerByReference();
WinNT.HRESULT result = unk.QueryInterface(refiid3, pUnknown1);
assertTrue("Create TrueCondition:" + COMUtils.SUCCEEDED(result), COMUtils.SUCCEEDED(result));
} catch (AutomationException ex) {
assertTrue("Exception", false);
}
}
示例8: getUnityUserPath
import com.sun.jna.platform.win32.Guid; //导入依赖的package包/类
@Nullable
private static String getUnityUserPath()
{
if(SystemInfo.isWinVistaOrNewer)
{
PointerByReference pointerByReference = new PointerByReference();
WinNT.HRESULT hresult = Shell32.INSTANCE.SHGetKnownFolderPath(Guid.GUID.fromString("{A520A1A4-1780-4FF6-BD18-167343C5AF16}"), 0, null, pointerByReference);
if(hresult.longValue() != 0)
{
return null;
}
return pointerByReference.getValue().getWideString(0) + "\\Unity";
}
else if(SystemInfo.isMac)
{
return SystemProperties.getUserHome() + "/Library/Unity";
}
else if(SystemInfo.isLinux)
{
return SystemProperties.getUserHome() + "/.config/unity3d";
}
return null;
}
示例9: getText
import com.sun.jna.platform.win32.Guid; //导入依赖的package包/类
/**
* Gets the text from the pattern.
*
* @return The text.
* @throws AutomationException Something has gone wrong
*/
public String getText() throws AutomationException {
PointerByReference pbr = new PointerByReference();
final int res = this.getPattern().getDocumentRange(pbr);
if (res != 0) {
throw new AutomationException(res);
}
Unknown unkConditionA = makeUnknown(pbr.getValue());
PointerByReference pUnknownA = new PointerByReference();
WinNT.HRESULT resultA = unkConditionA.QueryInterface(new Guid.REFIID(IUIAutomationTextRange.IID), pUnknownA);
if (COMUtils.SUCCEEDED(resultA)) {
IUIAutomationTextRange range = convertPointerToInterface(pUnknownA);
PointerByReference sr = new PointerByReference();
final int res1 = range.getText(-1, sr);
if (res1 != 0) {
throw new AutomationException(res1);
}
return sr.getValue().getWideString(0);
} else {
throw new AutomationException(resultA.intValue());
}
}
示例10: getAutomationElementFromReference
import com.sun.jna.platform.win32.Guid; //导入依赖的package包/类
/**
* Convert a raw PointerByReference to a IUIAutomationElement.
*
* @param pbr The raw pointer.
* @return The IUIAutomationElement.
* @throws AutomationException Automation library has thrown an error.
*/
public IUIAutomationElement getAutomationElementFromReference(final PointerByReference pbr)
throws AutomationException {
Unknown uElement = makeUnknown(pbr.getValue());
WinNT.HRESULT result0 = uElement.QueryInterface(new Guid.REFIID(IUIAutomationElement.IID), pbr);
if (COMUtils.FAILED(result0)) {
throw new AutomationException(result0.intValue());
}
return IUIAutomationElementConverter.PointerToInterface(pbr);
}
示例11: getAutomationElementArrayFromReference
import com.sun.jna.platform.win32.Guid; //导入依赖的package包/类
/**
* Convert a raw PointerByReference to a IUIAutomationElementArray.
* @param pbr The raw pointer.
* @return The IUIAutomationElementArray.
* @throws AutomationException Automation library has thrown an error.
*/
public IUIAutomationElementArray getAutomationElementArrayFromReference(final PointerByReference pbr)
throws AutomationException {
Unknown uElement = this.makeUnknown(pbr.getValue());
PointerByReference pUnknown = new PointerByReference();
WinNT.HRESULT result0 = uElement.QueryInterface(new Guid.REFIID(IUIAutomationElementArray.IID), pUnknown);
if (COMUtils.FAILED(result0)) {
throw new AutomationException(result0.intValue());
}
return IUIAutomationElementArrayConverter.PointerToInterface(pUnknown);
}
示例12: collectionToList
import com.sun.jna.platform.win32.Guid; //导入依赖的package包/类
/**
* Turns a collection (array) of automation elements, into a collection.
*
* @param collection The ElementArray.
* @return The List.
* @throws AutomationException Error in the automation library.
*/
public List<AutomationElement> collectionToList(final IUIAutomationElementArray collection)
throws AutomationException {
IntByReference ibr = new IntByReference();
final int res = collection.getLength(ibr);
if (res != 0) {
throw new AutomationException(res);
}
List<AutomationElement> list = new ArrayList<>();
for (int count = 0; count < ibr.getValue(); count++) {
PointerByReference pbr = new PointerByReference();
final int res1 = collection.getElement(count, pbr);
if (res1 != 0) {
throw new AutomationException(res1);
}
Unknown uElement = new Unknown(pbr.getValue());
WinNT.HRESULT result0 = uElement.QueryInterface(new Guid.REFIID(IUIAutomationElement.IID), pbr);
if (COMUtils.SUCCEEDED(result0)) {
IUIAutomationElement element =
IUIAutomationElementConverter.PointerToInterface(pbr);
list.add(new AutomationElement(element));
}
}
return list;
}
示例13: getPointerFromElement
import com.sun.jna.platform.win32.Guid; //导入依赖的package包/类
/**
* Gets the raw pointer to the element.
*
* @param element The underlying element.
* @return Pointer The raw pointer.
* @throws AutomationException An error has occurred in the automation library.
*/
protected Pointer getPointerFromElement(final IUIAutomationElement element)
throws AutomationException {
PointerByReference pElement = new PointerByReference();
WinNT.HRESULT result1 = element.QueryInterface(new Guid.REFIID(IUIAutomationElement.IID), pElement);
if (!COMUtils.SUCCEEDED(result1)) {
throw new AutomationException(result1.intValue());
}
return pElement.getValue();
}
示例14: getElement3
import com.sun.jna.platform.win32.Guid; //导入依赖的package包/类
/**
* Gets the IUIAutomationElement3 interface, if possible
* @return The IUIAutomationElement3 interface
* @throws AutomationException Not able to convert interface
*/
public final IUIAutomationElement3 getElement3() throws AutomationException {
PointerByReference pUnknown = new PointerByReference();
WinNT.HRESULT result = this.element.QueryInterface(
new Guid.REFIID(IUIAutomationElement3.IID), pUnknown);
if (COMUtils.SUCCEEDED(result)) {
return IUIAutomationElement3Converter.PointerToInterface(pUnknown);
}
throw new AutomationException("Failed to convert to IUIAutomationElement6");
}
示例15: getElement6
import com.sun.jna.platform.win32.Guid; //导入依赖的package包/类
/**
* Gets the IUIAutomationElement6 interface, if possible
* @return The IUIAutomationElement6 interface
* @throws AutomationException Not able to convert interface
*/
public final IUIAutomationElement6 getElement6() throws AutomationException {
PointerByReference pUnknown = new PointerByReference();
WinNT.HRESULT result = this.element.QueryInterface(
new Guid.REFIID(IUIAutomationElement6.IID), pUnknown);
if (COMUtils.SUCCEEDED(result)) {
return IUIAutomationElement6Converter.PointerToInterface(pUnknown);
}
throw new AutomationException("Failed to convert to IUIAutomationElement6");
}