-
On my form:
Picture1 (a large blank picturebox)
Picture2 (a tiny picturebox containing a picture of the letter X)
OK, here is the problem.
Imagine a radar screen, the imaginary radar is scanning things that
can be seen on the windows desktop like open windows icons and of
course the mouse cursor.
Now, using a timer i want to update the radar screen (i'm using
picture1 for this), every second or so, the cursor being represented
by the picute of the letter X. The problem is that BITBLT will not
work if picture2 is made invisible (or even hidden behind picture1!).
So is there a way I can store the picture in an internal variable,
so i dont have to clutter up my form with superfluous pictureboxes?
Once i have got this figured out, i will use API functions to locate
the mouse cursor anywhere on the screen and then scale its position
down onto the radar screen, marking it with X (the picture that i
want held internally somehow).
This is my first intrepid venture into graphics API functions so
any help would be cool.
I hear Kedaman is an API genius, so if your out there!
-
-
Hehe, I think i just heard someone screaming for help ;)
To avoid the image on a picturebox from being erased behind another pictorebox set autoredraw to true.
You could also use Stdpicture objects instead of using pictureboxes, that saves a lot of money, ahem, i meant lot of resources and performance. On the otherhand you have to use Selectobject to attach it to a DC so that you can blit to it.
To capture the screen you could blit directly from GetDC(0) whereas the screen size can be found by using Screen.Height Screen.Width and Screen.TwipsperpixelX Screen.TwipsperpixelY. There's a lot of threads around here that takes up screenshots, just search for it ;)
It maybe harder to capture the mouse, it doesn't appear in the screenshot but you have to draw it there later on...
-
Can i blit from stdPicture objects?
I'm not really going for a screen grab. I want an outline kinda effect, like you see on air-traffic control radar monitors, y'know black background with luminous green features.
thanks Kedaman.
-
Eeh, hows the green dot's going to be determined Woss?
Yep you can blit from stdpictures if you have a DC to it ;)
-
Ok, I've settled for the easy option of just making the blit source invisible (with autoredraw this time :) ), all is now very sexy with the X swapped for a miniature version of a mouse pointer.
Right, next comes the hard bit.
I need to somehow gather position and height/width info from every application window currently running.
Do i use EnumWindows API for this? And do i need to re-gather this info everytime i refresh my "radar" (in case a window has closed) or is there a way to instantly know if a window has closed (or if a new one has opened)?
Don't ask much do I! lol
API rules, imho
-
kedaman: I'm going to use simple api functions to draw outlines of where the windows are relative to the desktop. I havent worked out how i am going to make the dots fade away after a second or so, but thats a bridge for later.
i used the GetCursorPos api to tell me where the mouse is. Its just the window positions i have to worry about now!
-
GetwindowRect should do the trick to get the positions, no you have to check instantly for the windows position, they can move, they can close anytime...
Just if you want i could send you something that draws all windows in a minimap like of thing or is it called Virtual WindowManager...