Results 1 to 5 of 5

Thread: How i create "Flying" objects ???

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jun 2000
    Posts
    16

    Arrow

    somebody know how i can create a flying object without the forms...
    like the cat program with the little cat that runs after your mouse pointer, or the sheep that stops on opens windows...

    ????
    Tal Zur!

  2. #2
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    I think I know which programs you mean... What they do is draw on the screen directly (get the desktop DC and draw on it). To clean before drawing the next picture they backup the region, that's all...

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Jun 2000
    Posts
    16

    Question

    could you be more specific please...
    how do i get the desktop dc?
    how do i draw on it?

    thanks...
    Tal Zur!

  4. #4
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    Sure. You can work with the API, I'll show you some examples:

    Code:
    'Module
    Public Declare Function GetDesktopWindow Lib "user32" Alias "GetDesktopWindow" () As Long
    Public Declare Function GetWindowDC Lib "user32" Alias "GetWindowDC" (ByVal hwnd As Long) As Long
    Public Declare Function BitBlt Lib "gdi32" Alias "BitBlt" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
    
    'Code
    Dim DC as Long
    
    'Get the DC
    DC = GetWindowDC( GetDesktopWindow )
    
    'Draw picture1 on it
    BitBlt DC, 10, 20, 100, 100, Picture1.hDC, 0, 0, vbSrcCopy
    This will draw the picture loaded in Picture1 on the desktop. 10, 20 is the desired position on the destination dc, next 2 values are the size (Put in Picture1.Width, Picture1.Height to get size automatically). Picture1.hDC is the DC of the picture and the next 2 values are the position on the source DC where the picture is. And vbSrcCopy tells BitBlt to just copy the picture (So no transparency)

    For any Qs you can also visit my homepage where I have some demo projects about BitBlt...

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Jun 2000
    Posts
    16

    Wink

    Thanks!
    Tal Zur!

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