Results 1 to 15 of 15

Thread: COM Objects on Windows 7 with 4.7.2

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2009
    Posts
    364
    Thanks
    10
    Thanked 37 Times in 36 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: COM Objects on Windows 7 with 4.7.2

    How exactly did you register this COM object on the new machine? Did you use regsvr32?

    btw: looking at the info on DYMO website regarding COM class factory...

    http://developers.dymo.com/2010/06/2...class-factory/

    they also have .NET samples - I suggest you try that first as I believe your troubles are not related to Qt at all but I have to agree that it is weird if you get it working by taking it out of the constructor.
    Last edited by schnitzel; 16th March 2011 at 00:00.

  2. #2
    Join Date
    Mar 2009
    Location
    Ada, OH, USA
    Posts
    11
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: COM Objects on Windows 7 with 4.7.2

    schnitzel

    I didn't need to use regsvr32 because there was an install program.

    The COM objects work because their software, a label designing application, works and prints using the same objects.

    It works in my application too, if I take the constructor out of the form constructor. Now that is strange....

    I saw those notes on the DYMO support site too, thanks for looking.

    Have I tried it on .NET? No I was a Clipper programmer back in the days of DOS, then moved to Delphi for years. I used .NET and C# on one project, but never really got comfortable with it.

    I like Qt a lot, but there is a learning curve with any software and the older I get the longer it takes me to get around the corner...

    Thanks, Keith

  3. #3
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: COM Objects on Windows 7 with 4.7.2

    Just a small comment:
    I don't see where you are deleting 'dymoAddIn' and 'dymoLabels'?

    I tried stepping through the debugger and I get lost in all the "Ax" code.
    try setting a break point in the constructor, and just let it run, see if the break point gets caught.
    It looks like this code is not getting called (for what ever reason) where it is.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  4. #4
    Join Date
    Mar 2009
    Location
    Ada, OH, USA
    Posts
    11
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: COM Objects on Windows 7 with 4.7.2

    schnitzel,

    I downloaded and installed VB express. Tried it on the DYMO .NET VB example included in the SDK. After it converted the project it compiled it and ran just fine. I was able to open the label, fill in the data fields and it printed my labels including the barcode. So I guess the COM objects are registered and working OK.

    I still can't think of a good reason I have to take the COM object instantiation out of the constructor. This project has a Main Form where I call each job from the menu by creating another form where I do the work and print my labels. Something in Qt must need to be done in the constructor before I can create these two COM objects.

    I hate it when I don't know what is going on...

    Keith

    high_flyer,

    I may be wrong, but I thought COM objects were reference counted and didn't need to be manually deleted. At least that is the way they always worked in Delphi and C#. When the last variable went out of scope that referenced the COM object the object was automatically deleted.

    Is that not true for Qt?

    Keith

  5. #5
    Join Date
    Oct 2009
    Posts
    364
    Thanks
    10
    Thanked 37 Times in 36 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: COM Objects on Windows 7 with 4.7.2

    Do they provide a C++ example? If so, are they also allocating the objects using new in the constructor?
    Last edited by schnitzel; 16th March 2011 at 23:31. Reason: updated contents

  6. #6
    Join Date
    Mar 2009
    Location
    Ada, OH, USA
    Posts
    11
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: COM Objects on Windows 7 with 4.7.2

    schnitzel,

    They have a Visual C++ example but they use CreateDispatch().

    I took my inspiration for my code from the Qt dumpcpp documentation I found here.

    I have tried lots of things and read lots and I think my usage is correct, it just won't work in the constructor of the form...

    Keith

  7. #7
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: COM Objects on Windows 7 with 4.7.2

    I may be wrong, but I thought COM objects were reference counted and didn't need to be manually deleted. At least that is the way they always worked in Delphi and C#. When the last variable went out of scope that referenced the COM object the object was automatically deleted.

    Is that not true for Qt?
    It has nothing to do with Qt.
    Regarding the reference count on COM objects, I think it depends on what kind of pointer container they are held.
    CComXXX<T> pointer does ref counts, but a plain pointer does not.
    I can't see the declaration of the pointer variable so I don't know for your case.

    You should run you application through a leak detection tool, which can also detect COM leakages to be sure.
    I'd recommend that you ask that on a COM oriented forum, where the people know these issues in more detail.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  8. #8
    Join Date
    Mar 2009
    Location
    Ada, OH, USA
    Posts
    11
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: COM Objects on Windows 7 with 4.7.2

    high_flier, can you recommend a good "leak detection tool" that works on Windows 7?

  9. #9
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: COM Objects on Windows 7 with 4.7.2

    You need more the just a leak detection tool, you need one that can also detect COM leaks (which (can be)/is trickier).
    For "regular" leak detection you can use the CRT leak detection tool:
    http://msdn.microsoft.com/en-us/libr...=vs.71%29.aspx
    In my company we use our own brewed leak detection (which basically intercepts ALL (external as well) allocations/frees before the kernel) since we didn't find anything that could handle our large code base.
    Again, you should ask that on forums that specialize with COM.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  10. #10
    Join Date
    Oct 2009
    Posts
    364
    Thanks
    10
    Thanked 37 Times in 36 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: COM Objects on Windows 7 with 4.7.2

    Taking one of their samples to try it on .NET shouldn't be too hard. You could try VB express (for free) which is very similar to Delphi. Anyway, the point is not to push you away from Qt, but to quickly try something that will show whether or not *their* stuff works.
    If they have examples for C++, then I would try to follow that as closely as possible.
    The fact that their software works might be because they do things programmatically - such as the registering a dll.

    The link I sent had a lot of posts below the article where people were having tons of trouble with registration - that didn't look good
    Last edited by schnitzel; 16th March 2011 at 15:56. Reason: updated contents

Similar Threads

  1. QSharedMemory and C++ objects
    By MattPhillips in forum Qt Programming
    Replies: 7
    Last Post: 29th November 2010, 07:42
  2. Replies: 3
    Last Post: 9th January 2010, 15:47
  3. Replies: 7
    Last Post: 18th July 2006, 21:33
  4. How to Use Objects
    By raphaelf in forum Newbie
    Replies: 1
    Last Post: 2nd June 2006, 09:59
  5. Objects and members
    By mickey in forum General Programming
    Replies: 8
    Last Post: 1st February 2006, 00:13

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.