Results 1 to 5 of 5

Thread: How do you draw on the screen?

  1. #1
    Guest

    Question

    i was wondering if it was possible to draw directly on the desktop. for example,
    screen.line (0,0)-(screen.scalewidth,screen.scaleheight)

    or something like that so you draw things directly on the desktop instead of a picture box.

    is this possible?

  2. #2
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    Of course.

    You can get the Desktop (screen) DC with two short API calls. Then draw on it with any function which draws on a DC (like BitBlt, LineTo and so on)
    Code:
    'In 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 LineTo Lib "gdi32" Alias "LineTo" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As Long
    
    'Anywhere
    Dim DC as Long
    
    'Get DC
    DC = GetWindowDC( GetDesktopWindow )
    
    'Draw Line from current pos to 100, 300
    LineTo DC, 100, 300

  3. #3
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    eh, haven't tested that yet, but i think it will erase as soon as something covers it. Seen my thread?
    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
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    That's right. As soon as you press F5 the drawed things will disappear. Also they don't stay if you move the window below...

  5. #5
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221

    Cool

    Then that's it, I'm going to sit here too with my sunglasses, waiting for someone to come up with the solution.
    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