That must be a very old article. GetWindowThreadProcessID doesn't
return an instance handle in Win32. It returns a Process ID and a Thread ID
(the first is returned in the variable pointed to by lpdwProcessId).
It looks like the program does the right thing even though the text uses
obsolete terms. Someone probably did a half-hearted job of modernizing it.
I think if you simply substitute ProcessID for hInstance, it will make more
-GJC [MS Windows SDK MVP]
-Software Consultant (Embedded systems and Real Time Controls)