Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. This COM thing is real cool!

This COM thing is real cool!

Scheduled Pinned Locked Moved The Lounge
tutoriallearningcsharpc++com
53 Posts 20 Posters 4 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Nish Nishant

    Michael P Butler wrote: .NET is based upon COM, without COM then .NET wouldn't exist Can you elaborate more on that statement? Nish Sonork ID 100.9786 voidmain www.busterboy.org If you don't find me on CP, I'll be at Bob's HungOut

    M Offline
    M Offline
    Michael P Butler
    wrote on last edited by
    #41

    I'll leave it to the experts to elaborate, they can probably explain it better than I can http://msdn.microsoft.com/msdnmag/issues/1200/com/com1200.asp Michael :-)

    1 Reply Last reply
    0
    • N Nish Nishant

      Yipppeee! I wrote my first COM thingie :-) Of course it's only the example in the book. But despite the fact that I knew what to expect I was still thrilled, so thrilled I can't control my excitement. I mean I wrote the DLL, registered it. Then I used it from VB. Cool eh? Then I used it from ASP. Cooler eh? I haven't figured out how to use it from C++ though :-( But damnit, I mean this is so cool. I mean why did MS bother with .NET when they already had this COM thing? I mean, what's the bloody purpose! I am the newbiest COM newbie in this planet currently. But even I can see that it is so damn cool! Yippeee again...... How many COMites are here? Is Mike Dunn the only COMite Guru we have? Or is he still in those final pre-guru stages which take the longest period of time in the Guru attainment procedure? Coli, are you hearing this buddy? I am a COMite now. Halley's COMite :-) Regards COM newbie Nish Sonork ID 100.9786 voidmain www.busterboy.org If you don't find me on CP, I'll be at Bob's HungOut

      J Offline
      J Offline
      Jim A Johnson
      wrote on last edited by
      #42

      EEeewww. COM Sucks. That's not a childish put-down; it's a succinct technical assessment.

      M 1 Reply Last reply
      0
      • J Jim A Johnson

        EEeewww. COM Sucks. That's not a childish put-down; it's a succinct technical assessment.

        M Offline
        M Offline
        Michael P Butler
        wrote on last edited by
        #43

        Any particular area? As somebody who loves the COM programming lifestyle I'd be interested to know why you think it sucks. Michael :-)

        1 Reply Last reply
        0
        • N Nish Nishant

          Yipppeee! I wrote my first COM thingie :-) Of course it's only the example in the book. But despite the fact that I knew what to expect I was still thrilled, so thrilled I can't control my excitement. I mean I wrote the DLL, registered it. Then I used it from VB. Cool eh? Then I used it from ASP. Cooler eh? I haven't figured out how to use it from C++ though :-( But damnit, I mean this is so cool. I mean why did MS bother with .NET when they already had this COM thing? I mean, what's the bloody purpose! I am the newbiest COM newbie in this planet currently. But even I can see that it is so damn cool! Yippeee again...... How many COMites are here? Is Mike Dunn the only COMite Guru we have? Or is he still in those final pre-guru stages which take the longest period of time in the Guru attainment procedure? Coli, are you hearing this buddy? I am a COMite now. Halley's COMite :-) Regards COM newbie Nish Sonork ID 100.9786 voidmain www.busterboy.org If you don't find me on CP, I'll be at Bob's HungOut

          M Offline
          M Offline
          Matt Philmon
          wrote on last edited by
          #44

          Here's some lessons for ya: 1) If your COM object is a STA (Single Threaded Apartment) and you put threads in that apartment, ALWAYS include a message pump. You can add a message pump very easily by adding CWindowImpl to your derivations and adding the message pump. Then, while waiting on your threads to complete their task, process window messages in a loop. Otherwise, you'll freeze. 2) I find that though it's often very tedious and is a nightmare for C++ use of your object, you should usually opt for IDispatch as your interface. IUnknown is much easier and much nicer with types, but limits you heavily (no VB or ASP). 3) If you have a multithreaded STA that uses other STA's, ALWAYS ALWAYS ALWAYS marshal your interfaces. In something like a simple dialog application (MFC) passing around your STA object (smart pointer) by pointer is fine in the same thread. However, don't do this in multithreaded applications. It will work sometimes.... but will often screw you up in hard to find/debug ways. Marshalling is always the way to go and it won't hurt you to use it if you don't need it. 4) If your COM object is written in ATL and IDispatch derived, be prepared to use BSTR and VARIANT's. VB and Scripting simply can't deal with anything else appropriately and you'll frequently find hard to debug problems if you get it working without it. Best of luck! ;)

          N 1 Reply Last reply
          0
          • C Christian Graus

            Nish [BusterBoy] wrote: In Indian money that'd be a pretty decent amount of money Really ? I presume you mean US$ ( AU$5.50 an hour ), but even then - I make a bit over AU$20 an hour and I make half what I'd expect to make if I moved to the mainland, at a minimum. No wonder people keep posting for Indian programmers. I know if I needed any work done, I'd pay you US$3 an hour in a second, then lie awake at night feeling guilty that it was so, so little. I don't think anyone beyond street mimes and paper boys get $3 an hour, it's just my standard response, as in when I get poor service from McDonalds or the local supermarket I will call the manager and say 'I know it's hard getting decent staff when you pay $3 an hour, but...', or if my daughter doesn't get her toy with her happy meal, I tell her it's because the people who work there are monkeys who work for $3 an hour. Christian I have come to clean zee pooollll. - Michael Martin Dec 30, 2001 Picture the daffodil. And while you do that, I'll be over here going through your stuff. Picture a world without war, without hate. And I can picture us attacking that world, because they would never expect it.

            Sonork ID 100.10002:MeanManOz

            I live in Bob's HungOut now

            N Offline
            N Offline
            Nish Nishant
            wrote on last edited by
            #45

            The average Indian software engineer makes between Rs 15,000 to 25,000 per month which is cosidered pretty good here. Lets assume he works 25 days a month averaging 8 hrs a day. That gives us 200 hrs. Thus for 15,000 he makes Rs 75 /hr which is US$ 1.60 and the 25000 guy makes Rs 125 an hr which is USD 2.65 If you offer someone $3 per hr for 200 hrs a month he'd jump for it :-) Nish Sonork ID 100.9786 voidmain www.busterboy.org If you don't find me on CP, I'll be at Bob's HungOut

            R 1 Reply Last reply
            0
            • N Nish Nishant

              Jon Sagara wrote: Sorry Nish, that was another lame play on words by yours truly. I don't know what the correct terminology is. I know Jon. That's why I put the wink-smiley. I was simply playing along with the joke :-) Nish Sonork ID 100.9786 voidmain www.busterboy.org If you don't find me on CP, I'll be at Bob's HungOut

              J Offline
              J Offline
              Jon Hulatt
              wrote on last edited by
              #46

              Didn't you know that Stalin created ATL ? Sorry to dissapoint you all with my lack of a witty or poignant signature.

              N 1 Reply Last reply
              0
              • K Kannan Kalyanaraman

                Nish [BusterBoy] wrote: My grammar sucks like Lotus Notes, Just out of curiosity, what makes you think Lotus Notes sucks... Cheers Kannan

                D Offline
                D Offline
                dandy72
                wrote on last edited by
                #47

                Personally, it's Lotus Notes that makes me think Lotus Notes sucks. - DanielD

                1 Reply Last reply
                0
                • N Nish Nishant

                  The average Indian software engineer makes between Rs 15,000 to 25,000 per month which is cosidered pretty good here. Lets assume he works 25 days a month averaging 8 hrs a day. That gives us 200 hrs. Thus for 15,000 he makes Rs 75 /hr which is US$ 1.60 and the 25000 guy makes Rs 125 an hr which is USD 2.65 If you offer someone $3 per hr for 200 hrs a month he'd jump for it :-) Nish Sonork ID 100.9786 voidmain www.busterboy.org If you don't find me on CP, I'll be at Bob's HungOut

                  R Offline
                  R Offline
                  Roger Wright
                  wrote on last edited by
                  #48

                  Before you get any offers, Nish, be sure to stipulate that you have to be allowed to telecommute. If you tried to live here, for instance, on $3/hr, you'd have to live in a ditch, bathe in the river, and the only meal you'd be able to afford would be from McDonald's. And that would only be a couple of meals a week...

                  A N 2 Replies Last reply
                  0
                  • R Roger Wright

                    Before you get any offers, Nish, be sure to stipulate that you have to be allowed to telecommute. If you tried to live here, for instance, on $3/hr, you'd have to live in a ditch, bathe in the river, and the only meal you'd be able to afford would be from McDonald's. And that would only be a couple of meals a week...

                    A Offline
                    A Offline
                    abc
                    wrote on last edited by
                    #49

                    Let's start a global campaign to get Nish a job in one of the rich countries so that he can contribute to the following items: tax to support George W or Tony B, rent to keep the landlord happy, charity please various churches, education for the next two generations, welfare for the unemployed, healthcare for the poor, defense budget to start a few more wars in the middle-east, ... ;)

                    N 1 Reply Last reply
                    0
                    • R Roger Wright

                      Before you get any offers, Nish, be sure to stipulate that you have to be allowed to telecommute. If you tried to live here, for instance, on $3/hr, you'd have to live in a ditch, bathe in the river, and the only meal you'd be able to afford would be from McDonald's. And that would only be a couple of meals a week...

                      N Offline
                      N Offline
                      Nish Nishant
                      wrote on last edited by
                      #50

                      By $3/hr I meant working from India. In the US that'd automatically go to $50 an hr Nish Sonork ID 100.9786 voidmain www.busterboy.org If you don't find me on CP, I'll be at Bob's HungOut

                      1 Reply Last reply
                      0
                      • A abc

                        Let's start a global campaign to get Nish a job in one of the rich countries so that he can contribute to the following items: tax to support George W or Tony B, rent to keep the landlord happy, charity please various churches, education for the next two generations, welfare for the unemployed, healthcare for the poor, defense budget to start a few more wars in the middle-east, ... ;)

                        N Offline
                        N Offline
                        Nish Nishant
                        wrote on last edited by
                        #51

                        abc wrote: defense budget to start a few more wars in the middle-east, ... Geez!!!! Nish Sonork ID 100.9786 voidmain www.busterboy.org If you don't find me on CP, I'll be at Bob's HungOut

                        1 Reply Last reply
                        0
                        • J Jon Hulatt

                          Didn't you know that Stalin created ATL ? Sorry to dissapoint you all with my lack of a witty or poignant signature.

                          N Offline
                          N Offline
                          Nish Nishant
                          wrote on last edited by
                          #52

                          I thought it was Hitler. By the way are the rumours about Saddam Hussain being behind .NET true? Nish Sonork ID 100.9786 voidmain www.busterboy.org If you don't find me on CP, I'll be at Bob's HungOut

                          1 Reply Last reply
                          0
                          • M Matt Philmon

                            Here's some lessons for ya: 1) If your COM object is a STA (Single Threaded Apartment) and you put threads in that apartment, ALWAYS include a message pump. You can add a message pump very easily by adding CWindowImpl to your derivations and adding the message pump. Then, while waiting on your threads to complete their task, process window messages in a loop. Otherwise, you'll freeze. 2) I find that though it's often very tedious and is a nightmare for C++ use of your object, you should usually opt for IDispatch as your interface. IUnknown is much easier and much nicer with types, but limits you heavily (no VB or ASP). 3) If you have a multithreaded STA that uses other STA's, ALWAYS ALWAYS ALWAYS marshal your interfaces. In something like a simple dialog application (MFC) passing around your STA object (smart pointer) by pointer is fine in the same thread. However, don't do this in multithreaded applications. It will work sometimes.... but will often screw you up in hard to find/debug ways. Marshalling is always the way to go and it won't hurt you to use it if you don't need it. 4) If your COM object is written in ATL and IDispatch derived, be prepared to use BSTR and VARIANT's. VB and Scripting simply can't deal with anything else appropriately and you'll frequently find hard to debug problems if you get it working without it. Best of luck! ;)

                            N Offline
                            N Offline
                            Nish Nishant
                            wrote on last edited by
                            #53

                            Thanks Matt. It didnt make 100% sense to me, but thanks anyway. I read it once. That should be useful for me later when I actually get to some marshalling or stubbing or whatever :-) Nish Sonork ID 100.9786 voidmain www.busterboy.org If you don't find me on CP, I'll be at Bob's HungOut

                            1 Reply Last reply
                            0
                            Reply
                            • Reply as topic
                            Log in to reply
                            • Oldest to Newest
                            • Newest to Oldest
                            • Most Votes


                            • Login

                            • Don't have an account? Register

                            • Login or register to search.
                            • First post
                              Last post
                            0
                            • Categories
                            • Recent
                            • Tags
                            • Popular
                            • World
                            • Users
                            • Groups