Screen Capture Bug


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: Screen Capture Bug

  1. #1
    Ranger Guest

    Screen Capture Bug


    Below is a source code for screen capture and when i run my program and i
    click command1 , the mouse & keyboard seem 'paralysed' . The mouse does
    not respond to clicks & the keyboard commands cannot be carried out. Does
    anyone has idea why this is so ?

    Code :
    'In module
    -------------------------------------------------------------------------
    Public Const KEYEVENTF_EXTENDEDKEY = &H1
    Public Const KEYEVENTF_KEYUP = &H2

    Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte,
    ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
    Declare Function MapVirtualKey Lib "user32" Alias "MapVirtualKeyA" (ByVal
    wCode As Long, ByVal wMapType As Long) As Long

    Public Const VK_LBUTTON = &H1
    Public Const VK_RBUTTON = &H2
    Public Const VK_CANCEL = &H3
    Public Const VK_MBUTTON = &H4 ' NOT contiguous with L RBUTTON

    Public Const VK_BACK = &H8
    Public Const VK_TAB = &H9

    Public Const VK_CLEAR = &HC
    Public Const VK_RETURN = &HD

    Public Const VK_SHIFT = &H10
    Public Const VK_CONTROL = &H11
    Public Const VK_MENU = &H12
    Public Const VK_PAUSE = &H13
    Public Const VK_CAPITAL = &H14

    Public Const VK_ESCAPE = &H1B

    Public Const VK_SPACE = &H20
    Public Const VK_PRIOR = &H21
    Public Const VK_NEXT = &H22
    Public Const VK_END = &H23
    Public Const VK_HOME = &H24
    Public Const VK_LEFT = &H25
    Public Const VK_UP = &H26
    Public Const VK_RIGHT = &H27
    Public Const VK_DOWN = &H28
    Public Const VK_SELECT = &H29
    Public Const VK_PRINT = &H2A
    Public Const VK_EXECUTE = &H2B
    Public Const VK_SNAPSHOT = &H2C
    Public Const VK_INSERT = &H2D
    Public Const VK_DELETE = &H2E
    Public Const VK_HELP = &H2F

    ' VK_A thru VK_Z are the same as their ASCII equivalents: 'A' thru 'Z'
    ' VK_0 thru VK_9 are the same as their ASCII equivalents: '0' thru '9'

    Public Const VK_NUMPAD0 = &H60
    Public Const VK_NUMPAD1 = &H61
    Public Const VK_NUMPAD2 = &H62
    Public Const VK_NUMPAD3 = &H63
    Public Const VK_NUMPAD4 = &H64
    Public Const VK_NUMPAD5 = &H65
    Public Const VK_NUMPAD6 = &H66
    Public Const VK_NUMPAD7 = &H67
    Public Const VK_NUMPAD8 = &H68
    Public Const VK_NUMPAD9 = &H69
    Public Const VK_MULTIPLY = &H6A
    Public Const VK_ADD = &H6B
    Public Const VK_SEPARATOR = &H6C
    Public Const VK_SUBTRACT = &H6D
    Public Const VK_DECIMAL = &H6E
    Public Const VK_DIVIDE = &H6F
    Public Const VK_F1 = &H70
    Public Const VK_F2 = &H71
    Public Const VK_F3 = &H72
    Public Const VK_F4 = &H73
    Public Const VK_F5 = &H74
    Public Const VK_F6 = &H75
    Public Const VK_F7 = &H76
    Public Const VK_F8 = &H77
    Public Const VK_F9 = &H78
    Public Const VK_F10 = &H79
    Public Const VK_F11 = &H7A
    Public Const VK_F12 = &H7B
    Public Const VK_F13 = &H7C
    Public Const VK_F14 = &H7D
    Public Const VK_F15 = &H7E
    Public Const VK_F16 = &H7F
    Public Const VK_F17 = &H80
    Public Const VK_F18 = &H81
    Public Const VK_F19 = &H82
    Public Const VK_F20 = &H83
    Public Const VK_F21 = &H84
    Public Const VK_F22 = &H85
    Public Const VK_F23 = &H86
    Public Const VK_F24 = &H87

    Public Const VK_NUMLOCK = &H90
    Public Const VK_SCROLL = &H91

    '
    ' VK_L VK_R - left and right Alt, Ctrl and Shift virtual keys.
    ' Used only as parameters to GetAsyncKeyState() and GetKeyState().
    ' No other API or message will distinguish left and right keys in this
    way.
    ' /
    Public Const VK_LSHIFT = &HA0
    Public Const VK_RSHIFT = &HA1
    Public Const VK_LCONTROL = &HA2
    Public Const VK_RCONTROL = &HA3
    Public Const VK_LMENU = &HA4
    Public Const VK_RMENU = &HA5

    Public Const VK_ATTN = &HF6
    Public Const VK_CRSEL = &HF7
    Public Const VK_EXSEL = &HF8
    Public Const VK_EREOF = &HF9
    Public Const VK_PLAY = &HFA
    Public Const VK_ZOOM = &HFB
    Public Const VK_NONAME = &HFC
    Public Const VK_PA1 = &HFD
    Public Const VK_OEM_CLEAR = &HFE

    ---------------------------------------------------------------------
    'In the form
    Dim IsWindows95%
    Public Sub MyCapture(ByVal mode%)
    Dim altscan%
    Dim dl&
    Dim snapparam%
    altscan% = MapVirtualKey(VK_MENU, 0)

    Screen.MousePointer = vbHourglass
    If mode Then
    keybd_event VK_MENU, altscan, 0, 0
    ' It seems necessary to let this key get processed before
    ' taking the snapshot.
    End If

    ' Why does this work? Who knows!
    If mode = 0 And IsWindows95 Then snapparam = 1

    DoEvents ' These seem necessary to make it reliable

    ' Take the snapshot
    keybd_event VK_SNAPSHOT, snapparam, 0, 0

    DoEvents

    Picture1.Picture = Clipboard.GetData(vbCFBitmap)
    ' If mode Then keybd_event VK_MENU, altscan, KEYEVENTF_KEYUP, 0

    'cmdCaptureAll.Enabled = True
    'cmdCaptureActive.Enabled = True
    Screen.MousePointer = vbDefault
    End Sub


    Private Sub Command1_Click()
    MyCapture 1
    End Sub

  2. #2
    Karl E. Peterson Guest

    Re: Screen Capture Bug

    Where are you getting this stuff, PlanetSourceCode?

    Best advice: "Become one with the KB."

    http://support.microsoft.com/support.../q240/6/53.asp

    Later... Karl
    --
    http://www.mvps.org/vb


    "Ranger" <eng70640@nus.edu.sg> wrote in message news:3a326a0e$1@news.devx.com...
    >
    > Below is a source code for ... [god only knows what].

    <snip>


  3. #3
    Karl E. Peterson Guest

    Re: Screen Capture Bug

    Where are you getting this stuff, PlanetSourceCode?

    Best advice: "Become one with the KB."

    http://support.microsoft.com/support.../q240/6/53.asp

    Later... Karl
    --
    http://www.mvps.org/vb


    "Ranger" <eng70640@nus.edu.sg> wrote in message news:3a326a0e$1@news.devx.com...
    >
    > Below is a source code for ... [god only knows what].

    <snip>


  4. #4
    Join Date
    May 2006
    Posts
    2

    Talking re: screen capture

    see this screen capture:
    http://www.yaodownload.com/video-des...eencapture.htm

    i found it better than others, wow, cool!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center