hola proba asi para saber que tecla se preciono.
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
MsgBox KeyCode
End Sub
Saludos
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
MsgBox KeyCode
End Sub
Saludos
Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.
Mostrar Mensajes Menú
Option Explicit
Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByRef lParam As Any) As Long
Private Declare Function GetScrollInfo Lib "user32.dll" (ByVal hWnd As Long, ByVal n As Long, ByRef lpScrollInfo As SCROLLINFO) As Long
Private Type SCROLLINFO
cbSize As Long
fMask As Long
nMin As Long
nMax As Long
nPage As Long
nPos As Long
nTrackPos As Long
End Type
Private Const WM_KEYDOWN As Long = &H100
Private Const SBS_VERT = 1
Private Const SIF_PAGE As Long = &H2
Private Const SIF_POS As Long = &H4
Private Const SIF_RANGE As Long = &H1
Private Sub Form_Load()
Timer1.Interval = 500
End Sub
Private Sub Timer1_Timer()
Dim SIF As SCROLLINFO
SIF.cbSize = Len(SIF)
SIF.fMask = SIF_RANGE Or SIF_PAGE Or SIF_POS
GetScrollInfo ListView1.hWnd, SBS_VERT, SIF
ListView1.ListItems.Add , , Now
If (SIF.nPos + SIF.nPage > SIF.nMax) Then
SendMessage ListView1.hWnd, WM_KEYDOWN, vbKeyEnd, 0&
End If
End Sub
Option Explicit
Private Const WM_KEYDOWN As Long = &H100
Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByRef lParam As Any) As Long
Private Sub Command1_Click()
ListView1.ListItems.Add , , Now
SendMessage ListView1.hwnd, WM_KEYDOWN, vbKeyEnd, 0&
End Sub
Option Explicit
Private Declare Function OleCreatePictureIndirect Lib "oleaut32.dll" (pDicDesc As IconType, riid As CLSIdType, ByVal fown As Long, lpUnk As Object) As Long
Private Declare Function ExtractIcon Lib "shell32.dll" Alias "ExtractIconA" (ByVal hInst As Long, ByVal lpszExeFileName As String, ByVal nIconIndex As Long) As Long
Private Declare Function DestroyIcon Lib "user32.dll" (ByVal hIcon As Long) As Long
Private Type IconType
cbSize As Long
picType As PictureTypeConstants
hIcon As Long
End Type
Private Type CLSIdType
id(16) As Byte
End Type
Private Function ExtractCompatibleIcon(sPathFile As String, IconIndex As Long) As IPictureDisp
Dim Unkown As IUnknown
Dim Icon As IconType
Dim CLSID As CLSIdType
Dim hIcon As Long
hIcon = ExtractIcon(0, sPathFile, IconIndex)
With Icon
.cbSize = Len(Icon)
.picType = vbPicTypeIcon
.hIcon = hIcon
End With
With CLSID
.id(8) = &HC0
.id(15) = &H46
End With
Call OleCreatePictureIndirect(Icon, CLSID, 1, Unkown)
Set ExtractCompatibleIcon = Unkown
DestroyIcon hIcon
End Function
Private Sub Form_Load()
Me.Picture = ExtractCompatibleIcon("explorer.exe", 1)
SavePicture ExtractCompatibleIcon("calc.exe", 0), "C:\calculadora.ico"
'Me.Picture = LoadPicture("C:\calculadora.ico")
End Sub