error checking and storing hInstance