|
|
Up |
|
  |
Author: NobodyNobody Date: Aug 25, 2007 15:03
Hi,
Now that I can make custom controls,
http://www.codeproject.com/miscctrl/customcontrol.asp
I would like to move to the next step.
So, I guess I would like to turn my control into a COM / ActiveX control to use with VB/C# and ASP web pages.
And just to get some experience with COM / ActiveX.
I noticed something on one ActiveX control that I stumbled upon.
It is not inheriting from CWnd. It inherits from COleControl
COleControl inherits from CWnd. (That is good)
Now, I am wondering what all that entails.
"In a windowless control, you should always use the COleControl member functions instead of the
corresponding CWnd member functions or their related Windows API functions."
I suppose what they mean by this, is that an ActiveX control is a Windowless control and I have to use COleControl member functions.
That sounds reasonable...
Well, some of the methods are not the same.
virtual void COleControl::OnDraw(CDC* pDC, const CRect& rcBounds, const CRect& rcInvalid );
differs from CWnd::OnDraw(CDC* pDC);
|
| Show full article (2.92Kb) |
|
| | 9 Comments |
|
  |
Author: Ajay KalraAjay Kalra Date: Aug 25, 2007 23:55
On Aug 25, 9:03 am, "Nobody" yahoo.com> wrote:
> Hi,
>
> Now that I can make custom controls, http://www.codeproject.com/miscctrl/customcontrol.asp
> I would like to move to the next step.
>
> So, I guess I would like to turn my control into a COM / ActiveX control to use with VB/C# and ASP web pages.
> And just to get some experience with COM / ActiveX.
>
> I noticed something on one ActiveX control that I stumbled upon.
> It is not inheriting from CWnd. It inherits from COleControl
> COleControl inherits from CWnd. (That is good)
>
> Now, I am wondering what all that entails.
>
> "In a windowless control, you should always use the COleControl member functions instead of the
> corresponding CWnd member functions or their related Windows API functions."
> I suppose what they mean by this, is that an ActiveX control is a Windowless control and I have to use COleControl member functions.
> That sounds reasonable...
> ...
|
| Show full article (3.28Kb) |
|
| | no comments |
|
  |
Author: David ChingDavid Ching Date: Aug 26, 2007 06:27
> Nothing specfic about your issue but you should not be using MFC to
> develop activex controls which are deployed over the web. ATL is
> significantly better as its lightweight.
>
Frankly a 300 KB ActiveX control written in MFC is no big deal anymore?
-- David
|
| |
| no comments |
|
  |
Author: NobodyNobody Date: Aug 26, 2007 10:19
Hi,
> Nothing specfic about your issue but you should not be using MFC to
> develop activex controls which are deployed over the web. ATL is
> significantly better as its lightweight.
> On Aug 25, 9:03 am, "Nobody" yahoo.com> wrote:
>> Hi,
>>
>> Now that I...
|
| Show full article (4.28Kb) |
| no comments |
|
  |
Author: Giovanni DicanioGiovanni Dicanio Date: Aug 26, 2007 11:57
> Nothing specfic about your issue but you should not be using MFC to
> develop activex controls which are deployed over the web. ATL is
> significantly better as its lightweight.
IMHO, ATL (and WTL) is more complex than MFC. One can be a good C++
programmer and use MFC proficiently; OTOH, ATL and WTL are heavily based on
templates, and other C++ advanced tricks. And the error messages with
templates are more obscure, too.
Of course, ATL offers more control for COM development than MFC offers. But,
if this ATL power is not required, I think that MFC would be just fine for
ActiveX development.
And I think that the "lightweight" argument about ATL vs MFC is now
obsolete. It could be a good argument when people had 56kbps modems... but
now with fast ADSL lines the lightweight argument is no more, IMHO.
Giovanni
|
| |
| no comments |
|
  |
Author: Ajay KalraAjay Kalra Date: Aug 26, 2007 14:10
> IMHO, ATL (and WTL) is more complex than MFC. One can be a good C++
> programmer and use MFC proficiently; OTOH, ATL and WTL are heavily based on
> templates, and other C++ advanced tricks. And the error messages with
> templates are more obscure, too.
That is probably true for most of us but there is no way for us to
judge OPs skills in this area. Besides the right answer is still not
to use MFC for this unless you have a reason for it. ATL was developed
for this purpose only and it continues to be leader in this area.
---
Ajay
|
| |
| no comments |
|
  |
Author: Ajay KalraAjay Kalra Date: Aug 26, 2007 14:13
On Aug 26, 12:27 am, "David Ching" remove-this.dcsoft.com>
wrote:
>> Nothing specfic about your issue but you should not be using MFC to
>> develop activex controls which are deployed over the web. ATL is
>> significantly better as its lightweight.
>
> Frankly a 300 KB ActiveX control written in MFC is no big deal anymore?
>
> -- David
MFC has significant shortcomings as to what it offers to develop COM
components compared to ATL. It stops well short of what a COM
component can deliver. I still kind of disagree with lightweight
argument though. Also IIRC,, MFC is almost 1MB in release build and
its not only the download speed; IE would be loading these components
as well.
|
| Show full article (0.83Kb) |
| no comments |
|
  |
Author: David ChingDavid Ching Date: Aug 26, 2007 14:45
> MFC has significant shortcomings as to what it offers to develop COM
> components compared to ATL. It stops well short of what a COM
> component can deliver.
I agree. But the main disadvantage of MFC that I remember is it only uses
IDispatch and not dual interface. Maybe that doesn't matter.
> I still kind of disagree with lightweight
> argument though. Also IIRC,, MFC is almost 1MB in release build and
> its not only the download speed; IE would be loading these components
> as well.
>
1 MB? You can develop an ActiveX control in like 150 KB, statically linked
of course!
-- David
|
| |
| no comments |
|
  |
Author: Giovanni DicanioGiovanni Dicanio Date: Aug 26, 2007 16:41
>> IMHO, ATL (and WTL) is more complex than MFC. One can be a good C++
>> programmer and use MFC proficiently; OTOH, ATL and WTL are heavily based
>> on
>> templates, and other C++ advanced tricks. And the error messages with
>> templates are more obscure, too.
>
> That is probably true for most of us but there is no way for us to
> judge OPs skills in this area.
You are correct.
> Besides the right answer is still not
> to use MFC for this unless you have a reason for it. ATL was developed
> for this purpose only and it continues to be leader in this area.
If the OP can master ATL, I agree with you: ATL is the leader tool for COM
development.
Giovanni
|
| |
| no comments |
|
  |
|
|
  |
Author: Ajay KalraAjay Kalra Date: Aug 26, 2007 16:46
> statically linked of course!
:-)
---
Ajay
|
| |
| no comments |
|
|