本文整理汇总了Java中com.sun.jna.platform.win32.WinNT.HRESULT属性的典型用法代码示例。如果您正苦于以下问题:Java WinNT.HRESULT属性的具体用法?Java WinNT.HRESULT怎么用?Java WinNT.HRESULT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.sun.jna.platform.win32.WinNT
的用法示例。
在下文中一共展示了WinNT.HRESULT属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPattern
/**
* Gets the pointer
* @return Underlying pointer
* @throws AutomationException Automation has gone wrong
*/
private IUIAutomationSelectionPattern getPattern() throws AutomationException {
if (this.rawPattern != null) {
return this.rawPattern;
} else {
PointerByReference pbr = new PointerByReference();
WinNT.HRESULT result0 = this.getRawPatternPointer(pbr);
if (COMUtils.SUCCEEDED(result0)) {
return this.convertPointerToInterface(pbr);
} else {
throw new AutomationException(result0.intValue());
}
}
}
示例2: createWrapper
/**
* Creates the wrapper.
*/
private void createWrapper() {
CANALIZED_OLE32_INSTANCE = Canalizer.canalize(com.sun.jna.platform.win32.Ole32.INSTANCE);
CANALIZED_OLE32_INSTANCE.CoInitializeEx(Pointer.NULL, Ole32.COINIT_APARTMENTTHREADED);
PointerByReference pbr = new PointerByReference();
WinNT.HRESULT hr = CANALIZED_OLE32_INSTANCE.CoCreateInstance(
IUIAutomation.CLSID,
null,
WTypes.CLSCTX_SERVER,
IUIAutomation.IID,
pbr);
COMUtils.checkRC(hr);
unknown = new Unknown(pbr.getValue());
}
示例3: getItem
/**
* 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());
}
}
示例4: testCreateFalseCondtion
@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);
}
}
示例5: getExpandCollapsePatternFromItem
/**
* 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");
}
}
示例6: getUnityUserPath
@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;
}
示例7: getPattern
private IUIAutomationRangeValuePattern getPattern() throws AutomationException {
if (this.rawPattern != null) {
return this.rawPattern;
} else {
PointerByReference pbr = new PointerByReference();
WinNT.HRESULT result0 = this.getRawPatternPointer(pbr);
if (COMUtils.SUCCEEDED(result0)) {
return this.convertPointerToInterface(pbr);
} else {
throw new AutomationException(result0.intValue());
}
}
}
示例8: testCreateAndCondition
@Test
public void testCreateAndCondition() {
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 {
// Create first condition to use
PointerByReference pCondition0 =
instance.createPropertyCondition(PropertyID.AutomationId.getValue(), variant);
// Create first condition to use
PointerByReference pCondition1 =
instance.createPropertyCondition(PropertyID.AutomationId.getValue(), variant);
// Create the actual condition
PointerByReference andCondition =
instance.createAndCondition(pCondition0, pCondition1);
// Checking
Unknown unk = new Unknown(andCondition.getValue());
PointerByReference pUnk = new PointerByReference();
PointerByReference pUnknown1 = new PointerByReference();
WinNT.HRESULT result = unk.QueryInterface(new Guid.REFIID(IUIAutomationCondition.IID), pUnknown1);
assertTrue("CreateAndCondition:" + COMUtils.SUCCEEDED(result), COMUtils.SUCCEEDED(result));
} catch (AutomationException ex) {
assertTrue("Exception", false);
}
} finally {
OleAuto.INSTANCE.SysFreeString(sysAllocated);
}
}
示例9: getPattern
private IUIAutomationStylesPattern getPattern() throws AutomationException {
if (this.rawPattern != null) {
return this.rawPattern;
} else {
PointerByReference pbr = new PointerByReference();
WinNT.HRESULT result0 = this.getRawPatternPointer(pbr);
if (COMUtils.SUCCEEDED(result0)) {
return this.convertPointerToInterface(pbr);
} else {
throw new AutomationException(result0.intValue());
}
}
}
示例10: getPattern
private IUIAutomationGridItemPattern getPattern() throws AutomationException {
if (this.rawPattern != null) {
return this.rawPattern;
} else {
PointerByReference pbr = new PointerByReference();
WinNT.HRESULT result0 = this.getRawPatternPointer(pbr);
if (COMUtils.SUCCEEDED(result0)) {
return this.convertPointerToInterface(pbr);
} else {
throw new AutomationException(result0.intValue());
}
}
}
示例11: getPattern
private IUIAutomationWindowPattern getPattern() throws AutomationException {
if (this.rawPattern != null) {
return this.rawPattern;
} else {
PointerByReference pbr = new PointerByReference();
WinNT.HRESULT result0 = this.getRawPatternPointer(pbr);
if (COMUtils.SUCCEEDED(result0)) {
return IUIAutomationWindowPatternConverter.PointerToInterface(pbr);
} else {
throw new AutomationException(result0.intValue());
}
}
}
示例12: getPattern
private IUIAutomationTablePattern getPattern() throws AutomationException {
if (this.rawPattern != null) {
return this.rawPattern;
} else {
PointerByReference pbr = new PointerByReference();
WinNT.HRESULT result0 = this.getRawPatternPointer(pbr);
if (COMUtils.SUCCEEDED(result0)) {
return convertPointerToInterface(pbr);
} else {
throw new AutomationException(result0.intValue());
}
}
}
示例13: getElement6
/**
* 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");
}
示例14: getPattern
private IUIAutomationSelectionItemPattern getPattern() throws AutomationException {
if (this.rawPattern != null) {
return this.rawPattern;
} else {
PointerByReference pbr = new PointerByReference();
WinNT.HRESULT result0 = this.getRawPatternPointer(pbr);
if (COMUtils.SUCCEEDED(result0)) {
return convertPointerToInterface(pbr);
} else {
throw new AutomationException(result0.intValue());
}
}
}
示例15: getPointerFromElement
/**
* 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();
}