Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [platform-swt-dev] ActiveX fire event fails in multithreading mode (with AfxBeginThread)

SWT only supports the apartment threaded model.  You must create your
activeX control in the UI thread and perform any tasks on it from the UI
thread.
SWT uses OleCreate to create the activeX control.



                                                                                                                                                     
                      "Andras Lang"                                                                                                                  
                      <andras.lang@vanderbilt         To:      <platform-swt-dev@xxxxxxxxxxx>                                                        
                      .edu>                           cc:                                                                                            
                      Sent by:                        Subject: RE: [platform-swt-dev] ActiveX fire event fails in multithreading mode (with          
                      platform-swt-dev-admin@         AfxBeginThread)                                                                                
                      eclipse.org                                                                                                                    
                                                                                                                                                     
                                                                                                                                                     
                      11/10/2002 02:31 PM                                                                                                            
                      Please respond to                                                                                                              
                      platform-swt-dev                                                                                                               
                                                                                                                                                     
                                                                                                                                                     



Maybe I don't get this, but syncExec() and asyncExec() is used for
invoking a method from a non-UI thread...

But my (ActiveX) EventListener runs in the main UI thread:

                         layout.controlSite.addEventListener(1, new
OleListener()
{
                                     public void handleEvent(OleEvent
event) {
                                                 Shell shell =
Layout.getShell();

MessageDialog.openInformation(shell,
"activex fired me", "activex fired me");
                                     }
                         });

So I don't think this is the problem. If I am wrong, please correct me!

I tried the whole thing out in an MFC application and the application
could get the events
from the activeX component even if the event was fired in an afx thread
or even not.


> -----Original Message-----
> From: platform-swt-dev-admin@xxxxxxxxxxx
> [mailto:platform-swt-dev-admin@xxxxxxxxxxx] On Behalf Of jml
> Sent: Friday, October 11, 2002 11:37 AM
> To: platform-swt-dev@xxxxxxxxxxx
> Subject: Re: [platform-swt-dev] ActiveX fire event fails in
> multithreading mode (with AfxBeginThread)
>
>
> Just a guess, maybe should handle the event in the GUI
> thread, such as using
> display.syncExec() or display.asyncExec()?
>
> jml
> ----- Original Message -----
> From: "Andras Lang" <andras.lang@xxxxxxxxxxxxxx>
> To: <platform-swt-dev@xxxxxxxxxxx>
> Sent: Friday, October 11, 2002 7:39 AM
> Subject: [platform-swt-dev] ActiveX fire event fails in
> multithreading mode (with AfxBeginThread)
>
>
> > Hi,
> >
> >     a try to integrate an activex component into Eclipse.
> Followings:
> >
> > 1. Create a simple activex control and a simple java
> plugin. 2. Define
> > a simple fire event in the activex control. ( e.g. void
> > FireTest() )
> > 3. Start in the activex control a new thread with
> "AfxBeginThread". 4.
> > Define in the plugin a simple eventhandler for this event.
> >     (e.g.
> >         controlSite.addEventListener(1, new OleListener() {
> >             public void handleEvent(OleEvent event) {
> >                 Shell shell = parent.getShell();
> >                 MessageDialog.openInformation(shell, "activex fired
> > me", "");
> >             }
> >         });
> >     )
> > 5. In the new afx thread try to call the fire event. It
> will fail. If
> > you try to call this fire event from the main thread of the activex
> > control it
> > succeded, but from the new afx thread it will fail.
> >
> > Any thoughts?
> > Andras Lang
> >
> > _______________________________________________
> > platform-swt-dev mailing list
> > platform-swt-dev@xxxxxxxxxxx
> > http://dev.eclipse.org/mailman/listinfo/platform-swt-dev
>
> _______________________________________________
> platform-swt-dev mailing list
> platform-swt-dev@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/platfo> rm-swt-dev
>

_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/platform-swt-dev






Back to the top