Very Simple COM Example Please

Posted on 2001-07-15
Last Modified: 2013-11-25

This is not homework

I want to write a simple com component that has a single class RandObj and a single method GetRand(ULONG range). i do not want to use any VC++ wizards MFC etc (i will later once i know how it all works), i am usung VC++ 5 though.

i need the code for the com component and a simple client that will call the component . also need istructions on what to put in the registry.

i want to use this as an in-process server so i dont need to get involved with IDL etc for the time being

i will ask another question after this on how to IDL it so it can be DCOM etc


Question by:makerp
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +1

Expert Comment

ID: 6283398
Hi Paul,

   Its the best way to start learning com.

   I suggest you to go thru Inside COM by DaleRogerson.

   He gives you an example  to write component

   using c++ ..etc

   Do read this book +vely

LVL 14

Expert Comment

ID: 6283490
In Petzold's classic book(chapter 20) you can find very
simple example of this . If yoy want, I can send you
example of code(write your EMail).
LVL 86

Expert Comment

ID: 6284010
Download the Platform SDK samples - the COM samples vome in abundance, and they also contain all 'Inside OLE' code.
Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

LVL 10

Author Comment

ID: 6284905
LVL 10

Author Comment

ID: 6284923

the order CD link is busted

i would download it but my ISP is crap and drops my connection every 2hr
LVL 86

Expert Comment

ID: 6287282
Well, a smaller sample can be found at - it demonstrates a context menu handler and several other 'neat' UI stuff, and IMHO also serves as a COM starting point...
LVL 14

Accepted Solution

AlexVirochovsky earned 100 total points
ID: 6294906
Done, sorry for delay: I havn't much free time.
LVL 10

Author Comment

ID: 6297421
magic alex, thanx, that is perfect. nice and basic,

Thanx again


Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Safe conversion? 4 86
Error creating a new C++ project in ,net 20 59
Windows ICD FFU Issue 4 106
"Video DataSource is Offline or not responding"  - why? 1 169
Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question