Solved

desktop sprite

Posted on 1998-06-12
3
336 Views
Last Modified: 2008-02-01
how would one move a graphical object (drawing/ sprite)  across the desktop?

it's not just a transparent createwindow() is it?
if some-one can tell me how/ where to draw it... I'll figure out how to move it...
I'm currently using Visual C++ v.5...or MASM.... thanks tons...

jack
0
Comment
Question by:hjack
  • 2
3 Comments
 
LVL 6

Expert Comment

by:WxW
ID: 1165717
You can get the desktop handle by using GetDesktopWindow() .
I am not sure , but I believe you can get a DC of the desktop ( GetDC(GetDesktopWindow()) ) , and you are able to draw using the HDC functions .
Feel free to ask me if you want something about the HDC functions , but I do not know how to move a drawn object - you have to find the algorithms yourself
0
 
LVL 22

Accepted Solution

by:
nietod earned 200 total points
ID: 1165718
answer coming.
0
 
LVL 22

Expert Comment

by:nietod
ID: 1165719
You can draw in the desktop just as WxW suggested.  but that is likely to have problems.  You may draw on top of icons and then you have to get the icons repainted that sort of thing.  It might be necessarry to go with that approach, but I would try something different first.

I would try to create a window that you can draw in and move that window.  Now this approach might be too slow.  But if not, it is probably the best solution.  (It is less likely to lead to nasty problems now or in the future,.)  

What you should do is create a borderless window and use SetWindowRgn to set the window to the shape of th sprite.  Then you just draw the sprite inside the window durring the WM_PAINT event.  You move the sprite using MoveWindow() or SetWindowPos().

That's just a sketch to the approach I would take.  If you have questions, ask.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

777 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