Win32 C++ Programming Pitfalls
Solutions for Unexpected Performance

Problem:GetOpenFileName() hangs.
Symptoms:Open file common dialog doesn't appear, program freezes.
Solution: Be sure to null-terminate the string you pass in the lpstrFile member of the OPENFILENAME structure before calling GetOpenFileName(). ZeroMemory() works for me. See this thread on comp.os.ms-windows.programmer.win32.
 
Problem:Window won't open.
Symptoms:Program works fine, then after some changes your window won't display.
Solution:If you're using a global HWND variable to point at your window, be sure that you don't use this handle within your WM_CREATE message-handling clause *without* first setting it to the HWND parameter passed to your window procedure.