Invoking Application based on UID.

"Christophe Bouhier (MC/ECM)" <[email protected]>
Newsgroups gmane.comp.windows.devel.jawin
Message-ID <6BA346EB59B2D51194E200508B046FE107DFE931@emyklnt151.ao.ericsson.se>
Hi,

I have been using jawin succesfully in my application, accessing COM through
the Dispatch interface. This easy to do, minding a well documented API (Like iTunes).

Now I try to access COM through the GUID of an application, as retrieved from the registry.
I have the feeling that I am close to the solution, but I think I am overlooking something.

Specifically I query the Registry to retrieve a file extension's 'PersistentHandler'.
Here is the code below. I can create the extend Dispatch class named "ipBrowser" but
invoking a method on it throws a COMexception.

Can someone tell me what I am doing wrong?

        ///// GET A KEY METHOD

        public static String getStringValue(int area, String keyString, String valueString) {
        int key;
        try {
                key = Registry.OpenKey(area,
                    keyString);
            String value = Registry.QueryStringValue(key, valueString);
            Registry.CloseKey(key);
            return value;
                return value;
        } catch (IOException e) {
            e.printStackTrace();
        } catch (COMException e) {
            e.printStackTrace();
        }


        ////////////////////////////////////////
        //  CREATE A
        ///////////////////////////////////////

        String id = ipRegistry.getStringValue(
                RegistryConstants.HKEY_LOCAL_MACHINE,
                "SOFTWARE\\Classes\\.htt\\PersistentHandler", "");
        try {
            Ole32.CoInitialize();
            ipBrowser browser = new ipBrowser(id);
                browser.invoke("Open","www.yahoo.com"); <<<-----------COM EXCEPTION.
            Ole32.CoUninitialize();

        } catch (COMException e) {
            e.printStackTrace();
        }

        ///////////////////////////////////////////
        // EXTEND DISPATH TO register the GUID
        //////////////////////////////////////////
        public class ipBrowser extends DispatchPtr {

        public GUID DIID;

        public int iidToken;

        public ipBrowser(String guid) {
            DIID = new GUID(guid);
            iidToken = IdentityManager.registerProxy(DIID,
                    ipLaunchBrowser.class);
        }

        /**
         * @see org.jawin.IUnknown#getIIDToken()
         */
        public int getIIDToken() {
            return iidToken;
        }

    }

Thank / Christophe
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.