Solved

desktop sprite

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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 pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

762 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

20 Experts available now in Live!

Get 1:1 Help Now