Results 1 to 1 of 1

Thread: How remember the selected region to take snap shot?

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Apr 2005
    Posts
    1,907

    How remember the selected region to take snap shot?

    Hi all i am using this code to take snap shot of a perticuler place in the screen . The problem is that each time i need to select the region. Is there a way to make it fixed region so that u once select a region and it remembers it all the time and once u press copy it takes snap shot of the region again ...




    VB Code:
    1. Option Explicit
    2. Private Declare Function ShellExecute _
    3.  Lib "shell32.dll" Alias "ShellExecuteA" ( _
    4.  ByVal hwnd As Long, _
    5.  ByVal lpOperation As String, _
    6.  ByVal lpFile As String, _
    7.  ByVal lpParameters As String, _
    8.  ByVal lpDirectory As String, _
    9.  ByVal nShowCmd As Long) As Long
    10.  
    11. Public Sub SetMeOnTop()
    12.     SetWindowPos Me.hwnd, HWND_TOPMOST, 0&, 0&, 0&, 0&, SWP_FLAGS
    13. End Sub
    14.  
    15. Private Sub Form_Load()
    16.     Me.Top = GetSetting(App.EXEName, "StartPosition", "Top", Me.Top)
    17.     Me.Left = GetSetting(App.EXEName, "StartPosition", "Left", Me.Left)
    18.     SetMeOnTop
    19. End Sub
    20.  
    21. Private Sub Form_Unload(Cancel As Integer)
    22.     Me.WindowState = vbNormal
    23.     SaveSetting App.EXEName, "StartPosition", "Top", Me.Top
    24.     SaveSetting App.EXEName, "StartPosition", "Left", Me.Left
    25.     End
    26. End Sub
    27.  
    28. Private Sub Timer1_Timer()
    29.     Toolbar1.Buttons("Copy").Enabled = frmScreen.shpSelect.Visible And frmScreen.Visible
    30.     Toolbar1.Buttons("Minimize").Enabled = Not frmScreen.Visible
    31.     If Toolbar1.Buttons("Copy").Enabled Then
    32.         With frmScreen.shpSelect
    33.             lblSelPos = .Left & ", " & .Top
    34.             lblSelSize = .Width & " x " & .Height
    35.         End With
    36.     Else
    37.         lblSelPos = "0, 0"
    38.         lblSelSize = "0 x 0"
    39.     End If
    40. End Sub
    41.  
    42. Private Sub Toolbar1_ButtonClick(ByVal Button As MSComCtlLib.Button)
    43.     On Error Resume Next
    44.     Select Case Button.Key
    45.         Case "Select"
    46.             If Button.Value = tbrPressed Then
    47.                 SetWindowPos Me.hwnd, HWND_NOTOPMOST, 0&, 0&, 0&, 0&, SWP_FLAGS
    48.                 Me.Hide
    49.                 DoEvents
    50.                 frmScreen.ShowMe
    51.                 frmCapture.SetMeOnTop
    52.             Else
    53.                 frmScreen.Hide
    54.             End If
    55.         Case "Copy"
    56.             frmScreen.CopySelection
    57.             frmScreen.Hide
    58.             Toolbar1.Buttons("Select").Value = tbrUnpressed
    59.         Case "Edit"
    60.             ShellExecute Me.hwnd, "Open", frmScreen.Filename, "", "", vbNormalFocus
    61.         Case "Minimize"
    62.             Me.WindowState = vbMinimized
    63.         Case "Close"
    64.             Unload Me
    65.     End Select
    66. End Sub
    67.  
    68. module:
    69.  
    70.  
    71.  
    72. Option Explicit
    73.  
    74. Public Declare Function SetWindowPos _
    75.  Lib "user32" ( _
    76.  ByVal hwnd As Long, _
    77.  ByVal hWndInsertAfter As Long, _
    78.  ByVal x As Long, _
    79.  ByVal y As Long, _
    80.  ByVal cx As Long, _
    81.  ByVal cy As Long, _
    82.  ByVal wFlags As Long) As Long
    83.  
    84. Public Const SWP_NOMOVE = &H2
    85. Public Const SWP_NOSIZE = &H1
    86. Public Const SWP_FLAGS = (SWP_NOMOVE Or SWP_NOSIZE)
    87.  
    88. Public Const HWND_TOPMOST = -1
    89. Public Const HWND_NOTOPMOST = -2
    Attached Images Attached Images  

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