CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    May 1999
    Posts
    54

    How to call COM components in VB client.

    Hi,
    I have a simple COMcomponent which implements the method Sum(), which is developed in VC++ environment.
    I wanted to write a VB client for it. Can any body tell me how to call COM interfaces through VB .

    Thanx
    kiru



  2. #2
    Join Date
    May 1999
    Posts
    3,332

    Re: How to call COM components in VB client.

    go to Project/References menu in the VB Development Environment and add you COM component's Typelib (probably part of your COM DLL) to the references.
    Then hit F2 to start the object browser.
    You can see all objects and methods of that component.
    Instantiate an object of your component:
    dim x as new yourprogid
    (or use: set x = createobject("yourprogid"))
    call the method

    dim lResult as long
    lResult = x.Sum






  3. #3
    Join Date
    May 1999
    Posts
    54

    Re: How to call COM components in VB client.

    Thanx for replying.
    Can U suggest me some books for VB with COM or some sites on net or articles in MSDN.
    Once again Thanking U

    kiru


  4. #4
    Join Date
    May 1999
    Posts
    3,332

    Re: How to call COM components in VB client.

    the best source that I know of is: MSDN and the online documentation that comes with VB.
    You might also want to check out the MSPress site for some VB books.


  5. #5
    Join Date
    Aug 1999
    Location
    US, Florida
    Posts
    817

    Re: How to call COM components in VB client.

    You don't have to buy any books tho, www.informit.com ...sign up and read almost anybook for FREE, including those on COM components


  6. #6
    Join Date
    May 1999
    Posts
    54

    Re: How to call COM components in VB client.

    HI,
    I tried creating Com object through the CreateObject() function in VB. But it is givng an error "Activex component can't create object".
    I tried same with VB script. It is working fine.
    Can U tell me what is the problem in VB.

    Thanx
    kiran


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