Thats because CreateProcess just immediately returns, so the window isn't fully created yet when you call FindWindow.

If you look at CreateProcess on MSDN it stats in the 'Remarks' section that you can use WaitForIdleInput to wait until the process has completed loading.