Package com.sun.jna.ptr

Examples of com.sun.jna.ptr.PointerByReference


    }

    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 class IUnknownTest extends TestCase {
   
    private Unknown createIUnknown() {
        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);
            }

            hr = Ole32.INSTANCE.CoCreateInstance(clsid, null, WTypes.CLSCTX_SERVER,
                    IUnknown.IID_IUNKNOWN, pUnknown);

            if (W32Errors.FAILED(hr)) {
                COMUtils.checkRC(hr);
            }

            return new Unknown(pUnknown.getValue());
        } catch (Exception e) {
            e.printStackTrace();
        }
       
        return null;
View Full Code Here

        }
    }
   
    public void testQueryInterface() {
        Unknown iUnknown = this.createIUnknown();
        PointerByReference ppvObject = new PointerByReference();
        iUnknown.QueryInterface(IUnknown.IID_IUNKNOWN, ppvObject);

        assertTrue("ppvObject:" + ppvObject.toString(), ppvObject != null);
    }
View Full Code Here

        try
        {
            assertTrue(Version.INSTANCE.GetFileVersionInfo(file.getAbsolutePath(), 0, size, buffer));

            IntByReference outputSize = new IntByReference();
            PointerByReference pointer = new PointerByReference();

            assertTrue(Version.INSTANCE.VerQueryValue(buffer, "\\", pointer, outputSize));

            VerRsrc.VS_FIXEDFILEINFO fixedFileInfo = new VerRsrc.VS_FIXEDFILEINFO(pointer.getValue());
            assertTrue(fixedFileInfo.dwFileVersionLS.longValue() > 0);
            assertTrue(fixedFileInfo.dwFileVersionMS.longValue() > 0);
        }
        finally
        {
View Full Code Here

                        bmi.bmiHeader.biHeight = wh;
                        bmi.bmiHeader.biPlanes = 1;
                        bmi.bmiHeader.biBitCount = 32;
                        bmi.bmiHeader.biCompression = WinGDI.BI_RGB;
                        bmi.bmiHeader.biSizeImage = ww * wh * 4;
                        PointerByReference ppbits = new PointerByReference();
                        hBitmap = gdi.CreateDIBSection(memDC, bmi,
                            WinGDI.DIB_RGB_COLORS,
                            ppbits, null, 0);
                        pbits = ppbits.getValue();
                        bitmapSize = new Dimension(ww, wh);
                    }
                    oldBitmap = gdi.SelectObject(memDC, hBitmap);
                    Raster raster = buf.getData();
                    int[] pixel = new int[4];
View Full Code Here

            if ((w instanceof Frame && !((Frame)w).isUndecorated())
                || (w instanceof Dialog && !((Dialog)w).isUndecorated())) {
                X11 x11 = X11.INSTANCE;
                X11.WindowByReference rootp = new X11.WindowByReference();
                X11.WindowByReference parentp = new X11.WindowByReference();
                PointerByReference childrenp = new PointerByReference();
                IntByReference countp = new IntByReference();
                x11.XQueryTree(dpy, win, rootp, parentp, childrenp, countp);
                Pointer p = childrenp.getValue();
                int[] ids = p.getIntArray(0, countp.getValue());
                for (int id : ids) {
                    // TODO: more verification of correct window?
                    X11.Window child = new X11.Window(id);
                    X11.XWindowAttributes xwa = new X11.XWindowAttributes();
View Full Code Here

                bmi.bmiHeader.biPlanes = 1;
                bmi.bmiHeader.biBitCount = 32;
                bmi.bmiHeader.biCompression = WinGDI.BI_RGB;
                bmi.bmiHeader.biSizeImage = w * h * 4;
               
                PointerByReference ppbits = new PointerByReference();
                hBitmap = gdi.CreateDIBSection(memDC, bmi, WinGDI.DIB_RGB_COLORS,
                                               ppbits, null, 0);
                oldBitmap = gdi.SelectObject(memDC, hBitmap);
                Pointer pbits = ppbits.getValue();
               
                Raster raster = buf.getData();
                int[] pixel = new int[4];
                int[] bits = new int[w*h];
                for (int y=0;y < h;y++) {
View Full Code Here

          pszPath));
      assertTrue(Native.toString(pszPath).length() > 0);
    }

    public void testSHGetDesktopFolder() {
        PointerByReference ppshf = new PointerByReference();
        WinNT.HRESULT hr = Shell32.INSTANCE.SHGetDesktopFolder(ppshf);
        assertTrue(W32Errors.SUCCEEDED(hr.intValue()));
        assertTrue(ppshf.getValue() != null);
        // should release the interface, but we need Com4JNA to do that.
    }
View Full Code Here

    }

    public void testSHGetKnownFolderPath()
    {
        int flags = ShlObj.KNOWN_FOLDER_FLAG.NONE.getFlag();
        PointerByReference outPath = new PointerByReference();
        HANDLE token = null;
        GUID guid = KnownFolders.FOLDERID_Fonts;
        HRESULT hr = Shell32.INSTANCE.SHGetKnownFolderPath(guid, flags, token, outPath);

        Ole32.INSTANCE.CoTaskMemFree(outPath.getValue());

        assertTrue(W32Errors.SUCCEEDED(hr.intValue()));
    }
View Full Code Here

     *        present on all systems.
     */
    public static String getKnownFolderPath(GUID guid) throws Win32Exception
    {
        int flags = ShlObj.KNOWN_FOLDER_FLAG.NONE.getFlag();
        PointerByReference outPath = new PointerByReference();
        HANDLE token = null;
        HRESULT hr = Shell32.INSTANCE.SHGetKnownFolderPath(guid, flags, token, outPath);

        if (!W32Errors.SUCCEEDED(hr.intValue()))
        {
            throw new Win32Exception(hr);
        }

        String result = outPath.getValue().getWideString(0);
        Ole32.INSTANCE.CoTaskMemFree(outPath.getValue());

        return result;
    }
View Full Code Here

TOP

Related Classes of com.sun.jna.ptr.PointerByReference

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.