NO

Author Topic: windowless controls  (Read 5766 times)

czerny

  • Guest
windowless controls
« on: February 01, 2015, 08:18:13 PM »
I have read the following article:
http://blogs.msdn.com/b/oldnewthing/archive/2005/02/11/371042.aspx
Had never heared from windowless controls before.

Has anybody any experiences with such controls? A little example? Are these always ActiveX controls (I can not find anything other)?
Has the parent window of such a control to be somehow special?

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2113
Re: windowless controls
« Reply #1 on: February 01, 2015, 08:57:07 PM »
See this.
And this for usage hints.
« Last Edit: February 01, 2015, 08:58:41 PM by frankie »
"It is better to be hated for what you are than to be loved for what you are not." - Andre Gide

czerny

  • Guest
Re: windowless controls
« Reply #2 on: February 02, 2015, 12:10:54 PM »
This looks very complicated!
Are there any examples in the net of an ActiveX control written in C?

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2113
Re: windowless controls
« Reply #3 on: February 02, 2015, 01:36:17 PM »
Yes, it looks and ... it is  ;D
I'm joking, this controls use the OLE/COM interfaces. Good samples are on Codeproject from Jeff Glatt, here there is a port of that examples that I used to test my typelib generator (you may need it to create headers from Activix or OLE/COM controls).
The same is used by PellesC IDE to show web pages, and in the Mctrl library to show html pages and other.
"It is better to be hated for what you are than to be loved for what you are not." - Andre Gide

czerny

  • Guest
Re: windowless controls
« Reply #4 on: February 02, 2015, 03:33:06 PM »
Thanks for the above link. I have not known this thread of you. I will study it in the next days!

But, if I have understood it right, these all are examples, how to use such controls and not, how to write them. Right?

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2113
Re: windowless controls
« Reply #5 on: February 02, 2015, 04:17:16 PM »
If you read articles from Jeff Glatt on Codeproject he will drive you to write some basic COM in C, but it is a nosense to use C to develop COM apps...
As poor man windowless control you can code all of your control asking to the user to give you a valid window handle were to show your control. Then subclassing the window you can intercept the messaging and use that window as one created by you. Not an ActiveX nor a COM, but works...  ;)
"It is better to be hated for what you are than to be loved for what you are not." - Andre Gide

czerny

  • Guest
Re: windowless controls
« Reply #6 on: February 02, 2015, 05:59:39 PM »
I have read that one of the main causes why such windowless controls are used is/was to save window handles.
I can think of complex controls, which have lots of child controls. But this is a special situation in which all these child controls share the same parent. The parent could seen as a container window which place his window handle to the childs disposal. There would be some houskeeping but no COM.

Offline DMac

  • Member
  • *
  • Posts: 272
Re: windowless controls
« Reply #7 on: February 02, 2015, 07:51:30 PM »
My Property Grid[^] makes use of only two child handles and DrawFrameControl() for all of the various control options.  At any given time there are either either 0, 1 or 2 child handles in existence no matter the number of properties in the grid.  The same goes for the Simple grid
[^].  It is possible to minimize child handles without COM by being creative and Grid styled parent controls lend themselves to this kind of thing.
No one cares how much you know,
until they know how much you care.

czerny

  • Guest
Re: windowless controls
« Reply #8 on: February 02, 2015, 08:07:52 PM »
This is a good example. A web page is an other example.
The container window should be able to calculate which child is responsible for a mouse click. Such a calculation could be simple, in a grid for example, or more difficult like in the case from a web page. Maybe a 2-d-tree is usefull to calculate this quickly.