code: public static<T extends Com4jObject>
      T createInstance( Class<T> primaryInterface, String clsid, int clsctx ) throws ComException {
  
          // create instance
          return new CreateInstanceTask<T>(clsid,clsctx,primaryInterface).execute();
      }
docs: Creates a new COM object of the given CLSID and returns
  it in a wrapped interface.
  
  <p>
  Compared to {@link #createInstance(Class,String)},
  this method allows the caller to specify <tt>CLSCTX_XXX</tt>
  constants to control the server instantiation.
  
  @param primaryInterface type parameter of the primaryInterface type
  @param clsid a string representation of the class id
  @param clsctx Normally this is {@link CLSCTX#ALL}, but can be any combination of {@link CLSCTX} constants.
  @param <T> the type of the return value and the type parameter of the class object of primaryInterface
  @return the new instance of the COM object
  @throws ComException if an error occurred in the native COM part
  
  @see CLSCTX