Results 1 to 8 of 8

Thread: GetDesktopDC?

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Israel
    Posts
    636

    GetDesktopDC?

    Hi!

    I want tot know if there is any function to get
    the desktop DC, and load it before my form goes up?

    My target is to make a picture with a white back, and
    then use SetPixel and GetPixel to make the white part
    transparent.
    understand me?
    If there's other way of making it, tell me...

    Thank you,
    Arie.

  2. #2
    Fanatic Member PsychoMark's Avatar
    Join Date
    Feb 2001
    Location
    Netherlands
    Posts
    540
    Code:
    Private Declare Function GetDesktopWindow Lib "user32" () As Long
    Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
    
    
    Dim deskWnd As Long
    Dim deskDC As Long
    
    deskWnd = GetDesktopWindow()
    deskDC = GetDC(deskWnd)

    And Sastraxi is right, use BitBlt instead of Get- and SetPixel, it's much faster...
    Teaudirenopossum.Musasapientumfixaestinaure.
    (I can't hear you. There's a banana in my ear)

  3. #3
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    err use GetWindowDC not GetDC...

  4. #4
    Fanatic Member PsychoMark's Avatar
    Join Date
    Feb 2001
    Location
    Netherlands
    Posts
    540
    GetDC always worked fine for me...
    Teaudirenopossum.Musasapientumfixaestinaure.
    (I can't hear you. There's a banana in my ear)

  5. #5
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    GetwindowDC returns the dc to the client area of a window while GetDC returns the DC including the non-client area. You can also use GetDC to return the screen device context by passing a null:
    ScreenDC=GetDC(0)

    Also, you have to use ReleaseDC to free up the resources after you.
    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
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    Seems like noone cracked your numbers yet huh?

  7. #7
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    yeah, that's odd, it's not encrypted or encoded in any way
    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.

  8. #8
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    I posted something in Chit-Chat!

    Is it your VB serial number??? (or C, Java, Interdev, Studio, ???)
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

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