[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.tools] Re: NewWindow2 Event and Shell.Explorer OLE

Does anyone know how to affect the output paramters of the IDispatch
events using the Ole?   Specifically for writing out the new Shell.Explorer
Ole object's appropriate values for the NewWindow2 event into the ppDisp
parameter.

Thanks

Terry Heath wrote:

> Hello,
>
> I am looking for some help in using the Shell.Explorer using Ole in
> eclipse.  We would like to capture the NewWindow2 event and disable new
> windows from popping up.   We need to do this since the newly opened
> explorer windows are actually new processes and do not share the same
> session cookies or credentials.
>
> Ultimately we need a new explorer window created in the same process as
> the Shell.explorer.   To do this we have found that we can create our
> own SWT popup window with another Shell.Explorer in it, and we then end
> up sharing the same session cookies.      To Cancel the NewWindow2
> event, we currently Move the VARIANT_TRUE value into the Cancel param of
> the following event like the following.
>
>   controlSite.addEventListener(NewWindow2, new OleListener() {
>            public void handleEvent(OleEvent event1) {
>
>                         //  get the referenece to the Cancel parameter
>                         Variant cancelRef = event1.arguments[1];
>
>                         if (cancelRef != null) {
>                                 int ptr = cancelRef.getByRef();
>                                 Variant v = new Variant(-1);  // -1 is
> the same as VARIANT_TRUE
>                                 COM.MoveMemory(ptr, new int[] {(int)
> v.getInt()}, 4);
>                         }
>
>                         //     At this point I would like to create my
>                         //     new Ole  Shell.Explorer and the set the
>                         //    event.arguments[0] value to whatever the
>                         //    correct value should be, however I don't
> know how.
>                         //
>                         //    Here is the Signature of the NewWindow2
>                         //    event from MSDN.
>                         //    Private Sub object_NewWindow2(
>                         //            ByRef ppDisp As Object,
>                         //            ByRef Cancel As Boolean
>                         //    )
>
>                         return;
>             }
>      });
>
> This is how I would create the Shell.Explorer, something like the
> following:
>
>     controlSite = new OleControlSite(frame, SWT.NONE, "Shell.Explorer");
>
>     int s = controlSite.doVerb(OLE.OLEIVERB_PRIMARY);
>     oleAutomation = new OleAutomation(controlSite);
>
> How would I copy the new IDispatch back to the ppDisp parameter of the
> NewWindow2 event.
>
> Any help is always greatly appreciated.
>
> Thanks,
> Terry  Heath