Sounds to me like it didn't create your window or your window handle is invalid. I could be wrong but something doesn't look right about extended style static edge with base style overlapped window....