Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++
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 1-Apr-13 5:56am
Comments
ThePhantomUpvoter at 1-Apr-13 11:05am
   
"any idea", yes plenty of ideas.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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.
  Permalink  
Comments
vikrant kpr at 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 at 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 at 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
 
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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.
  Permalink  
Comments
Lukasz Gwizdz (Member 2097797) at 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)



Advertise | Privacy | Mobile
Web03 | 2.8.1411023.1 | Last Updated 4 Apr 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100