COM argh !!

Started by
8 comments, last by Star2 21 years, 2 months ago
Im starting to learn DirectX, (DDraw7 to be specific) And I read that I have to use COM with DirectX I read a couple of tutorials, ughh ! COM IS REALLY CONFUSING, what my question is, do I need to know COM? Or can I simply learn the command to create a DirectX object with COM or whatever and then use DirectX whitout knowing anything about COM. Because its really really confusing the heck outa me. Is COM going to be important in my code after the DirectX object is created? Do I use it more after creating? And what would you personally recommed? (1.Dont worry about COM / 2.Learn DirectX and OpenGL and whatever, and then learn COM whenever you got time / 3.COM IS REAL IMPORTANT, LEARN IT BEFORE ANYTHING !!!) Thank you for your response. Oh btw. I know about www.google.com but I wont search it because this is a forum about programming and this is the right place to ask (this might be wrong forum tho, if so, please can a moderator move it to right place.)
Advertisement
How about forget COM and program using Managed DirectX 9 and the .NET framework? My understanding is that although COM is obviously an integrated part of Windows, that Microsoft are pushing the Framework as the way to go.

Flame me if you will


[edited by - Raeldor on February 28, 2003 1:13:55 AM]
you''ve seen far less than the tip of COM iceberg, so don''t get overexcited. feel free to paste COM-related code until you understand what it does sometime in future. just make sure that you release all interfaces (debug runtime will help you with this) and you''ll be fine.
quote:Original post by Raeldor
My understanding is that although COM is obviously an integrated part of Windows, that Microsoft are pushing the Framework as the way to go.

COM will be around for a while outside the managed code because
1) you can''t use .net there
2) there already exist lots of code written for COM, and that code expects its clients to use COM to talk to it
3) COM''s features are needed regardless of whether you call them COM or not
so unless ms stops supporting execution of native code on windows boxes, com will be used for a while.
quote:Original post by niyaw
you''ve seen far less than the tip of COM iceberg, so don''t get overexcited. feel free to paste COM-related code until you understand what it does sometime in future. just make sure that you release all interfaces (debug runtime will help you with this) and you''ll be fine.



Thanks for the tip, Im probably guna search on google of what COM is (not how to use it/create it), just what it is and how important of knowing it is, But for now Im just guna paste the COM-related code. To get deeper into DirectX.
quote:Im probably guna search on google of what COM is (not how to use it/create it), just what it is and how important of knowing it is, But for now Im just guna paste the COM-related code. To get deeper into DirectX.

I''ve never read any COM tutorials on the net, just the section in the dx8 docs. It was enough to get me going.

quote:Im probably guna search on google of what COM is (not how to use it/create it), just what it is and how important of knowing it is, But for now Im just guna paste the COM-related code. To get deeper into DirectX.

I''ve never read any COM tutorials on the net, just the section in the dx8 docs. It was enough to get me going.

Cheers,
Muhammad Haggag

quote:Original post by niyaw
Original post by Raeldor
My understanding is that although COM is obviously an integrated part of Windows, that Microsoft are pushing the Framework as the way to go.

COM will be around for a while outside the managed code because
1) you can''t use .net there
2) there already exist lots of code written for COM, and that code expects its clients to use COM to talk to it
3) COM''s features are needed regardless of whether you call them COM or not
so unless ms stops supporting execution of native code on windows boxes, com will be used for a while.

My point is, why write unmanaged code? As a programmer I don''t want to make my life more complicated than it already is. Programming to the Framework gives me an easy to understand hierarchical framework, garbage collection, and easy deployment. Now that''s magic!


not all libraries are available for .net yet. for those that aren''t, you have to manually prototype all methods and define all constants and such. moreover, interfacing with native code isn''t exactly the most pleasant thing to do. so .net isn''t always the better option.

granted, when .net libraries are available, they are very compelling to use over unmanaged code.
DirectX Inherits the IUnknown interface, and you only need a few Com functions:

CoCreateInstance, QueryInterface, Release, and AddRef.

CoInitialize, and CoUnitialize.

(Help me if I am forgetting something.)

Bottom line, Dont panic!
Just know why you are doing them, and where do use them, and that is enough of it.

If you want, you can look more into com.
TechleadEnilno, the Ultima 2 projectwww.dr-code.org/enilno

This topic is closed to new replies.

Advertisement