After you create the main window, add the following lines
SetWindowDisplayAffinity(hWndMain,3) ;
Now, lauch the program, take a screen shot.
Launch a window editor and paste your screen shot...
Parameter value 3 (WDA_EXCLUDEFROMCAPTURE) on MS help on SetWindowDisplayAffinity....
it did/does prevent prtsc, and IrfanView from copying the window image for the program I put
it into.
Probably there is already a workaround developed to do the capture. I imagine a device driver or system service could get around this.
It did surprise me when my program window disappeared .... 8)
John Z