elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Rompecabezas de Bitcoin, Medio millón USD en premios


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación General
| | |-+  .NET (C#, VB.NET, ASP)
| | | |-+  Programación Visual Basic (Moderadores: LeandroA, seba123neo)
| | | | |-+  Imagen con cursor
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: Imagen con cursor  (Leído 2,379 veces)
NiquitooX

Desconectado Desconectado

Mensajes: 20


Ver Perfil
Imagen con cursor
« en: 11 Diciembre 2014, 18:45 pm »

holas encontré esta funcion para sacar imagen en jpg pero no logro que se vea el cursor alguien podría ayudarme.

Codigo del form:
Código
  1. Option Explicit
  2.  
  3.  
  4. ' \\ -- Autor : Luciano Lodola -- http://www.recursosvisualbasic.com.ar
  5.  
  6.  
  7. ' \\ -- Declaraciones
  8. Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
  9.  
  10. ' -- Clases para convertir el Bmp a Jpg
  11. Private mImage                           As cImage
  12. Private mJPG                             As cJpeg
  13.  
  14. ' -- Capturar la pantalla y convertirla a JPG
  15. ''''''''''''''''''''''''''''''''''''''''''''''''''
  16. Private Sub Capturar_Guardar()
  17.  
  18.    On Error GoTo error_handler
  19.  
  20.    Dim lRet        As Long
  21.    Dim lWidth      As Long
  22.    Dim lHeight     As Long
  23.  
  24.    Me.MousePointer = vbHourglass
  25.    Static iCount As Integer
  26.    iCount = iCount + 1
  27.  
  28.    With Screen
  29.        lWidth = .Width / .TwipsPerPixelX
  30.        lHeight = .Height / .TwipsPerPixelY
  31.    End With
  32.  
  33.    lRet = mImage.CopyHDC(GetDC(0), lWidth, lHeight)
  34.    lRet = mJPG.SampleHDC(mImage.hDC, lWidth, lHeight)
  35.    lRet = mJPG.SaveFile(App.Path & "\image_" & CStr(iCount) & ".jpg")
  36.  
  37.    Me.MousePointer = vbDefault
  38.  
  39. Exit Sub
  40. error_handler:
  41. Me.MousePointer = 0
  42. End Sub
  43.  
  44. Private Sub Combo1_Click()
  45.    mJPG.Quality = CLng(Combo1.Text)
  46. End Sub
  47.  
  48. Private Sub Command1_Click()
  49.    Call Capturar_Guardar
  50. End Sub
  51.  
  52. ' --------------------------------------------------------------------------
  53. ' \\ -- inicio
  54. ' --------------------------------------------------------------------------
  55. Private Sub Form_Load()
  56.    ' -- Inicializar variables
  57.    Set mImage = New cImage
  58.    Set mJPG = New cJpeg
  59.    Command1.Caption = " Capturar pantalla "
  60.  
  61.    Combo1.ListIndex = Combo1.ListCount - 1
  62. End Sub
  63. ' --------------------------------------------------------------------------
  64. ' \\ -- Fin
  65. ' --------------------------------------------------------------------------
  66.  
  67. Private Sub Form_Unload(Cancel As Integer)
  68.    Set mImage = Nothing
  69.    Set mJPG = Nothing
  70. End Sub

cImage modulo de clase:
Código
  1. Option Explicit
  2. Option Base 0
  3.  
  4. 'Class Name:    cImage.cls
  5. '
  6. 'Description:   This class creates and gives access to a DIBSection for the
  7. '               purpose of displaying and editing a digital image.
  8. '
  9.  
  10. Private Type SAFEARRAYBOUND
  11.    cElements         As Long
  12.    lLbound           As Long
  13. End Type
  14. Private Type SAFEARRAY2D
  15.    cDims             As Integer
  16.    fFeatures         As Integer
  17.    cbElements        As Long
  18.    cLocks            As Long
  19.    pvData            As Long
  20.    Bounds(0 To 1)    As SAFEARRAYBOUND
  21. End Type
  22. Private Type RGBQUAD
  23.    rgbBlue           As Byte
  24.    rgbGreen          As Byte
  25.    rgbRed            As Byte
  26.    rgbReserved       As Byte
  27. End Type
  28. Private Type BITMAPINFOHEADER
  29.    biSize            As Long
  30.    biWidth           As Long
  31.    biHeight          As Long
  32.    biPlanes          As Integer
  33.    biBitCount        As Integer
  34.    biCompression     As Long
  35.    biSizeImage       As Long
  36.    biXPelsPerMeter   As Long
  37.    biYPelsPerMeter   As Long
  38.    biClrUsed         As Long
  39.    biClrImportant    As Long
  40. End Type
  41. Private Type BITMAPFILEHEADER
  42.    bfType            As Integer
  43.    bfSize            As Long
  44.    bfReserved1       As Integer
  45.    bfReserved2       As Integer
  46.    bfOffBits         As Long
  47. End Type
  48. Private Type BITMAP
  49.    bmType            As Long
  50.    bmWidth           As Long
  51.    bmHeight          As Long
  52.    bmWidthBytes      As Long
  53.    bmPlanes          As Integer
  54.    bmBitsPixel       As Integer
  55.    bmBits            As Long
  56. End Type
  57. Private Type BITMAPINFO
  58.    bmiHeader         As BITMAPINFOHEADER
  59.    bmiColors(255)    As RGBQUAD
  60. End Type
  61. Private Type POINTAPI
  62.        x As Long
  63.        y As Long
  64. End Type
  65.  
  66.  
  67. Private Declare Function CreateCompatibleDC Lib "gdi32" (ByVal hDC As Long) As Long
  68. Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
  69. Private Declare Function GetDesktopWindow Lib "user32" () As Long
  70. Private Declare Function CreateDIBSection2 Lib "gdi32" Alias "CreateDIBSection" (ByVal hDC As Long, pBitmapInfo As BITMAPINFO, ByVal un As Long, lplpVoid As Long, ByVal handle As Long, ByVal dw As Long) As Long   'lplpVoid changed to ByRef
  71. Private Declare Function CreateDCAsNull Lib "gdi32" Alias "CreateDCA" (ByVal lpDriverName As String, lpDeviceName As Any, lpOutput As Any, lpInitData As Any) As Long
  72. Private Declare Function BitBlt Lib "gdi32" (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
  73. Private Declare Function SelectObject Lib "gdi32" (ByVal hDC As Long, ByVal hObject As Long) As Long
  74. Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
  75. Private Declare Function DeleteDC Lib "gdi32" (ByVal hDC As Long) As Long
  76. Private Declare Function LoadImage Lib "user32" Alias "LoadImageA" (ByVal hInst As Long, ByVal lpsz As String, ByVal un1 As Long, ByVal n1 As Long, ByVal n2 As Long, ByVal un2 As Long) As Long
  77. Private Declare Function GetDIBColorTable Lib "gdi32" (ByVal hDC As Long, ByVal un1 As Long, ByVal un2 As Long, pRGBQuad As RGBQUAD) As Long
  78. Private Declare Function SetDIBColorTable Lib "gdi32" (ByVal hDC As Long, ByVal un1 As Long, ByVal un2 As Long, pcRGBQuad As RGBQUAD) As Long
  79. Private Declare Function GetDIBits256 Lib "gdi32" Alias "GetDIBits" (ByVal aHDC As Long, ByVal hBitmap As Long, ByVal nStartScan As Long, ByVal nNumScans As Long, lpBits As Any, lpBI As BITMAPINFO, ByVal wUsage As Long) As Long
  80. Private Declare Function GetObjectAPI Lib "gdi32" Alias "GetObjectA" (ByVal hObject As Long, ByVal nCount As Long, lpObject As Any) As Long
  81. Private Declare Function CreateCompatibleBitmap Lib "gdi32" (ByVal hDC As Long, ByVal nWidth As Long, ByVal nHeight As Long) As Long
  82. Private Declare Function VarPtrArray Lib "msvbvm60.dll" Alias "VarPtr" (Ptr() As Any) As Long
  83. Private Declare Function SetStretchBltMode Lib "gdi32" (ByVal hDC As Long, ByVal nStretchMode As Long) As Long
  84. Private Declare Function StretchBlt Lib "gdi32" (ByVal hDC 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 nSrcWidth As Long, ByVal nSrcHeight As Long, ByVal dwRop As Long) As Long
  85. Private Declare Function PlgBlt Lib "gdi32" (ByVal hdcDest As Long, lpPoint As POINTAPI, ByVal hdcSrc As Long, ByVal nXSrc As Long, ByVal nYSrc As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hbmMask As Long, ByVal xMask As Long, ByVal yMask As Long) As Long
  86. Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (lpvDest As Any, lpvSource As Any, ByVal cbCopy As Long)
  87.  
  88.  
  89. Private Const BLACKONWHITE    As Long = 1 'nStretchMode constants for
  90. Private Const COLORONCOLOR    As Long = 3 '  SetStretchBltMode() API function
  91. Private Const HALFTONE        As Long = 4 'HALFTONE not supported in Win 95, 98, ME
  92.  
  93. Private Const BI_RGB          As Long = 0&
  94. Private Const BI_RLE4         As Long = 2&
  95. Private Const BI_RLE8         As Long = 1&
  96. Private Const DIB_RGB_COLORS  As Long = 0
  97.  
  98. Private m_hDIb        As Long       ' Handle to the current DIBSection
  99. Private m_hBmpOld     As Long       ' Handle to the old bitmap in the DC, for clear up
  100. Private m_hDC         As Long       ' Handle to the Device context holding the DIBSection
  101. Private m_Ptr         As Long       ' Address of memory pointing to the DIBSection's bits
  102. Private m_BI          As BITMAPINFO ' Type containing the Bitmap information
  103. Private m_RGB(255)    As RGBQUAD
  104.  
  105.  
  106.  
  107. Private Sub Clear()
  108.    If (m_hDC <> 0) Then
  109.        If (m_hDIb <> 0) Then
  110.            SelectObject m_hDC, m_hBmpOld
  111.            DeleteObject m_hDIb
  112.        End If
  113.        DeleteObject m_hDC
  114.    End If
  115.    m_hDC = 0
  116.    m_hDIb = 0
  117.    m_hBmpOld = 0
  118.    m_Ptr = 0
  119. End Sub
  120. Private Sub Class_Terminate()
  121.    Clear
  122. End Sub
  123.  
  124.  
  125.  
  126. '====================================================================================
  127. '                                PUBLIC PROPERTIES
  128. '====================================================================================
  129. Public Property Get Width() As Long
  130.    Width = m_BI.bmiHeader.biWidth
  131. End Property
  132. Public Property Get Height() As Long
  133.    Height = m_BI.bmiHeader.biHeight
  134. End Property
  135. Public Property Get BitCount() As Integer
  136.    BitCount = m_BI.bmiHeader.biBitCount
  137. End Property
  138. Public Property Get hDC() As Long
  139.    hDC = m_hDC
  140. End Property
  141. Public Property Get DIBitsPtr() As Long
  142.    DIBitsPtr = m_Ptr
  143. End Property
  144. Public Property Get BytesPerScanLine() As Long
  145.    Select Case m_BI.bmiHeader.biBitCount ' Scans must align on 4-byte boundaries
  146.    Case 1:    BytesPerScanLine = ((m_BI.bmiHeader.biWidth - 1) \ 8 + 4) And &HFFFFFFFC
  147.    Case 4:    BytesPerScanLine = ((m_BI.bmiHeader.biWidth - 1) \ 2 + 4) And &HFFFFFFFC
  148.    Case 8:    BytesPerScanLine = (m_BI.bmiHeader.biWidth + 3) And &HFFFFFFFC
  149.    Case Else: BytesPerScanLine = (m_BI.bmiHeader.biWidth * 3 + 3) And &HFFFFFFFC
  150.    End Select
  151. End Property
  152.  
  153.  
  154.  
  155. '====================================================================================
  156. '                             DIMENSION / COLOR DEPTH
  157. '====================================================================================
  158. Public Function Create(lWidth As Long, lHeight As Long, iBitCount As Integer) As Boolean
  159.    Clear                        'Set Dimensions and BitCount in this cImage
  160.    Select Case iBitCount
  161.    Case 24
  162.        m_hDC = CreateCompatibleDC(0)
  163.    Case 1, 4, 8
  164.        Dim lHDCDesk As Long
  165.        lHDCDesk = CreateDCAsNull("DISPLAY", ByVal 0&, ByVal 0&, ByVal 0&)
  166.        m_hDC = CreateCompatibleDC(lHDCDesk)
  167.        DeleteDC lHDCDesk
  168.    End Select
  169.    If m_hDC = 0 Then Exit Function
  170.    With m_BI.bmiHeader
  171.        .biSize = Len(m_BI.bmiHeader)
  172.        .biWidth = lWidth
  173.        .biHeight = lHeight
  174.        .biPlanes = 1
  175.        .biBitCount = iBitCount
  176.        .biCompression = BI_RGB
  177.        .biSizeImage = BytesPerScanLine * .biHeight
  178.    End With
  179.    If iBitCount <> 24 Then ' Create a default grayscale palette
  180.        Dim i As Long
  181.        Dim c As Long
  182.        c = 2 ^ iBitCount - 1
  183.        For i = 0 To c
  184.            With m_BI.bmiColors(i)
  185.                .rgbBlue = i * 255# / c
  186.                .rgbGreen = .rgbBlue
  187.                .rgbRed = .rgbBlue
  188.            End With
  189.        Next i
  190.    End If
  191.    m_hDIb = CreateDIBSection2(m_hDC, m_BI, DIB_RGB_COLORS, m_Ptr, 0, 0)
  192.    If m_hDIb = 0 Then
  193.        DeleteObject m_hDC
  194.    Else
  195.        m_hBmpOld = SelectObject(m_hDC, m_hDIb)
  196.        Create = True
  197.    End If
  198. End Function
  199.  
  200.  
  201.  
  202. '====================================================================================
  203. '                                 LOAD/COPY IMAGE
  204. '====================================================================================
  205. Public Function CopyStdPicture(ByRef TheStdPicture As StdPicture, Optional iBitCount As Integer) As Boolean
  206.    Dim lHDC         As Long
  207.    Dim lhDCDesktop  As Long
  208.    Dim lhBmpOld     As Long
  209.    Dim tBMP         As BITMAP
  210.    Dim CopyPalette  As Boolean
  211.  
  212.    GetObjectAPI TheStdPicture.handle, Len(tBMP), tBMP
  213.  
  214.    CopyPalette = (iBitCount = 0)
  215.    If CopyPalette Then
  216.        iBitCount = tBMP.bmBitsPixel
  217.        If iBitCount = 16 Then iBitCount = 24
  218.    End If
  219.  
  220.    If Not Create(tBMP.bmWidth, tBMP.bmHeight, iBitCount) Then Exit Function
  221.  
  222.    If m_BI.bmiHeader.biBitCount = 24 Then
  223.        lhDCDesktop = GetDC(GetDesktopWindow())
  224.    Else
  225.        lhDCDesktop = CreateDCAsNull("DISPLAY", ByVal 0&, ByVal 0&, ByVal 0&)
  226.    End If
  227.    If lhDCDesktop = 0 Then Exit Function
  228.  
  229.    lHDC = CreateCompatibleDC(lhDCDesktop)
  230.    DeleteDC lhDCDesktop
  231.    If lHDC = 0 Then Exit Function
  232.    lhBmpOld = SelectObject(lHDC, TheStdPicture.handle)
  233.    If m_BI.bmiHeader.biBitCount = 24 Then
  234.        BitBlt m_hDC, 0, 0, m_BI.bmiHeader.biWidth, m_BI.bmiHeader.biHeight, lHDC, 0, 0, vbSrcCopy
  235.    Else
  236.        If CopyPalette Then
  237.            Dim lC As Long
  238.            Dim C2 As Long
  239.            C2 = 2 ^ m_BI.bmiHeader.biBitCount
  240.            lC = GetDIBColorTable(lHDC, 0, C2, m_RGB(0))
  241.            If (lC > 0) Then SetDIBColorTable m_hDC, 0, lC, m_RGB(0)
  242.        End If
  243.        GetDIBits256 lHDC, TheStdPicture.handle, 0, tBMP.bmHeight, ByVal m_Ptr, m_BI, DIB_RGB_COLORS
  244.    End If
  245.    SelectObject lHDC, lhBmpOld
  246.    DeleteObject lHDC
  247.    CopyStdPicture = True
  248. End Function
  249. Public Function CopyHDC(ByVal lHDC As Long, lWidth As Long, lHeight As Long, Optional ByVal iBitCount As Integer, Optional lSrcLeft As Long, Optional lSrcTop As Long) As Boolean
  250.    Dim C1 As Long
  251.    If iBitCount = 0 Then
  252.        C1 = GetDIBColorTable(lHDC, 0, 256, m_RGB(0))
  253.        Select Case C1
  254.        Case 1 To 2:     iBitCount = 1
  255.        Case 3 To 16:    iBitCount = 4
  256.        Case 17 To 256:  iBitCount = 8
  257.        Case Else:       iBitCount = 24
  258.        End Select
  259.    End If
  260.    If Not Create(lWidth, lHeight, iBitCount) Then Exit Function
  261.    If C1 > 0 Then SetDIBColorTable m_hDC, 0, C1, m_RGB(0)
  262.    BitBlt m_hDC, 0, 0, lWidth, lHeight, lHDC, lSrcLeft, lSrcTop, vbSrcCopy
  263.    CopyHDC = True
  264. End Function
  265.  
  266. Public Function CopyPalletHDC(ByVal lHDC As Long) As Boolean
  267.    Dim g As Long
  268.  
  269.    g = GetDIBColorTable(lHDC, 0, 2 ^ m_BI.bmiHeader.biBitCount, m_RGB(0))
  270.    If g > 0 Then CopyPalletHDC = (g = SetDIBColorTable(m_hDC, 0, g, m_RGB(0)))
  271. End Function
  272.  
  273.  
  274.  
  275. '====================================================================================
  276. '                              PAINT/PASTE SECTIONS
  277. '====================================================================================
  278. Public Sub PaintHDC(lHDC As Long, Optional lDestLeft As Long, Optional lDestTop As Long, Optional eRop As RasterOpConstants = vbSrcCopy)
  279.    BitBlt lHDC, lDestLeft, lDestTop, m_BI.bmiHeader.biWidth, m_BI.bmiHeader.biHeight, m_hDC, 0, 0, eRop
  280. End Sub
  281.  
  282.  
  283.  
  284. '====================================================================================
  285. '                               DISPLAY FUNCTIONS
  286. '====================================================================================
  287. 'The following functions return modified versions of this class for display purposes.
  288. 'They are not meant to be used as reliable image processing routines, because the
  289. 'PlgBlt() and StretchBlt() API calls are not precise.
  290.  
  291. Public Function Greyscale() As cImage
  292.    Set Greyscale = New cImage        'Return 8 bit Greyscale version of this cImage
  293.    Greyscale.Create m_BI.bmiHeader.biWidth, m_BI.bmiHeader.biHeight, 8
  294.    BitBlt Greyscale.hDC, 0, 0, m_BI.bmiHeader.biWidth, m_BI.bmiHeader.biHeight, m_hDC, 0, 0, vbSrcCopy
  295. End Function
  296.  
  297. Public Function Resample(lWidth As Long, lHeight As Long) As cImage
  298.    Set Resample = New cImage         'Return a resized version of this cImage
  299.    Resample.Create lWidth, lHeight, m_BI.bmiHeader.biBitCount
  300.    If m_BI.bmiHeader.biBitCount <> 24 Then Resample.CopyPalletHDC m_hDC
  301.  
  302.    If (lWidth = m_BI.bmiHeader.biWidth) And (lHeight = m_BI.bmiHeader.biHeight) Then
  303.       'Just return a copy
  304.        BitBlt Resample.hDC, 0, 0, lWidth, lHeight, m_hDC, 0, 0, vbSrcCopy
  305.    Else
  306.       'HALFTONE gives better quality at slower speed, but it's unsupported in Win 95, 98, ME.
  307.       'If we can't use HALFTONE, use COLORONCOLOR.  The default BLACKONWHITE is unacceptable.
  308.        If SetStretchBltMode(Resample.hDC, HALFTONE) = 0 Then SetStretchBltMode Resample.hDC, COLORONCOLOR
  309.        StretchBlt Resample.hDC, 0, 0, lWidth, lHeight, m_hDC, 0, 0, m_BI.bmiHeader.biWidth, m_BI.bmiHeader.biHeight, vbSrcCopy
  310.    End If
  311. End Function
  312.  
  313. Public Function Mirror(Vertical As Boolean) As cImage
  314.    Dim MyPoint(2) As POINTAPI 'Return a mirror image of this cImage
  315.  
  316.    If Vertical Then
  317.        MyPoint(0).x = 0
  318.        MyPoint(0).y = m_BI.bmiHeader.biHeight
  319.        MyPoint(1).x = m_BI.bmiHeader.biWidth
  320.        MyPoint(1).y = m_BI.bmiHeader.biHeight
  321.        MyPoint(2).x = 0
  322.        MyPoint(2).y = 0
  323.    Else
  324.        MyPoint(0).x = m_BI.bmiHeader.biWidth
  325.        MyPoint(0).y = 0
  326.        MyPoint(1).x = 0
  327.        MyPoint(1).y = 0
  328.        MyPoint(2).x = m_BI.bmiHeader.biWidth
  329.        MyPoint(2).y = m_BI.bmiHeader.biHeight
  330.    End If
  331.  
  332.    Set Mirror = New cImage
  333.    Mirror.Create m_BI.bmiHeader.biWidth, m_BI.bmiHeader.biHeight, m_BI.bmiHeader.biBitCount
  334.    If m_BI.bmiHeader.biBitCount <> 24 Then Mirror.CopyPalletHDC m_hDC
  335.    PlgBlt Mirror.hDC, MyPoint(0), m_hDC, 0, 0, m_BI.bmiHeader.biWidth, m_BI.bmiHeader.biHeight, 0, 0, 0
  336. End Function
  337.  
  338. Public Function Rotate(ByVal Degrees As Long) As cImage
  339.    Dim NewWidth     As Long 'Return version of this cImage rotated Degrees
  340.    Dim NewHeight    As Long
  341.    Dim MyPoint(2)   As POINTAPI
  342.  
  343.    Degrees = Degrees Mod 360
  344.    If Degrees < 0 Then Degrees = Degrees + 360
  345.  
  346.    Select Case Degrees
  347.    Case 90
  348.        MyPoint(0).x = 0
  349.        MyPoint(0).y = m_BI.bmiHeader.biWidth
  350.        MyPoint(1).x = 0
  351.        MyPoint(1).y = 0
  352.        MyPoint(2).x = m_BI.bmiHeader.biHeight
  353.        MyPoint(2).y = m_BI.bmiHeader.biWidth
  354.        NewWidth = m_BI.bmiHeader.biHeight
  355.        NewHeight = m_BI.bmiHeader.biWidth
  356.    Case 180
  357.        MyPoint(0).x = m_BI.bmiHeader.biWidth
  358.        MyPoint(0).y = m_BI.bmiHeader.biHeight
  359.        MyPoint(1).x = 0
  360.        MyPoint(1).y = m_BI.bmiHeader.biHeight
  361.        MyPoint(2).x = m_BI.bmiHeader.biWidth
  362.        MyPoint(2).y = 0
  363.        NewWidth = m_BI.bmiHeader.biWidth
  364.        NewHeight = m_BI.bmiHeader.biHeight
  365.    Case 270
  366.        MyPoint(0).x = m_BI.bmiHeader.biHeight
  367.        MyPoint(0).y = 0
  368.        MyPoint(1).x = m_BI.bmiHeader.biHeight
  369.        MyPoint(1).y = m_BI.bmiHeader.biWidth
  370.        MyPoint(2).x = 0
  371.        MyPoint(2).y = 0
  372.        NewWidth = m_BI.bmiHeader.biHeight
  373.        NewHeight = m_BI.bmiHeader.biWidth
  374.    Case Else
  375.        Exit Function
  376.    End Select
  377.  
  378.    Set Rotate = New cImage
  379.    Rotate.Create NewWidth, NewHeight, m_BI.bmiHeader.biBitCount
  380.    If m_BI.bmiHeader.biBitCount <> 24 Then Rotate.CopyPalletHDC m_hDC
  381.    PlgBlt Rotate.hDC, MyPoint(0), m_hDC, 0, 0, m_BI.bmiHeader.biWidth, m_BI.bmiHeader.biHeight, 0, 0, 0
  382. End Function
  383.  


cJpeg modulo de clase:  lo dejo en comentario porque no me deja el limite.


« Última modificación: 11 Diciembre 2014, 18:52 pm por NiquitooX » En línea

Skype: campex.tools
NiquitooX

Desconectado Desconectado

Mensajes: 20


Ver Perfil
Re: Imagen con cursor
« Respuesta #1 en: 11 Diciembre 2014, 18:53 pm »

cJpeg modulo de clase:  http://ultrashare.net/hosting/dl/12a871be62  "DOWNLOAD THIS FILE"


« Última modificación: 11 Diciembre 2014, 19:00 pm por NiquitooX » En línea

Skype: campex.tools
seba123neo
Moderador
***
Desconectado Desconectado

Mensajes: 3.621



Ver Perfil WWW
Re: Imagen con cursor
« Respuesta #2 en: 11 Diciembre 2014, 21:39 pm »

Hola, para que salga el cursor, falta obtener las coordenadas del mouse y dibujarlo en la imagen.

aca te dejo un codigo que captura la imagen y la graba en formato BMP, con el cursor incluido:

Código
  1. Option Explicit
  2.  
  3. Private Type POINTAPI
  4.    x As Long
  5.    y As Long
  6. End Type
  7.  
  8. Private Declare Function GetDesktopWindow Lib "user32" () As Long
  9. Private Declare Function GetWindowDC Lib "user32" (ByVal hwnd As Long) As Long
  10. Private Declare Function GetCursor Lib "user32" () As Long
  11. Private Declare Function DrawIcon Lib "user32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal hIcon As Long) As Long
  12. Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
  13. Private Declare Function BitBlt Lib "gdi32" (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
  14.  
  15. Dim hwndDW As Long
  16. Dim dcDW As Long
  17. Dim pt As POINTAPI
  18.  
  19. Private Sub Command1_Click()
  20.    GetCursorPos pt
  21.    BitBlt Me.hdc, 0, 0, Me.ScaleWidth, Me.ScaleHeight, dcDW, 0, 0, vbSrcCopy
  22.    DrawIcon Me.hdc, pt.x, pt.y, GetCursor
  23.    SavePicture Me.Image, "C:\foto.bmp"
  24. End Sub
  25.  
  26. Private Sub Form_Load()
  27.    hwndDW = GetDesktopWindow()
  28.    dcDW = GetWindowDC(hwndDW)
  29. End Sub

despues podes usar esa clase para convertirla a jpg...

saludos.

En línea

NiquitooX

Desconectado Desconectado

Mensajes: 20


Ver Perfil
Re: Imagen con cursor
« Respuesta #3 en: 12 Diciembre 2014, 07:28 am »

Hola, para que salga el cursor, falta obtener las coordenadas del mouse y dibujarlo en la imagen.

aca te dejo un codigo que captura la imagen y la graba en formato BMP, con el cursor incluido:

Código
  1. Option Explicit
  2.  
  3. Private Type POINTAPI
  4.    x As Long
  5.    y As Long
  6. End Type
  7.  
  8. Private Declare Function GetDesktopWindow Lib "user32" () As Long
  9. Private Declare Function GetWindowDC Lib "user32" (ByVal hwnd As Long) As Long
  10. Private Declare Function GetCursor Lib "user32" () As Long
  11. Private Declare Function DrawIcon Lib "user32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal hIcon As Long) As Long
  12. Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
  13. Private Declare Function BitBlt Lib "gdi32" (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
  14.  
  15. Dim hwndDW As Long
  16. Dim dcDW As Long
  17. Dim pt As POINTAPI
  18.  
  19. Private Sub Command1_Click()
  20.    GetCursorPos pt
  21.    BitBlt Me.hdc, 0, 0, Me.ScaleWidth, Me.ScaleHeight, dcDW, 0, 0, vbSrcCopy
  22.    DrawIcon Me.hdc, pt.x, pt.y, GetCursor
  23.    SavePicture Me.Image, "C:\foto.bmp"
  24. End Sub
  25.  
  26. Private Sub Form_Load()
  27.    hwndDW = GetDesktopWindow()
  28.    dcDW = GetWindowDC(hwndDW)
  29. End Sub

despues podes usar esa clase para convertirla a jpg...

saludos.



muchas gracias no se me ocurría como hacerlo.
mil gracias
En línea

Skype: campex.tools
Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
Cursor XP
Diseño Gráfico
Free-Knowledgend 0 2,013 Último mensaje 20 Enero 2005, 19:54 pm
por Free-Knowledgend
Cursor
Programación Visual Basic
yeikos 6 2,624 Último mensaje 29 Agosto 2006, 03:45 am
por Red Mx
imagen de video que cambia al pasar el cursor sobre el
Multimedia
BUSCAMINAS® 0 3,488 Último mensaje 17 Septiembre 2011, 03:15 am
por BUSCAMINAS®
Hay alguna forma de cambiar la imagen del cursor desde Batch?
Scripting
z3nth10n 8 5,355 Último mensaje 4 Febrero 2013, 20:48 pm
por z3nth10n
Mostrar texto al poner el cursor encima de una imagen
Desarrollo Web
enrique4480 1 10,564 Último mensaje 21 Diciembre 2023, 19:12 pm
por .:Xx4NG3LxX:.
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines