?
Solved

Draw on screen like in screen saver

Posted on 1998-11-11
3
Medium Priority
?
178 Views
Last Modified: 2013-11-20
Hello everyone out there in computerland,

I am new to programing and was wondering how I could draw on the screen?  I mean, I want to really draw on the SCREEN like so I can see the for example lines on the desktop.  I am using MFC and Visual C++.

Thank you!
0
Comment
Question by:ADK
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 6

Accepted Solution

by:
thresher_shark earned 880 total points
ID: 1324516
Answer coming...
0
 
LVL 6

Expert Comment

by:thresher_shark
ID: 1324517
To do that, you must first create a window.  You see, the way it works is you take a COPY of the screen and put it in its own window.  Then, you can draw in the window and make it look like you're drawing on the screen.

Here is what you have to do:
- Create your app, using ClassWizard.  Select the dialog based setting.
- Delete all the buttons etc that are in the dialog using the resource editor.
- Change the properties of the dialog window in resource editor so that there is no title bar.

- Add:
   POINT pt;
   GetCursorPos (&pt);
   SendMessage (WM_SYSCOMMAND, SC_MAXIMIZE, pt.y << 16 | pt.x);

   in the "InitDialog" member function.

- Add:
  CPaintDC dc (this); // device context for painting
  CRect rect;
  GetClientRect(rect);

  dc.BitBlt (0, 0, rect.right, rect.bottom,
             GetDesktopWindow ()->GetDC (), 0, 0,
             SRCCOPY);

  to the "else" statement in the OnPaint member function.

At this point, you can draw on the screen using the CDC member functions like LineTo, PolyLine, SetPixel, etc.

If you have any further questions on how to implement this, please feel free to ask.  Thanks!
0
 

Author Comment

by:ADK
ID: 1324518
Good, I think that covers it nicely.  Thank you.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Ready to get certified? Check out some courses that help you prepare for third-party exams.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question