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
Solved

desktop sprite

Posted on 1998-06-12
3
341 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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

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…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
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.

808 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