Results 1 to 8 of 8

Thread: BITBLT Newbie!

  1. #1
    Guest
    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!

  2. #2
    Lively Member
    Join Date
    Aug 2000
    Posts
    125

  3. #3
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    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...
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  4. #4
    Guest
    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.

  5. #5
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Eeh, hows the green dot's going to be determined Woss?

    Yep you can blit from stdpictures if you have a DC to it
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  6. #6
    Guest
    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

  7. #7
    Guest
    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!

  8. #8
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    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...
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width