Type Of Memory In A Control?
I'm busy here designing my first fully-fledged Windows control, as in, it responds to all the different messages and draws properly and stuff. But one question's been sticking in my mind...
The control is a bit like an edit control in that it maintains a buffer of data that it displays. I want developers to be able to change the buffer's pointer so it can display what they've just loaded in from a file, for example. The first thing I did was look at the edit control's EM_GETHANDLE and EM_SETHANDLE messages. These use handles to "local memory objects" rather than pointers from malloc that my classical training implores me to churn out.
This got me thinking: in doing this type of message, I would be enforcing a particular type of memory allocator on the developer. Although LocalAlloc, HeapAlloc, GlobalAlloc, etc. all generally get their handles from the same place these days, malloc and new could be from anywhere, given the smell that comes from the C/C++ runtime libraries on a hot day. :rolleyes:
So, should I require a type of Windows memory for my Windows control, or is this a misnomer and they're all the same in the end anyway?