The code you gave should not compile on any compiler period! Let alone give any error messages when run. I can not remember ever seeing so many basic programming errors. If by some miricle it did run, then (Yep) it would probubly crash. Heck you stand a better chance of crashing the whole system than making that code work (as written). As for VirtualQueryEx: Why are you even trying to call it? The call appears to be used to retrieve information that needs to be stored in the structure pointed to by lpBuffer, but lpBuffer does not point to a structure, it points to NULL. The only reason the dwLength argument is correct, is that it is 0, since lpBuffer is NULL. You are also passing it a 5th argument GetLastError, for who knows what reason (it only takes 4 arguments and this is not one of them). I recomend you start all over again from scatch. What ever it is you are trying to accomplish, this will not do it. P.S. Sorry but if I was an employer, the code you gave would get you fired. INTP "The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes." Andrew W. Troelsen