Results 1 to 12 of 12

Thread: Create dll/idl to use with visual studio 2010

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jun 2012
    Posts
    98
    Thanks
    11
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Create dll/idl to use with visual studio 2010

    This isn't exactly a COM forum :P, but...

    were I to guess I'd say that in your driver (your main function or whatever you're actually trying to use the ClassFactory from) you're probably missing the "CoInitialize(null)" statement. I recently forgot to add that in and had my HRESULT on classfactory returning failure; hence my guess.

    If not that, I'll look over it again, but I'm no expert by any means.

    EDIT:
    Congrats on your quick work in COM! Kind of a cool concept/programming style when you learn about it.

  2. #2
    Join Date
    Jun 2012
    Posts
    14

    Default Re: Create dll/idl to use with visual studio 2010

    Quote Originally Posted by tescrin View Post
    This isn't exactly a COM forum :P, but...

    were I to guess I'd say that in your driver (your main function or whatever you're actually trying to use the ClassFactory from) you're probably missing the "CoInitialize(null)" statement. I recently forgot to add that in and had my HRESULT on classfactory returning failure; hence my guess.

    If not that, I'll look over it again, but I'm no expert by any means.

    EDIT:
    Congrats on your quick work in COM! Kind of a cool concept/programming style when you learn about it.
    Yes I know and I'm sorry about that. Actually I created the COM dll using QAxFactory so its not completely out of order...:P

    Thanks, but I can't say I really know everything I did. The classFactory is created through QAxFactory as I understand it and I wonder if the problems lies in how it creates the COM component. I've searched around for the error message but no solution out there seems to help me... I tried using tlbimp.exe to create an assembly from it but the same message appears again...
    I'll try to see how the CoInitialize method works, maybe you can give me an example of how to implement it with a corresponding COM method?

    I'm very thankful for you taking your time and helping me, the book you linked seems interesting, maybe take a look on buying that later.. Would be nice to get this working soon!

  3. #3
    Join Date
    Jun 2012
    Posts
    98
    Thanks
    11
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Create dll/idl to use with visual studio 2010

    Er, well so far the stuff I've done is building COM objects from scratch.

    When you call ClassFactory in C++ you have to call CoInitialize(NULL) sometime before that point; it initializes the "COM Subsystem." Every thread using COM libraries has to call it before asking the COM for anything.

    I'm not 100% sure, but I'm thinking you just need to start off your main thread (whichever is using QAxFactory) with the statement
    Qt Code:
    1. CoInitialize(NULL);
    2. //...stuff
    3. CoUninitialize(); //be nice to the poor COM subsystem :)
    To copy to clipboard, switch view to plain text mode 

  4. #4
    Join Date
    Jun 2012
    Posts
    14

    Default Re: Create dll/idl to use with visual studio 2010

    Thanks, I'll take a look at that.
    Seems like QAxFactory does all the underlying work with COM registration/initialization and so on but I'm not completely sure, it actually just should work if you read the QT docs about ActiveQT, at least that's how i understand it.

    The error I get seem to have something with security permissions issue or something, tried the solutions some people gave but nothing worked.. wondering if I should go over to C++/CLI instead...

    Thanks for all your help anyway!

Similar Threads

  1. [QT] - Include DLL in Visual Studio 2010
    By vinzz38 in forum Qt Programming
    Replies: 4
    Last Post: 3rd April 2012, 16:44
  2. Visual Studio 2010 Add-In - unable to create project
    By garaddon in forum Installation and Deployment
    Replies: 2
    Last Post: 1st January 2011, 11:40
  3. Qt and Visual Studio 2010
    By SixDegrees in forum Qt Programming
    Replies: 6
    Last Post: 15th November 2010, 19:56
  4. Visual Studio Plugin (1.1.6) crashes Visual Studio (2010)
    By mboeni in forum Installation and Deployment
    Replies: 0
    Last Post: 11th October 2010, 16:46
  5. Plan for Visual Studio 2010 (MSVC 2010)?
    By Vinzz in forum Qt Programming
    Replies: 1
    Last Post: 18th April 2010, 17:42

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.