I am having a bit of a problem working with very simple c++ rules regarding the Windows API functions.
I understand why a struct must be initialized but am having problems doing so using the Windows API's.
Now if you look where I am using the ZeroMemory() function, I was just trying to make things work.
I know that normally the syntax is something along these lines for initializing your structs size:
PROCESS_INFORMATION pi = sizeof(PROCESS_INFORMATION);
or
PROCESS_INFORMATION pi = sizeof(STRUCTURE HERE); // Pseudo'ish
So can anyone provide me the clarification on correctly initializing any structs size so I can continue reading my book and working through the examples? It seems every example I run into the compiler keeps telling me I am doing things wrong. When I search on the MSDN, I rarely find the answer I am looking for. Thanks to all in advance for the clarification.
Oh by the way, this code is giving me an error 87, which is ERROR_INVALID_PARAMETER "The parameter is incorrect."
The backslash in C and C++ string literals are escape characters. If you want a single backslash, you must write two backslashes. Then the cast you do is awful. The Windows SDK provides the TEXT() macro. Use it.
And I see no problem in your use of ZeroMemory().
EDIT: I see a BIG problem in your use of ZeroMemory(). :P hehe. Sorry.
I also knew about the escape characters as well and can't believe I made such a rookie mistake. It's probably because I was reading a book and the MSDN and I lost my train of thought. The MSDN is great at doing that to me as I branch off to 50 other links.