some handy code about windows programming