simple, you obtain the instance of you program in your WinMain function, however this is a local variable and goes out of scope when you leave that function. When you tried to load your bitmap, as a resource of your program with LoadBitmap(hInstance, "TEST"), you are telling the OS to look for a bitmap id of TEST in hInstance(your program). However since hInstance was never defined the OS did not know where to look, or actually it looked for it in whatever memory the unitialized handle(hInstance) held.

Do yourself a favor. Take this function and place it in your include files. Call it once in WinMain and forget about it. After being initialized, call this function without parameters whenever you need a handle to the current instance!
I got so tired of passing this useless variable around and I haven't missed it since!