You are not passing the flag WS_VISIBLE to capCreateCaptureWindow, so I would assume it to be invisible by default. In the first call to the ShowWindow method, the nCmdShow parameter is ignored, so it may very well not be using SW_HIDE there even though you explicitly specify it.

Simply change your code to now call ShowWindow(SW_HIDE) and hopefully the window should remain invisible.