remove unused mem.h;
switch from dir.h to direct.h;
fix casts; HBRUSH/HFONT shouldn't be ptrptr
add more debugging info to TDS