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)

No, the event handler was not called, so there weren't any exception stack traces.
Like Veronika Irvine said SWT uses the single apartment thread model.
So every invocation should be called from the main UI thread.
That is what I did and it solved the problem.

Thanks to everyone.

> -----Original Message-----
> From: platform-swt-dev-admin@xxxxxxxxxxx 
> [mailto:platform-swt-dev-admin@xxxxxxxxxxx] On Behalf Of jml
> Sent: Friday, October 11, 2002 4:30 PM
> To: platform-swt-dev@xxxxxxxxxxx
> Subject: Re: [platform-swt-dev] ActiveX fire event fails in 
> multithreading mode (with AfxBeginThread)
> 
> 
> just curious. when you say the activex fire event in non-ui 
> thread, it will fail, can you describe what's the behavior of 
> this failing? is your event handler get called? is there any 
> exception stack trace?
> 
> jml
> 
> ----- Original Message ----- 
> From: "Andras Lang" <andras.lang@xxxxxxxxxxxxxx>
> To: <platform-swt-dev@xxxxxxxxxxx>
> Sent: Saturday, October 12, 2002 3:52 AM
> Subject: RE: [platform-swt-dev] ActiveX fire event fails in 
> multithreading mode (with AfxBeginThread)
> 
> 
> > So, you are saying that when I create an ActiveX control in my java
> > plug-in:
> > 
> > - Only the main thread of the ActiveX control is able to 
> fire an event 
> > which the java plug-in will catch?
> > 
> > - What if I create another thread from the main thread of 
> the ActiveX 
> > control and this another thread will fire an event? I could 
> not catch 
> > that event in my java plug-in?
> > 
> > Thanks,
> > Andras Lang
> > 
> > > -----Original Message-----
> > > From: platform-swt-dev-admin@xxxxxxxxxxx
> > > [mailto:platform-swt-dev-admin@xxxxxxxxxxx] On Behalf Of 
> > > Veronika Irvine
> > > Sent: Friday, October 11, 2002 2:17 PM
> > > To: platform-swt-dev@xxxxxxxxxxx
> > > Subject: 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/platfo> rm-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
> ¦V­~Šæ³ 
> ]zùšŠX§‚X¬¶™Zµú+šÌ-uëÞrX©±ê+‚m§ÿÝz÷œ–*lzŠàþf¢–f§þX¬¶)ߣúej×è®k0µ×¯
> 



Back to the top