How to draw to screen in c++?

前端 未结 4 732
一个人的身影
一个人的身影 2021-02-06 08:09

How would I draw something on the screen ? not the console window but the entire screen, preferably with the console minimised.

Also, would it show up on a printscreen ?

4条回答
  •  悲哀的现实
    2021-02-06 08:55

    in windows you can use the GetDC-function. just a minimalistic example:

    #include 
    #include 
    
    void drawRect(){
        HDC screenDC = ::GetDC(0);
        ::Rectangle(screenDC, 200, 200, 300, 300);
    ::ReleaseDC(0, screenDC);
    }
    int main(void){
        char c;
        std::cin >> c;
        if (c == 'd') drawRect();
        std::cin >> c;
        return 0;
    }
    

    but since Windows Vista it is very slow

提交回复
热议问题