|
191
|
Programación / Programación Visual Basic / Re: Bloquear teclado desde VB?
|
en: 8 Mayo 2011, 00:26 am
|
Mirá tenía 1 modulo de como bloquear teclado por una parte y mouse por otra, acá dejo el modulo: Option Explicit 'Declare needed functions from Windows API Private Declare Function SetWindowsHookEx Lib "user32" Alias "SetWindowsHookExA" (ByVal idHook As Long, ByVal lpfn As Long, ByVal hmod As Long, ByVal dwThreadId As Long) As Long Private Declare Function UnhookWindowsHookEx Lib "user32" (ByVal hHook As Long) As Long 'Keyboard related Constants and Structs Private Const WH_KEYBOARD_LL As Byte = 13 'Keyboard related variables Private IdKeyBoard As Long 'Mouse related Constants and Structs Private Const WH_MOUSE_LL As Byte = 14 'Mouse related variables 'Dim p2 As MSLLHOOKSTRUCT Private IdMouse As Long 'función que desactiva el teclado ''''''''''''''''''''''''''''''''' Public Function WinProcKeyBoard(ByVal nCode As Long, ByVal wParam As Long, ByVal lParam As Long) As Long WinProcKeyBoard = -1 End Function 'Función que desactiva el Mouse ''''''''''''''''''''''''''''''' Public Function WinProcMouse(ByVal nCode As Long, ByVal wParam As Long, ByVal lParam As Long) As Long WinProcMouse = -1 End Function ' Sub que instala los Hook para bloquear el teclado y mouse ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Public Sub Bloquear() 'Deshabilita el teclado 'IdKeyBoard = SetWindowsHookEx(WH_KEYBOARD_LL, AddressOf WinProcKeyBoard, App.hInstance, 0) 'Deshabilita el mouse If IdMouse <> 0 Then Exit Sub IdMouse = SetWindowsHookEx(WH_MOUSE_LL, AddressOf WinProcMouse, App.hInstance, 0) End Sub Public Sub Desbloquear() ' Vuelve a Habilitar el teclado 'If IdKeyBoard <> 0 Then UnhookWindowsHookEx IdKeyBoard ' Vuelve a Habilitar el mouse If IdMouse <> 0 Then UnhookWindowsHookEx IdMouse End Sub
yo creo q usaba el bloquear solo para el mouse, pero descomentalo y listo.
|
|
|
193
|
Programación / Programación Visual Basic / Re: [RETO] Alternativa a Instr()
|
en: 31 Diciembre 2010, 22:43 pm
|
Hola, estaba en la otra PC, la llamo MierdBook (NetBook) entonces leí ésto y dije, excelente, puedo pasar mi tiempo con ésto haciendolo desde el Bloc de notas, lo terminé en el bloc y cdo lo probé en la verdadera PC, funcionó sin errores, ni tuve q hacer cambios Option Explicit Private Sub Form_Load() Dim SearchString As String, SearchChar As String SearchString = "Baila baila baila como Juana, baila la cubana, parece refresco de cola, a mi me parece que estás bien buena." SearchChar = "col" MsgBox InStr(1, SearchString, SearchChar) MsgBox MyInStr(1, SearchString, SearchChar) End End Sub Public Function MyInStr(ByVal Sutato As Integer, ByVal SearchString As String, ByVal SearchChar As String) As Integer Dim i As Integer, LenSS As Integer, LenSC As Integer Dim x As Integer LenSS = Len(SearchString) LenSC = Len(SearchChar) 'Anti-Dumb If LenSC = 0 Or LenSS = 0 Then Exit Function 'Anti-Dumb If Sutato < 0 Then Sutato = 0 'Only 1 Char? If LenSC = 1 Then For i = Sutato To LenSS If Mid(SearchChar, 1, 1) = Mid(SearchString, i, 1) Then MyInStr = i Exit Function End If Next i End If For i = Sutato To LenSS If Mid(SearchChar, 1, 1) = Mid(SearchString, i, 1) Then For x = 2 To LenSC If Mid(SearchChar, x, 1) = Mid(SearchString, i + (x - 1), 1) Then If x = LenSC Then MyInStr = i Exit Function End If Else i = i + (x - 1) Exit For End If Next x End If Next i End Function
Feliz año nuevo (Y).
|
|
|
195
|
Programación / Programación Visual Basic / Re: [Resuelto] Chinese
|
en: 26 Diciembre 2010, 12:21 pm
|
Weno encontré el código, es super largo, hace controles propios, acá pongo algo muy útil. Option Explicit Private Declare Function GetModuleHandleW Lib "kernel32" (ByVal lpModuleName As Long) As Long Private Declare Function GetProcAddress Lib "kernel32" (ByVal hModule As Long, ByVal lpProcName As String) As Long Private Declare Function GetWindowLongA Lib "user32" (ByVal hWnd As Long, ByVal nIndex As Long) As Long Private Declare Function SetWindowLongA Lib "user32" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long Private Declare Function SetWindowLongW Lib "user32" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long Private Declare Function SetWindowTextW Lib "user32" (ByVal hWnd As Long, ByVal lpString As Long) As Long Private Const GWL_WNDPROC = -4 Private m_Caption As String Public Property Get CaptionW() As String CaptionW = m_Caption End Property Public Property Let CaptionW(ByRef NewValue As String) Static WndProc As Long, VBWndProc As Long m_Caption = NewValue ' get window procedures if we don't have them If WndProc = 0 Then ' the default Unicode window procedure WndProc = GetProcAddress(GetModuleHandleW(StrPtr("user32")), "DefWindowProcW") ' window procedure of this form VBWndProc = GetWindowLongA(hWnd, GWL_WNDPROC) End If ' ensure we got them If WndProc <> 0 Then ' replace form's window procedure with the default Unicode one SetWindowLongW hWnd, GWL_WNDPROC, WndProc ' change form's caption SetWindowTextW hWnd, StrPtr(m_Caption) ' restore the original window procedure SetWindowLongA hWnd, GWL_WNDPROC, VBWndProc Else ' no Unicode for us Caption = m_Caption End If End Property Private Sub Form_Load() Me.CaptionW = "UniControls sample: " & ChrW$(&H3042) & ChrW$(&H3044) & ChrW$(&H3046) & ChrW$(&H3048) & ChrW$(&H304A) End Sub
El archivo se llama UniControl2117366192008.rar, por si lo encuentrar en internet,, debe ser de Planet Source Code (Y), no sé como subirlo acá y x lo q ví, creo q no se puede. (Y)
|
|
|
196
|
Programación / Programación Visual Basic / [Resuelto] Chinese - Japanese
|
en: 26 Diciembre 2010, 12:08 pm
|
Hola a to2, una vez, como me suele pasar, encontré un código que me mostraba un mensaje (MsgBox) con Kanjis (simbolos chinos / japoneses) no me acuerdo donde está, vale oro, alguno de ustedes sabe como hacer éso? Desde ya muchas gracias.
|
|
|
197
|
Programación / Programación Visual Basic / [Ayuda] Hookin'
|
en: 30 Octubre 2010, 15:44 pm
|
Hola a todos, estaba probando el proyecto Inject_en / RedirectHook / IAT, el que es muy conocido y estaba cambiando funciones de un programa como "GetTickCount", el código es algo así: If Not RemoteHook(hProcess, "kernel32.dll", "GetTickCount", AddressOf MyGetTickCount) Then MsgBox "Couldn't hook MessageBoxA.", vbExclamation CloseProcess hProcess Exit Sub End If
Igualmente BlackZeroX lo tiene en su página. Ahora lo que yo pensé es que si puedo modificar esa función, podría modificar una función del programa, como por ej: Public Function Suma(ByVal n1 As Long, ByVal n2 As Long) As Long Suma = n1 + n2 End Function
Pero trato de modificar esa función y no encuentra nada es como que sólo capta funciones de windows alguna idéa? Desde ya muchas gracias
|
|
|
|
|
|
|