Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

New to COM programming, where to start?

5 views
Skip to first unread message

Uwe Kotyczka

unread,
Apr 11, 2008, 7:11:28 AM4/11/08
to
Hallo, I'm new to COM programming.

I have a MFC (MDI) application, say B.exe, which has no COM support
yet.
Now a I have to write a new app A.exe (which will be MFC as well),
which must be able to open a document of B.exe in it's own surface.
Just as a PDF document is shown within InternetExplorer and not
opened in Adobe Reader.

I think COM will be the right thing to do so. A.exe would be the
client
and B.exe the server. Next thing is that not only B.exe has to be
automated, but a whole bunch of EXEs, some of which written with MFC,
others written in Delphi.

With no idea of the details of COM I started reading about it and
find a lot of different approaches. Can someone please recommend me
where to start? I am looking for some article suiting my situation
or for some example which solves a similar task.

TIA

Ajay Kalra

unread,
Apr 11, 2008, 7:56:24 AM4/11/08
to
What you see in IE is an ActiveX control for Adobe. You will need to have
the same functionality for your control. Its been a long time since I did
this. Before jumping onto COM programming , look at what MFC offers. IIRC,
there was something about inplace activation (From OLE) that was part of it
that may be what you need. Also look at codeguru/codeproject and see if
there is any sample on these lines.

---
Ajay

"Uwe Kotyczka" <uwe.ko...@web.de> wrote in message
news:0ac96a20-c6fb-4aba...@m36g2000hse.googlegroups.com...

Francis

unread,
Apr 11, 2008, 4:25:10 PM4/11/08
to

Uwe Kotyczka schreef:

COM is not always needed. For example a webbrowser that can both
display HTML and PDF files can be achieved with plain object oriented
programming techniques.

I think we need a little more specific information in order to provide
you with really helpful information.


Grtz,

Francis

Ajay Kalra

unread,
Apr 11, 2008, 4:37:09 PM4/11/08
to
On Apr 11, 4:25 pm, Francis <francis.ramme...@gmail.com> wrote:
> Uwe Kotyczka schreef:
>
>
>
> > Hallo, I'm new to COM programming.
>
> > I have a MFC (MDI) application, say B.exe, which has no COM support
> > yet.
> > Now a I have to write a new app A.exe (which will be MFC as well),
> > which must be able to open a document of B.exe in it's own surface.
> > Just as a PDF document is shown within InternetExplorer and not
> > opened in Adobe Reader.
>
> > I think COM will be the right thing to do so. A.exe would be the
> > client
> > and B.exe the server. Next thing is that not only B.exe has to be
> > automated, but a whole bunch of EXEs, some of which written with MFC,
> > others written in Delphi.
>
> > With no idea of the details of COM I started reading about it and
> > find a lot of different approaches. Can someone please recommend me
> > where to start? I am looking for some article suiting my situation
> > or for some example which solves a similar task.
>
> > TIA
>
> COM is not always needed. For example a webbrowser that can both
> display HTML and PDF files can be achieved with plain object oriented
> programming techniques.

OP is talking about displaying equivalent of PDF in a webbrowser.You
will need some sort of COM technology to do it. OOP is a style of
programming and not a technology which will yield this result. These
are two orthogonal issues.

---
Ajay


Christian ASTOR

unread,
Apr 11, 2008, 4:54:55 PM4/11/08
to
Uwe Kotyczka wrote:

> With no idea of the details of COM I started reading about it and
> find a lot of different approaches. Can someone please recommend me
> where to start? I am looking for some article suiting my situation
> or for some example which solves a similar task.

For creating an OLE Server,
The well-known MSDN sample is Scribble
The best book was "Inside OLE 2" (Kraig Brockschmidt)

Francis

unread,
Apr 13, 2008, 4:12:38 PM4/13/08
to
> > COM is not always needed. For example a webbrowser that can both
> > display HTML and PDF files can be achieved with plain object oriented
> > programming techniques.
>
> OP is talking about displaying equivalent of PDF in a webbrowser.You
> will need some sort of COM technology to do it. OOP is a style of
> programming and not a technology which will yield this result. These
> are two orthogonal issues.

OO allows you to write factory methods like this:

enum Format
{
HTML,
PDF,
etc...
};

Renderer * CreateRenderer(Format format)
{
if(format == HTML)
{
return new HTMLRender();
}
else if(format == PDF)
{
return new PDFRenderer();
}
}

Under the hood this may use COM or not. Since COM is quite complicated
it may be preferable to use simpler OO constructs.

Grtz,
Francis

Ajay Kalra

unread,
Apr 13, 2008, 9:19:40 PM4/13/08
to
On Apr 13, 4:12 pm, Francis <francis.ramme...@gmail.com> wrote:
> > > COM is not always needed. For example a webbrowser that can both
> > > display HTML and PDF files can be achieved with plain object oriented
> > > programming techniques.
>
> > OP is talking about displaying equivalent of PDF in a webbrowser.You
> > will need some sort of COM technology to do it. OOP is a style of
> > programming and not a technology which will yield this result. These
> > are two orthogonal issues.
>
> OO allows you to write factory methods like this:
>
> enum Format
> {
> HTML,
> PDF,
> etc...
>
> };
>
> Renderer * CreateRenderer(Format format)
> {
> if(format == HTML)
> {
> return new HTMLRender();
> }
> else if(format == PDF)
> {
> return new PDFRenderer();
> }
>
> }
>
> Under the hood this may use COM or not.

I am not sure there is choice. The point I am making is that you will
need COM to write the control. Whether you use OO is a mute point. Its
orthogonal to what OP is asking.

--
Ajay
]

Francis

unread,
Apr 14, 2008, 8:59:39 AM4/14/08
to

Do you simply want your new application to support multiple document
formats. Or do you want your new application to be able to plugin
runnable code from the other applications?

Uwe Kotyczka

unread,
Apr 15, 2008, 8:39:16 AM4/15/08
to
> Do you simply want your new application to support multiple document
> formats. Or do you want your new application to be able to plugin
> runnable code from the other applications?

The latter.

What I would like is that my new application has
a main frame and several child frames. And each
child frame will be the main frame of one of the
other applications. That would be perfect.

I found http://www.codeproject.com/KB/COM/mfc_autom.aspx
quite useful, but that doesn't solve the task in
the parent/child frame manner I do imagine.

Francis

unread,
Apr 16, 2008, 12:22:05 PM4/16/08
to
On Apr 15, 2:39 pm, Uwe Kotyczka <uwe.kotyc...@web.de> wrote:
> > Do you simply want your new application to support multiple document
> > formats. Or do you want your new application to be able to plugin
> > runnable code from the other applications?
>
> The latter.

Then indeed you need COM.

> What I would like is that my new application has
> a main frame and several child frames. And each
> child frame will be the main frame of one of the
> other applications. That would be perfect.
>

> I foundhttp://www.codeproject.com/KB/COM/mfc_autom.aspx


> quite useful, but that doesn't solve the task in
> the parent/child frame manner I do imagine.

It's probably hard to create such an application if you aren't
familiar with COM. I am no expert on it either though. Maybe it's
worth looking into the Google code and Sourceforge archives for sample
code. It helped me when I needed to create an Internet Explorer
plugin.

0 new messages