Click here to Skip to main content
15,881,688 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Friends

I saw an application on internet which allows to create multiple flies on desktop.

Each Fly walks around Desktop easily.

Now Programmatically speaking, any idea we can create the same using Win 32 API or even MFC ?

Regards
Posted
Comments
[no name] 1-Apr-13 11:05am    
"any idea", yes plenty of ideas.

You could use plain Win32 API or MFC to make a transparent window which would probably also need to implement click-through to any window underneath, have always-on-top flags set and handle is own Non-Client paint as well as ordinary WM_PAINT messages so you can do away with the frame and caption.
There are numerous sample Code Project articles covering these things, transparency, non-client painting and always-on-top from a Win32 or MFC perspective.

An alternative would be to use the Microsoft Agent COM based API and make your self a new character. Essentially this is the technology behind the infamous 'Clippy' but your usage of it doesn't have to be hideous or annoying.

There may be other more intrusive or tricky techniques like hooking the redraw of the Desktop itself but the more sneaky the approach then generally the harder it is to make it work reliably across different Windows versions.

Either way you'll need to be a reasonable artist with a grasp of how animation works to get something realistic or fun.
 
Share this answer
 
Comments
vikrant kpr 1-Apr-13 14:01pm    
Hi
Thanks for the help.

Or can it be something like an animated gif on a transparent window.

I know of transparency settings using a color using SetLayeredWindowAttributes, but it does not produces good results


I guess Microsoft Agent COM based API would provide enogh architecture to handle animation, but i just want fly or insect to roam on desktop and for that Microsoft Agent COM would be more than asked for.

Yes you are correct, Desktop Hooking would be too much of a hastle.

Regards
Matthew Faithfull 1-Apr-13 15:05pm    
An animated GIF on a transparent window might work, you'll probably still need to handle non-client painting or at least the non-client size so as to get rid of the frame.
vikrant kpr 1-Apr-13 15:12pm    
Yeah frame is best removed for this purpose.

will try to find out a way to create a transparent window without using SetLayeredWindowAttributes

thanks for the help

Use SHGetFolderPath() function in Win32 / MFC to get path to user desktop.
Then use CreateDirectory() fucntion to create folders.
Use CreateFile() function or CFile class object to create file in the path.
 
Share this answer
 
Comments
Lukasz Gwizdz (Member 2097797) 4-Apr-13 6:55am    
Initially, I also mistook multiple flies for multiple files ;D
Regards.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900