Solved

Draw on screen like in screen saver

Posted on 1998-11-11
3
176 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 220 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ODBC Connection Logging, ADO.NET 6 73
Execute multiple curl cmds with sleep and send output to file 10 121
x-bar in Google Sheets 2 129
Capture logon name 13 119
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
In this post we will learn different types of Android Layout and some basics of an Android App.
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.
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

738 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