Sorry for the confusion. Like I said earlier, I'm new to Visual Studio. My background is as a C programmer using LabWindows/CVI. I didn't write this code, I was given the assignment to modify it. Since only the CWnd version of GetForegroundWindow() compiles for me, I guess that means I have an MFC app.

That being the case, my earlier question stands. How do I use the obtained handle? I need to know the CWnd* type handles of my open windows so I can somehow compare to know which one is on top but I can't find a way to do that. Can you provide an example?