Solved

Draw on screen like in screen saver

Posted on 1998-11-11
3
171 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
  • 2
3 Comments
 
LVL 6

Accepted Solution

by:
thresher_shark earned 220 total points
Comment Utility
Answer coming...
0
 
LVL 6

Expert Comment

by:thresher_shark
Comment Utility
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
Comment Utility
Good, I think that covers it nicely.  Thank you.
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

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 …
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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 video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now