CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 16

Thread: IDL Problem

  1. #1
    Join Date
    Jan 2001
    Location
    Germany
    Posts
    222

    IDL Problem

    This isn't exactly a VC++ question, but I think getting an answer is most likely in here.

    I'm developing an interface library to be used by a plug-in system using IDL. I need to reference some Visual Basic classes defined in the file VB6.OLB. I tried to import that file, but the IDL compiler doesn't really like it. If I don't import it, the IDL compiler won't know the classes I'm referring to.

    Is there any way of telling the compiler that the information about those VB classes are to be found in VB6.OLB or is there any workaround I could use?

    Regards,
    Captain Nuss
    Teamwork Software - Stuff That Does Something

  2. #2
    Join Date
    Jun 2001
    Location
    Switzerland
    Posts
    4,443
    #import "vb6.olb"

    in a cpp or a h file should do the trick. Not sure, though.
    Gabriel, CodeGuru moderator

    Forever trusting who we are
    And nothing else matters
    - Metallica

    Learn about the advantages of std::vector.

  3. #3
    Join Date
    Jun 2002
    Location
    Letchworth, UK
    Posts
    1,019
    Have you tried playing around with MIDL/RPCs in VC++. It is a sort of IDL look-alike (MS version). May be some clues there.
    Succinct is verbose for terse

  4. #4
    Join Date
    Jan 2001
    Location
    Germany
    Posts
    222
    I am actually using MIDL, didn't know there was another compiler. I've certainly already tried searching the MSDN library I got with my VS edition, but it didn't turn up anything interesting.

    I've just tried that import directive in an h file. It didn't do the trick, thanks for the idea though.
    Teamwork Software - Stuff That Does Something

  5. #5
    Join Date
    Mar 2002
    Location
    Izhevsk, Udmurtia, Russia
    Posts
    930
    May be, it helps you:
    Code:
    library PRJ1Lib
    {
    	importlib("stdole32.tlb");
    	importlib("stdole2.tlb");
    
    	importlib("......\Program Files\Microsoft Visual Studio\VB98\vb6.olb");
    
    then all interfaces which uses vb6 objects
    ...
    };
    With best wishes,
    Vita
    -----------------------
    Russian Software Development Network -- http://www.rsdn.ru

  6. #6
    Join Date
    Jan 2001
    Location
    Germany
    Posts
    222
    The compiler still doesn't recognize the objects I'm referring to. It quits with the following error message:

    midl : error MIDL9008 : internal compiler problem 0xc0000005 - the compiler cannot continue for an unknown reason. See documentation for suggestions on how to find a workaround.

    Well, I didn't find any workaround so far...

    The compiler just doesn't seem to be able to handle that olb file.

    Could I replace the class references I intend to use by references to IUnkown perhaps?
    Teamwork Software - Stuff That Does Something

  7. #7
    Join Date
    Jun 2002
    Location
    Letchworth, UK
    Posts
    1,019
    Just mentioned it because I thought you were using CORBA IDL. All the CORBA type systems generate very different code but can read the same IDL. MS IDL is very similar to CORBA IDL.
    Succinct is verbose for terse

  8. #8
    Join Date
    Jan 2001
    Location
    Germany
    Posts
    222
    I see. I've never heard of Corba IDL, that's why I didn't mention that I was actually using MIDL.
    Teamwork Software - Stuff That Does Something

  9. #9
    Join Date
    Mar 2002
    Location
    Izhevsk, Udmurtia, Russia
    Posts
    930
    My MIDL compiled this code without any warnings.

    What object of vb6.olb are used by you? Only interfaces or something other?
    With best wishes,
    Vita
    -----------------------
    Russian Software Development Network -- http://www.rsdn.ru

  10. #10
    Join Date
    Jan 2001
    Location
    Germany
    Posts
    222
    I'm trying to refer to Frame and Form. The VB Object Browser definitely says they're defined in VB6.OLB.
    Teamwork Software - Stuff That Does Something

  11. #11
    Join Date
    Mar 2002
    Location
    Izhevsk, Udmurtia, Russia
    Posts
    930
    What do you do with these objects?
    One thing that MIDL makes is an import of interfaces and data from imported TLB(OLB). No coclasses are imported.

    I do not think that these objects are really what you need.

    PS
    You should use the Frame's interface _Frame and Form's interface _Form instead.
    Last edited by Vi2; July 11th, 2002 at 12:15 PM.
    With best wishes,
    Vita
    -----------------------
    Russian Software Development Network -- http://www.rsdn.ru

  12. #12
    Join Date
    Jan 2001
    Location
    Germany
    Posts
    222
    I'm trying to realize a plug-in system in VB.

    The host application and the plug-ins shall have a way to communicate with one another, that's why I thought about defining interfaces with IDL and implementing them, providing a good way of communication.

    The host app has an Outlook-like interface: An Outlookbar at the left hand side, a grey horizontal thing at the top. Under that bar, the plug-ins' interfaces shall be shown as soon as they are selected by the user.

    I thought I'd just create a Frame where the plug-in's interface will be put in. That Frame will be shown in the host application's "plug-in area". That's what I need Frame for.

    I need Form to be able to show modal dialog boxes from a plug-in.
    Teamwork Software - Stuff That Does Something

  13. #13
    Join Date
    Mar 2002
    Location
    Izhevsk, Udmurtia, Russia
    Posts
    930
    All communications between COM objects is carried out only and only through interfaces. No coclasses are used for these purposes. The coclass is used only to retrieve the COM object needed to client. For it, it is sufficient to #import <.olb> within cpp-file (or h-file) and use them in work.

    My poor English... Sorry if it is not clearly.
    With best wishes,
    Vita
    -----------------------
    Russian Software Development Network -- http://www.rsdn.ru

  14. #14
    Join Date
    Jan 2001
    Location
    Germany
    Posts
    222
    I'm afraid I don't quite understand.

    Does that mean that I just can't use Frame and Form in my interface definitions? If so, how am I supposed to pass the needed objects to the plug-in / the application?
    Teamwork Software - Stuff That Does Something

  15. #15
    Join Date
    Mar 2002
    Location
    Izhevsk, Udmurtia, Russia
    Posts
    930
    Q: Does that mean that I just can't use Frame and Form in my interface definitions?

    Yes, of course. You should use _Frame or IDispatch interface. You cannot write
    HRESULT method([out, retval] Frame* *ppVal);
    Only
    HRESULT method([out, retval] _Frame* *ppVal);
    or
    HRESULT method([out, retval] IDispatch* *ppVal);

    In any case, the creation of VB objects is not simple task. In OLEView on vb6.olb, you can see
    Code:
    [
      uuid(33AD4EE8-6699-11CF-B70C-00AA0060D393),
      helpstring("Provides an identifiable grouping for controls."),
      helpcontext(0x000dfa26),
      noncreatable
    ]
    coclass Frame {
        [default] interface _Frame;
        [default, source] interface FrameEvents;
    };
    So there is no way to create Frame object.

    Q: If so, how am I supposed to pass the needed objects to the plug-in / the application?

    Only through their interfaces.
    With best wishes,
    Vita
    -----------------------
    Russian Software Development Network -- http://www.rsdn.ru

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured