| 1001010.com |
one zero zero one zero one zero dot com |
A DLL Import class wrapper generator
http://codeproject.com/dll/LateLoad.asp
TestRectangle.h (html)
September 22, 2005 - so we were talking about detecting overlaping rectangles. The first draft blew chunks because it relied on having a least one corner inside another rectangle.
The real solution is to find the union of the two rectangles. If there's no union there's no overlap.
See bool TestRectangle::GetUnion(const TestRect & other, TestRect * result) const
Counting the set bits - September 21, 2005
inline size_t countSetBits(unsigned value)
{
size_t result = 0;
while(value)
{
if( value & 0x1 )
{
result++;
}
value >>= 1;
}
return result;
}
RecycleStack.h (html)
September 21, 2005 - Yet another conversation with friends that turned into a coding exercise
Knowing that allocs/reallocs are expensive, we need a high performance
stack structure for ints that is extreemly memory efficient
The first draft solution was a collection of some straight C functions and a transparent stack struct that over realloced in 16 node blocks
This is a little bit different,
1) we make two simple singly linked lists, one is the active stack and
the other is the recycle stack
2) every time we "pop" from the active stack, we move the node object
onto the recycle stack
3) when adding a node to the active stack, we check if we can take one
from the recycle stack before allocating more memory
4) It's templatized so we're no longer limited to ints
wtl_fake.idl Fix for the non-functioning
"Insert > New ATL Object..." in DevStudio6
The problem was that for WTL application projects created in DevStudio6, the WTL
3 wizard didn't create a valid idl file nor the appropriate OBJECT_MAP entries.
This usually isn't an issue, but when you want "New ATL Object..." - it becomes
a minor annoyance. Instructions are included in the idl file.
Just do me a favor - change the GUID before you use it.
cursor.h - a general Purpose HCURSOR wrapper for
WTL, MFC, or even Win32. It's something I wrote a few years back when I
cared about Win95 compatibility for something as simple as a link cursor ;-)
I tried to make a syntax highlighted preview by
copy'n'pasting from DevStudio6 with WholeTomato in RTF & then saving it to HTML,
but I'm not happy with the results. Most of the colors are right -
but the tabbed indents are all out of whack. Hmm, I wonder how CodeProject
does their code syntax highlighting for all the code articles?
Other stuff...
To be posted later