Great work!!!
Your algorithm is not very complex but it looks impressive!
To Canon:
Try to build this with the PocketFrog 0.7.0 and EVC.
The compile problem in VC6 comes from the unicode. If you want to build it in VC6, there are something you need to change:
* Check all the string, modify them like this:
L"..."
TEXT("...")
* Change wsprintf to _stprintf
Maybe it works this time, if I haven't missed anything I changed.
If you want, I can give you the VC6 compilable version.