About directdraw plane creation failed

      A few days ago, I was using DirectDraw for video display. I have encountered such a phenomenon. Of course, it is impossible to create the main plane and the backup plane when the screen is locked. Since then, I have been trying to create the main plane and the backup screen. After returning to the screen, the creation is still unsuccessful. Depressed, the returned error code turned out to be "device not supported". The problem has not been resolved since then.

      After a while, think about it in reverse, if you no longer create a plane when you know that the device is lost, but only create a plane under normal circumstances, will the problem be solved? I quickly found the function TestCooperativeLevel for detecting device loss. The usage is available on msnd. Of course, this function has been abandoned and can be replaced by the CheckDeviceState function. So the problem is solved.

      Think back to the process of solving the problem, you can consider the problem from various angles. If the creation fails, the creation cannot be successful, then I know that the creation fails, so why do I still want to create it? So after knowing that the device is lost, don't create it, only create it under normal circumstances. Wouldn't this solve the problem? . So when we look at a problem, we have to consider it from different angles.

Guess you like

Origin blog.csdn.net/myemailsz/article/details/5612247