Jul 31, 2008 7:03 AM
Need help invoking COM methods on another thread
Hello,
I'm trying to invoke methods on a COM object that was passed to me by a VB application. It works fine when methods are called from inside the Java COM server method that this object is passed into, however when I try to use that same object from a JDialog, I get the error "COM object method returns error code: 0x8001010E; The application called an interface that was marshalled for a different thread." I know the problem is that the COM object was created on another thread, but I don't know how to get it to work on my Swing thread. I've tried experimenting with the OleMessageLoop but can't make that work either.
Here is what is in my Java COM Server class:
// configuration is VB COM object
public void configure(_Configuration configuration) {
// This succeeds
System.out.println("Name: " + configuration.getName().getValue());
TestDialog dlg = new TestDialog(configuration);
dlg.setVisible(true);
}
And this is what I have inside my dialog when a button is pressed:
private void btTest_actionPerformed(ActionEvent e) {
// This fails
System.out.println("Name: " + configuration.getName().getValue());
}
Any ideas? I'm using the latest 2.4 ComfyJ libraries.
Thanks,
Dan