Create instance

techhunt
2012-01-23
2012-11-29
  • techhunt

    techhunt - 2012-01-23

    WMIC provides CREATE verb which allows us to create a new instance.

    http://msdn.microsoft.com/en-us/library/windows/desktop/aa394531%28v=vs.85%29.aspx

    CREATE
            Creates a new instance and sets the property values. CREATE cannot be used to create a new class.

    I have to create a win32 class instance and assign properties to it. How is it possible with J-Interop?

    results = wbemServices_dispatch.callMethodA("InstancesOf", new Object{new JIString("Win32_Process"), new Integer(0), JIVariant.OPTIONAL_PARAM()});

    Does "Create"  will create an instance of Win32_process class and how to set properties for instantiated object.

     
  • Vikram Roopchand

    Hi,
         Please have a look at MSWMI.java (in the "test" package) from the j-interop source code (SVN from SF.net).

    thanks,
    best regards,
    Vikram

     
  • techhunt

    techhunt - 2012-01-24

    Thanks for response vikram.

    I followed your code. It shows how to get instances of a class but i want to know how to create an instance.

    for example i can create an instance of win32_environment class and set values to its properties using wmic tool
    command:


    wmic path Win32_environment CREATE NAME="ABC", VARIABLEVALUE="C:/Java/", username="<SYSTEM>"

    How can i achieve this using j-interop?

    does callMethodA has support to create instance?

    -Thanks
    Techhunt

     
  • techhunt

    techhunt - 2012-01-25

    To simplify my question, what are the possible strings to specify in  callMethodA to create and delete instances.

    Any help to resolve this is greatly appreciated.

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks