Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

desktop sprite

Posted on 1998-06-12
3
Medium Priority
?
384 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 800 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
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.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

971 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