COM Interface Question

Discussion in 'Python' started by Olaf Meding, Apr 29, 2004.

  1. Olaf Meding

    Olaf Meding Guest

    I am having trouble with the 'User' property (get and put), found near
    the bottom of the IDL file listed below. The user get call seems to
    return None, not sure why.

    More importantly, is there another way to get the 'IUser' value
    required for the user put call? (Perhaps I need to make the put call
    before the get call).

    Sorry for the long IDL file, tried to delete a lot of non-relevant
    code. Thanks so much for your help on this one.

    Olaf


    // ERFile.idl : IDL source for ERFile.dll
    //

    // This file will be processed by the MIDL tool to
    // produce the type library (ERFile.tlb) and marshalling code.

    import "oaidl.idl";
    import "ocidl.idl";

    [
    uuid(bf79b6c5-47be-11d2-bacd-006008060a3a),
    version(1.0),
    helpstring("ERFile 1.0 Type Library")
    ]
    library ERFile
    {
    importlib("stdole32.tlb");
    importlib("stdole2.tlb");


    [
    object,
    uuid(bf79b6c7-47be-11d2-bacd-006008060a3a),
    dual,
    helpstring("IERecord Interface"),
    pointer_default(unique),
    nonextensible,
    hidden
    ]
    interface IUser : IDispatch
    {
    [id(1), helpstring("method Login")]
    HRESULT Login([in] BSTR Username, [in] BSTR Password);

    code deleted here

    };


    [
    object,
    uuid(bf79b6c9-47be-11d2-bacd-006008060a3a),
    dual,
    helpstring("IERecord Interface"),
    pointer_default(unique),
    nonextensible,
    hidden
    ]
    interface IERecord : IDispatch
    {
    [propget, id(1), helpstring("property User")]
    HRESULT User([out, retval] IUser* *pVal);

    [propput, id(1), helpstring("property User")]
    HRESULT User([in] IUser *newVal);

    code delted here

    };

    code delted here
    };
    Olaf Meding, Apr 29, 2004
    #1
    1. Advertising

  2. Olaf Meding

    Mark Hammond Guest

    Olaf Meding wrote:

    > I am having trouble with the 'User' property (get and put), found near
    > the bottom of the IDL file listed below. The user get call seems to
    > return None, not sure why.


    Possibly as the property has no value yet. After a successful set, you
    may find it works.

    > More importantly, is there another way to get the 'IUser' value
    > required for the user put call? (Perhaps I need to make the put call
    > before the get call).


    It depends on the application - there will generally be either a progid
    (so Dispatch() can create one), or some technique in the object model
    for creating one. The last alternative is that they expect you to
    implement this interface, but with the limited information available
    here, that sounds unlikely.

    Mark.
    Mark Hammond, Apr 30, 2004
    #2
    1. Advertising

  3. Olaf Meding

    Olaf Meding Guest

    Mark

    The IDL shows a uuid for the IUser interface (bf79...). How would I use
    IDispatch() to create an IUser as required by the put user call?

    Here are excerpts from the IDL file:
    [
    object,
    uuid(bf79b6c7-47be-11d2-bacd-006008060a3a),
    dual,
    helpstring("IERecord Interface"),
    pointer_default(unique),
    nonextensible,
    hidden
    ]
    interface IUser : IDispatch

    interface IERecord : IDispatch
    {
    [propput, id(1), helpstring("property User")]
    HRESULT User([in] IUser *newVal);



    Again, your help is much appreciated.

    Olaf
    Olaf Meding, Apr 30, 2004
    #3
  4. Olaf Meding

    Mark Hammond Guest

    Olaf Meding wrote:

    > Mark
    >
    > The IDL shows a uuid for the IUser interface (bf79...). How would I use
    > IDispatch() to create an IUser as required by the put user call?
    >
    > Here are excerpts from the IDL file:


    There is nothing in that IDL that implies it can be created by an
    IDispatch call - it is just describing the interface. Generally a
    CoClass entry in the IDL indicates it can be publically created, but you
    haven't shown that - but in that case, the makepy code will include a
    comment telling you the progid, so I doubt it exists.

    Surely there is documentation or a sample (in any language) for this object?

    Mark.
    Mark Hammond, Apr 30, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Wildepiet
    Replies:
    0
    Views:
    1,850
    Wildepiet
    Jun 14, 2004
  2. cyberco
    Replies:
    8
    Views:
    480
    cyberco
    Feb 25, 2006
  3. Xah Lee
    Replies:
    15
    Views:
    573
    Sherm Pendley
    Mar 23, 2007
  4. Xah Lee
    Replies:
    15
    Views:
    620
    Sherm Pendley
    Mar 23, 2007
  5. Replies:
    4
    Views:
    336
    timjowers
    Nov 2, 2007
Loading...

Share This Page