This Question is Answered

2 "helpful" answers available (2 pts)
4 Replies Last post: Jan 27, 2010 4:02 PM by Yuriy Privezentsev  
asc   2 posts since
Jan 20, 2010
Currently Being Moderated

Jan 20, 2010 4:57 PM

ComException 0x8000FFFF; E_UNEXPECTED from generated code

Hello,

 

I have generated Code from an ocx file using CodegenForComfyJ.bat.

 

When I run the following code...

 

public class DirectSkinTest {
   
    public static void main(String[] args) {
        DefaultLibraryLoader.getInstance().addPath(".");
       
        ComFunctions.coInitialize();

 

        final _DWbocx lib = Wbocx.create(ClsCtx.INPROC_SERVER);
        lib.setRootPath(new Int16(1));
    }

 

}

 

...I get this exception:

 

Exception in thread "main" com.jniwrapper.win32.com.ComException: COM object method returns error code: 0x8000FFFF; E_UNEXPECTED (Schwerwiegender Fehler)
    at com.jniwrapper.win32.com.impl.IUnknownImpl.invokeStandardVirtualMethod(SourceFile:744)
    at com.jniwrapper.win32.com.impl.IUnknownImpl.invokeStandardVirtualMethod(SourceFile:723)
    at com.jniwrapper.win32.automation.impl.IDispatchImpl.invoke(SourceFile:112)
    at com.jniwrapper.win32.automation.Automation$InvocationHelper.a(SourceFile:1121)
    at com.jniwrapper.win32.automation.Automation$InvocationHelper.a(SourceFile:1112)
    at com.jniwrapper.win32.automation.Automation$InvocationHelper.invoke(SourceFile:1099)
    at com.jniwrapper.win32.automation.Automation.a(SourceFile:914)
    at com.jniwrapper.win32.automation.Automation.invoke(SourceFile:891)
    at com.jniwrapper.win32.automation.Automation.invoke(SourceFile:964)
    at com.jniwrapper.win32.automation.Automation.invokeDispatch(SourceFile:1221)
    at directskin.wbocxlib.impl._DWbocxImpl.setRootPath(_DWbocxImpl.java:235)
    at DirectSkinTest.main(DirectSkinTest.java:19)

 

What's wrong with my code and how can I fix it?

 

I have the following setup:

Windows XP

ComfyJ 2.7

comfyj.lic, jniwrap.lic, jniwrap.dll and the ocx file are contained in the directory where the application is executed (which I add in the above method).

 

The generated code and the ocx file from which it was generated are attached to this post.

 

Thanks in advance,

ASC

Attachments:
Serge Piletsky TeamDev Ltd. 1,066 posts since
Apr 24, 2006
Currently Being Moderated
1. Jan 21, 2010 6:26 PM in response to: asc
Re: ComException 0x8000FFFF; E_UNEXPECTED from generated code

Hi,

 

Thanks for contacting our support and providing the complete example to reproduce the issue.

 

We will investigate it and let you know the solution soon.

 

-Serge

Yuriy Privezentsev TeamDev Ltd. 78 posts since
Jan 19, 2010
Currently Being Moderated
2. Jan 26, 2010 3:45 PM in response to: asc
Re: ComException 0x8000FFFF; E_UNEXPECTED from generated code

Hello,

 

for working with OCX component you should do initialization steps as it stated in our programmers guide section 4.5: http://www.teamdev.com/downloads/comfyj/docs/ComfyJ-PGuide.html#AEN418 .

 

Corrected sample code will look like this:

public class DirectSkinTest {
 
    public static void main(String[] args) {
        DefaultLibraryLoader.getInstance().addPath(".");
     
        ComFunctions.coInitialize();
 
        final _DWbocx lib = Wbocx.create(ClsCtx.INPROC_SERVER);
       
        IUnknown ocxComponentWrapper = lib;
        IOleObjectImpl oleObject = new IOleObjectImpl(ocxComponentWrapper);
        // Initialize storage
        ILockBytesImpl lockBytes = (ILockBytesImpl)
         StorageFunctions.createILockBytesOnHGlobal(new GlobalMemoryBlock(), true);
        IStorage storage = StorageFunctions.stgCreateDocfileOnILockBytes(lockBytes,
        new StgMode(StgMode.STGM_READWRITE |
         StgMode.STGM_SHARE_EXCLUSIVE | StgMode.STGM_CREATE),
        new Int32());
        // Initialize persist storage
        IPersistStorageImpl persistStorage = new IPersistStorageImpl();
        oleObject.queryInterface(persistStorage.getIID(), persistStorage);
         persistStorage.initNew(storage);
      
        lib.setRootPath(new Int16(1));
 
    }
}

 

Regards,
Yuriy.

Yuriy Privezentsev TeamDev Ltd. 78 posts since
Jan 19, 2010
Currently Being Moderated
4. Jan 27, 2010 4:02 PM in response to: asc
Re: ComException 0x8000FFFF; E_UNEXPECTED from generated code

Hello,

 

you really would not have to do these additional steps if you use that OCX control in GUI mode.  Since OCX is a visual component you just need to embed it into OleContainer, which will do initialization steps for you.

 

Regards,

Yuriy.

More Like This

  • Retrieving data ...