Cypher, stealthy here - want you to know I still want you to have my babies and it's good to see you around still :P
Also,
You should call GetLastError DIRECTLY after you call the API (well, it doesn't necessarily have to be directly after, but it does need to be before any other statements with side-effects that could affect its value).
Stop that logic shit.