Package com.sun.jna.examples.win32.WinNT

Examples of com.sun.jna.examples.win32.WinNT.HRESULT


     * @return the string
     */
    public String GetMops(MEMBERID memid) {

        BSTRByReference pBstrMops = new BSTRByReference();
        HRESULT hr = this.typeInfo.GetMops(memid, pBstrMops);
        COMUtils.checkRC(hr);

        return pBstrMops.getString();
    }
View Full Code Here


    public ContainingTypeLib GetContainingTypeLib() {

        PointerByReference ppTLib = new PointerByReference();
        UINTByReference pIndex = new UINTByReference();

        HRESULT hr = this.typeInfo.GetContainingTypeLib(ppTLib, pIndex);
        COMUtils.checkRC(hr);

        return new ContainingTypeLib(new TypeLib(ppTLib.getValue()), pIndex
                .getValue().intValue());
    }
View Full Code Here

    private ITypeLib loadShellTypeLib() {
        // Microsoft Shell Controls And Automation
        CLSID.ByReference clsid = new CLSID.ByReference();
        // get CLSID from string
        HRESULT hr = Ole32.INSTANCE.CLSIDFromString(new WString(
                                                                "{50A7E9B0-70EF-11D1-B75A-00A0C90564FE}"), clsid);
        COMUtils.checkRC(hr);
        assertEquals(0, hr.intValue());

        // get user default lcid
        LCID lcid = Kernel32.INSTANCE.GetUserDefaultLCID();
        // create a IUnknown pointer
        PointerByReference pShellTypeLib = new PointerByReference();
        // load typelib
        hr = OleAuto.INSTANCE.LoadRegTypeLib(clsid, 1, 0, lcid, pShellTypeLib);
        COMUtils.checkRC(hr);
        assertEquals(0, hr.intValue());

        return new TypeLib(pShellTypeLib.getValue());
    }
View Full Code Here

    public void testGetTypeInfo() {
        ITypeLib shellTypeLib = loadShellTypeLib();
       
        PointerByReference ppTInfo = new PointerByReference();
        HRESULT hr = shellTypeLib.GetTypeInfo(new UINT(0), ppTInfo);
       
        COMUtils.checkRC(hr);
        assertEquals(0, hr.intValue());
        //System.out.println("ITypeInfo: " + ppTInfo.toString());
    }
View Full Code Here

    public void testGetTypeInfoType() {
        ITypeLib shellTypeLib = loadShellTypeLib();

        TYPEKIND.ByReference pTKind = new TYPEKIND.ByReference();
        HRESULT hr = shellTypeLib.GetTypeInfoType(new UINT(0), pTKind);

        COMUtils.checkRC(hr);
        assertEquals(0, hr.intValue());
        //System.out.println("TYPEKIND: " + pTKind);
    }
View Full Code Here

        ITypeLib shellTypeLib = loadShellTypeLib();
        BSTRByReference szNameBuf = new BSTRByReference(OleAuto.INSTANCE.SysAllocString("Application"));
        ULONG lHashVal = new ULONG(0);
        USHORTByReference pcFound = new USHORTByReference((short)20);

        HRESULT hr = shellTypeLib.FindName(szNameBuf, lHashVal, null, null, pcFound);

        COMUtils.checkRC(hr);
        //System.out.println("szNameBuf: " + szNameBuf);
    }
View Full Code Here

        try {
            PointerByReference pUnknown = new PointerByReference();

            // Get CLSID for Word.Application...
            CLSID.ByReference clsid = new CLSID.ByReference();
            HRESULT hr = Ole32.INSTANCE.CLSIDFromProgID("Shell.Application", clsid);

            if (W32Errors.FAILED(hr)) {
                Ole32.INSTANCE.CoUninitialize();
                COMUtils.checkRC(hr);
            }
View Full Code Here

    }

    @Override
    protected void setUp() throws Exception {
        // Initialize COM for this thread...
        HRESULT hr = Ole32.INSTANCE.CoInitialize(null);

        if (W32Errors.FAILED(hr)) {
            this.tearDown();
            throw new COMException("CoInitialize() failed");
        }
View Full Code Here

   * @return
   *  Special folder.
   */
  public static String getFolderPath(HWND hwnd, int nFolder, DWORD dwFlags) {
      char[] pszPath = new char[WinDef.MAX_PATH];
      HRESULT hr = Shell32.INSTANCE.SHGetFolderPath(hwnd,
          nFolder, null, dwFlags,
          pszPath);
      if (! hr.equals(W32Errors.S_OK)) {
        throw new Win32Exception(hr);
      }
      return Native.toString(pszPath);
  }
View Full Code Here

    public VariantTest() {
    }

    public void testVariantClear() {
        VARIANT variant = new VARIANT(new SHORT(33333));
        HRESULT hr = OleAuto.INSTANCE.VariantClear(variant.getPointer());

        assertTrue("hr: " + hr.intValue(), hr.intValue() == 0);
    }
View Full Code Here

TOP

Related Classes of com.sun.jna.examples.win32.WinNT.HRESULT

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.