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

 

 


Tema destacado: Guía rápida para descarga de herramientas gratuitas de seguridad y desinfección


  Mostrar Mensajes
Páginas: 1 2 3 4 5 6 7 8 9 10 11 12 13 [14] 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 ... 74
131  Programación / Programación Visual Basic / Re: [RETO] Matriz de Cuenta Circular 7913 en: 11 Enero 2011, 08:45 am
no tiene las comprobaciones de si es Par y mayor a 2 y menor a  180 pero bueno eso ya lo tenemos por sabido.

Código
  1. Private Function Leandro_Cuenta_Circular7913(N&, m() As Integer, TIPO As Boolean)
  2.    Dim Max As Long
  3.    Dim X1 As Long
  4.    Dim X2 As Long
  5.    Dim Y1 As Long
  6.    Dim Y2 As Long
  7.    Dim lCont As Long
  8.    Dim I As Long
  9.    Dim j As Long
  10.    Dim Mitad As Long
  11.  
  12.  
  13.    Max = N * N
  14.  
  15.    ReDim m(0 To N, 0 To N)
  16.  
  17.    If TIPO Then
  18.  
  19.        X2 = N
  20.        Y2 = N
  21.  
  22.        Do While lCont < Max
  23.            m(X1, Y1) = 7
  24.            X1 = X1 + 1
  25.            For I = X1 To N - X1
  26.                lCont = lCont + 1
  27.                m(I, Y1) = lCont
  28.            Next
  29.            m(I, Y1) = 9
  30.            Y1 = Y1 + 1
  31.  
  32.            For I = Y1 To N - Y1
  33.                lCont = lCont + 1
  34.                m(X2, I) = lCont
  35.            Next
  36.            m(X2, I) = 3
  37.            X2 = X2 - 1
  38.  
  39.            For I = X2 To X1 Step -1
  40.                lCont = lCont + 1
  41.                m(I, Y2) = lCont
  42.            Next
  43.            m(I, Y2) = 1
  44.            Y2 = Y2 - 1
  45.  
  46.            For I = Y2 To Y1 Step -1
  47.                lCont = lCont + 1
  48.                m(X1 - 1, I) = lCont
  49.            Next
  50.        Loop
  51.  
  52.    Else
  53.  
  54.       Mitad = N / 2
  55.  
  56.       For I = 0 To Mitad - 1
  57.           m(X1, I) = 7
  58.           X1 = X1 + 1
  59.  
  60.           For j = X1 To N - X1
  61.             lCont = lCont + 1
  62.             m(j, I) = lCont
  63.           Next
  64.           m(j, I) = 9
  65.       Next
  66.  
  67.       For I = N To Mitad + 1 Step -1
  68.  
  69.           Y1 = Y1 + 1
  70.  
  71.           For j = Y1 To N - Y1
  72.             lCont = lCont + 1
  73.             m(I, j) = lCont
  74.           Next
  75.           m(j, I) = 3
  76.       Next
  77.  
  78.       For I = N To Mitad + 1 Step -1
  79.  
  80.           Y2 = Y2 + 1
  81.  
  82.           For j = N - Y2 To Y2 Step -1
  83.             lCont = lCont + 1
  84.             m(j, I) = lCont
  85.           Next
  86.           m(j, I) = 1
  87.       Next
  88.  
  89.       For I = 0 To Mitad - 1
  90.  
  91.           X2 = X2 + 1
  92.  
  93.           For j = N - X2 To X2 Step -1
  94.             lCont = lCont + 1
  95.             m(I, j) = lCont
  96.           Next
  97.  
  98.       Next
  99.  
  100.    End If
  101.  
  102. End Function
  103.  
  104.  

Código
  1. Option Explicit
  2.  
  3. Private Sub Form_Load()
  4.    Dim X As Long, Y As Long
  5.    Dim m() As Integer
  6.    Dim N As Long
  7.  
  8.    N = 8
  9.  
  10.    Leandro_Cuenta_Circular7913 N, m, False
  11.  
  12.    For Y = 0 To N
  13.        For X = 0 To N
  14.            Debug.Print m(X, Y),
  15.        Next
  16.        Debug.Print
  17.    Next
  18.  
  19.    Debug.Print vbCrLf
  20.    Leandro_Cuenta_Circular7913 N, m, True
  21.  
  22.    For Y = 0 To N
  23.        For X = 0 To N
  24.            Debug.Print m(X, Y),
  25.        Next
  26.        Debug.Print
  27.    Next
  28.  
  29. End Sub
  30.  
132  Programación / Programación Visual Basic / Re: [SRC][UC] ListViewEx 2.0 Reprogramado ( 05/01/2011 ) No Skiner en: 7 Enero 2011, 03:52 am
Muy bueno Black va tomando color, lo probe hay algunas sugerencias que he notado, que bueno seguramente ya las iras corrigiendo.

-la seleccion Hot deberia desaparecer cuando el muse sale del listview
-deberias poner el cursor (Size W E) cuando te posicionas sobre una columna para modificar su tamaño.
-Soporte para la rueda del Mouse. (aunque veo que aun no estas subclasificando)
-cuando se encuentra escaneando veo que se puede seleccionar donde no hay items, pero esto puede ser que no se refresca a tiempo
-cuando te moves con las flechas (Arriba , Abajo) la selección debería acompañar el ultimo o primer item según el caso.

hay algunas otras pero seguramente ya lo vas abras notado, yo creo que si seguís con este control un buen paso a seguir es implementar los scroll del sistema para no utilizar los controles de vb. son muy complicado este tipo de controles ya que hay muchas cosas a tener en cuenta, pero bueno dale para adelante y felicitaciones nuevamente.

Saludos.
133  Programación / Programación Visual Basic / Re: Alternativa a keybd_event ? en: 6 Enero 2011, 15:58 pm
Modifica

Código:
Private Type KEYBDINPUT
  wVk As Integer
  wScan As Integer
  dwFlags As Long
  time As Long
  dwExtraInfo As Long
End Type

Private Type GENERALINPUT
  dwType As Long
  xi as KEYBDINPUT '<------ aca
End Type

eso tendria que arreglarlo si solamente queres el keyboard

Hola Cobein probe de esa forma pero no funciono, para que ande tube que agregar ocho byte mas para completar los 24 bytes

Código:
Private Type KEYBDINPUT
  wVk As Integer
  wScan As Integer
  dwFlags As Long
  time As Long
  dwExtraInfo As Long
End Type

Private Type GENERALINPUT
  dwType As Long
  xi As KEYBDINPUT
  Relleno(0 To 7) As Byte '<------ aca
End Type


@Karcrack 

Es una mejora para el "escritorio remoto", no me funcionaba bien las partes de las pulsaciones, no te explico con detalles porque es un chivo largo, pero bueno la idea es buscar un sustituto haber si mejora la cosa.

Saludos y gracias por todo
134  Programación / Programación Visual Basic / Re: Alternativa a keybd_event ? en: 6 Enero 2011, 05:10 am
bueno parce que SendInput es la alternativa, aun no lo pruevo, este es un ejemplo del api guide pero no logro liberarme del Copymemory, ...

sigo devajo
Código:
Const VK_H = 72
Const VK_E = 69
Const VK_L = 76
Const VK_O = 79
Const KEYEVENTF_KEYUP = &H2
Const INPUT_MOUSE = 0
Const INPUT_KEYBOARD = 1
Const INPUT_HARDWARE = 2
Private Type MOUSEINPUT
  dx As Long
  dy As Long
  mouseData As Long
  dwFlags As Long
  time As Long
  dwExtraInfo As Long
End Type
Private Type KEYBDINPUT
  wVk As Integer
  wScan As Integer
  dwFlags As Long
  time As Long
  dwExtraInfo As Long
End Type
Private Type HARDWAREINPUT
  uMsg As Long
  wParamL As Integer
  wParamH As Integer
End Type
Private Type GENERALINPUT
  dwType As Long
  xi(0 To 23) As Byte
End Type
Private Declare Function SendInput Lib "user32.dll" (ByVal nInputs As Long, pInputs As GENERALINPUT, ByVal cbSize As Long) As Long
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (pDst As Any, pSrc As Any, ByVal ByteLen As Long)
Private Sub Form_KeyPress(KeyAscii As Integer)
    'Print the key on the form
    Me.Print Chr$(KeyAscii);
End Sub
Private Sub Form_Paint()
    'KPD-Team 2000
    'URL: http://www.allapi.net/
    'E-Mail: KPDTeam@Allapi.net
    'Clear the form
    Me.Cls
    'call the SendKey-function
    SendKey VK_H
    SendKey VK_E
    SendKey VK_L
    SendKey VK_L
    SendKey VK_O
End Sub
Private Sub SendKey(bKey As Byte)
    Dim GInput(0 To 1) As GENERALINPUT
    Dim KInput As KEYBDINPUT
    KInput.wVk = bKey  'the key we're going to press
    KInput.dwFlags = 0 'press the key
    'copy the structure into the input array's buffer.
    GInput(0).dwType = INPUT_KEYBOARD   ' keyboard input
    CopyMemory GInput(0).xi(0), KInput, Len(KInput)
    'do the same as above, but for releasing the key
    KInput.wVk = bKey  ' the key we're going to realease
    KInput.dwFlags = KEYEVENTF_KEYUP  ' release the key
    GInput(1).dwType = INPUT_KEYBOARD  ' keyboard input
    CopyMemory GInput(1).xi(0), KInput, Len(KInput)
    'send the input now
    Call SendInput(2, GInput(0), Len(GInput(0)))
End Sub

al parecer esta api trabja con diferentes extructuras y los del apiguide para generalizar utilizaron un array de bits para copiar la extructura a este, yo solo voy a utilizar KEYBDINPUT lo que no entiendo no me funciona si uilizo esta estructura de esta forma

Private Type tINPUT
  dwType As Long
  ki As KEYBDINPUT
End Type

si bien ellos redimencionan el array a 24 bits KEYBDINPUT tiene como largo 32 bits
bueno en fin sigo probando hasta que salga. si alguien puede que chifle.
saludos.
135  Programación / Programación Visual Basic / Alternativa a keybd_event ? en: 6 Enero 2011, 03:30 am
Buenas alguien conoce una api o alternativa a keybd_event  (Que no sea SendKeys o SendMessage)

SAludos.
136  Programación / Programación Visual Basic / Re: aplicacion para detener apagado de windows en: 4 Enero 2011, 06:24 am
hola yo creo que con algo así te bastaría

Código:
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    If UnloadMode = 2 Then
        Cancel = 1
        Shell Split(Environ("path"), ";")(0) & "\tu_carpeta\tu_ejecutable.exe"
    End If
End Sub

ahora como vas a enviarme los 25 dolares  :-\
137  Programación / Programación Visual Basic / Re: [Reto] Zig Zag (OJO ANALISIS) en: 3 Enero 2011, 17:20 pm
Ahora si se entendió, no me cerraban los ejemplos, igual me hizo parir para sacar la primera fila  :rolleyes: , supongo que si pongo el code se termina el misterio.

pueden faltar algunos ajustes pero creo que es la idea
Código
  1. Private Sub Form_Load()
  2.   Dim mArray() As Double
  3.   Dim X As Long, Y As Long
  4.   Dim Num As Double
  5.  
  6.   Num = 10.98
  7.  
  8.   If Leandro_ZipZag(Num, mArray) Then
  9.  
  10.       '======Imprimir========
  11.       For Y = 0 To UBound(mArray, 2)
  12.           For X = 0 To UBound(mArray, 1)
  13.               Debug.Print mArray(X, Y),
  14.           Next
  15.           Debug.Print
  16.       Next
  17.  
  18.   End If
  19. End Sub
  20.  
  21.  
  22. Private Function Leandro_ZipZag(ByVal Num As Double, m() As Double) As Boolean
  23.  Dim lSize As Long
  24.  Dim X As Long, Y As Long, I As Long
  25.  Dim Cont As Double
  26.  Dim Factor As Double
  27.  Dim nDecimal As Double
  28.  
  29.  'Numeros positivos
  30.  If Num And &H80000000 Then Exit Function
  31.  
  32.  'Busca el cuadrado (By Karcrack)
  33.  Do Until (Num And 7) = 1 Or (Num And 31) = 4 Or (Num And 127) = 16 Or (Num And 191) = 0
  34.      Num = Num - 1
  35.  Loop
  36.  'Saca la parte decimal
  37.  nDecimal = Num - Int(Num)
  38.  
  39.  'Tamaño de la matriz
  40.  lSize = Sqr(Num)
  41.  
  42.  ReDim m(lSize, lSize + 1)
  43.  
  44.  'Rellena la primera mitad de la matriz
  45.  For X = 0 To lSize
  46.      Y = 1
  47.      For I = X - 1 To 0 Step -1
  48.         Cont = Cont + 1
  49.         m(I, Y) = Cont + nDecimal
  50.         Y = Y + 1
  51.      Next
  52.  Next
  53.  
  54.  'Rellena la Segunda mitad de la matriz
  55.  For Y = 2 To lSize
  56.      X = lSize - 1
  57.      For I = Y To lSize
  58.         Cont = Cont + 1
  59.         m(X, I) = Cont + nDecimal
  60.         X = X - 1
  61.      Next
  62.  Next
  63.  
  64.  'Suma las columnas
  65.  For X = 0 To lSize
  66.      Cont = 0
  67.      For Y = 1 To lSize
  68.          Cont = Cont + m(X, Y)
  69.      Next
  70.      m(X, Y) = Cont
  71.  Next
  72.  
  73.  'Suma las Filas
  74.  For Y = 1 To lSize + 1
  75.      Cont = 0
  76.      For X = 0 To lSize - 1
  77.          Cont = Cont + m(X, Y)
  78.      Next
  79.      m(X, Y) = Cont
  80.  Next
  81.  
  82.  'Rompe coco
  83.  m(X, 0) = Cont
  84.  Factor = Cont * 2
  85.  
  86.  Y = Y - 1
  87.  
  88.  For X = 0 To lSize - 1
  89.       m(X, 0) = Factor + m(X, Y)
  90.  Next
  91.  
  92.  Leandro_ZipZag = True
  93.  
  94. End Function
  95.  

los decimales te la debo.
138  Programación / Programación Visual Basic / Re: [Reto] Zip Zag (OJO ANALISIS) en: 3 Enero 2011, 07:37 am
Black yo entiendo que sea un reto y me engancho, pero estas seguro que los ejemplos que pusiste estan bien? yo no le encuentro ninguna coerencia. a la primera fila
solo puedo sospechar que el ultimo de la primera es igual al ultimo de la ultima (Aunque en los ejemplos no sea asi) 

por las dudas revisalo asi nadie se quema el marote al pepe.

Saludos.

139  Programación / Programación Visual Basic / Re: [Reto] Zip Zag (OJO ANALISIS) en: 3 Enero 2011, 04:26 am
Bueno aun faltan definir bien como van a ser las cosas, asi que solo voy a poner parte de lo que hice, cuando este todo bien aclarado lo continuo.

Código
  1. Option Explicit
  2.  
  3. Private Sub Form_Load()
  4.    Leandro_ZipZag 64
  5. End Sub
  6.  
  7.  
  8. Private Function Leandro_ZipZag(ByVal lNum As Long) As Long()
  9.    Dim m() As Long
  10.    Dim lSize As Long
  11.    Dim X As Long, Y As Long, I As Long
  12.    Dim lCount As Long
  13.  
  14.    'Do Until (lNum And 7) = 1 Or (lNum And 31) = 4 Or (lNum And 127) = 16 Or (lNum And 191) = 0
  15.    '    lNum = lNum - 1
  16.    'Loop
  17.  
  18.    lSize = Sqr(lNum)
  19.  
  20.    ReDim m(lSize, lSize + 1)
  21.  
  22.    For X = 0 To lSize
  23.        Y = 1
  24.        For I = X - 1 To 0 Step -1
  25.           lCount = lCount + 1
  26.           m(I, Y) = lCount
  27.           Y = Y + 1
  28.        Next
  29.    Next
  30.  
  31.    For Y = 2 To lSize
  32.        X = lSize - 1
  33.        For I = Y To lSize
  34.           lCount = lCount + 1
  35.           m(X, I) = lCount
  36.           X = X - 1
  37.        Next
  38.    Next
  39.  
  40.    For X = 0 To lSize
  41.        lCount = 0
  42.        For Y = 1 To lSize
  43.            lCount = lCount + m(X, Y)
  44.        Next
  45.        m(X, Y) = lCount
  46.    Next
  47.  
  48.    For Y = 1 To lSize + 1
  49.        lCount = 0
  50.        For X = 0 To lSize - 1
  51.            lCount = lCount + m(X, Y)
  52.        Next
  53.        m(X, Y) = lCount
  54.    Next
  55.  
  56.    '======Imprimir========
  57.    For Y = 0 To lSize + 1
  58.        For X = 0 To lSize
  59.            Debug.Print m(X, Y),
  60.        Next
  61.        Debug.Print
  62.    Next
  63.  
  64. End Function
  65.  
140  Programación / Programación Visual Basic / Re: [Reto] Zip Zag (OJO ANALISIS) en: 3 Enero 2011, 02:08 am
la penultima suma del primer ejemplo esta mal suma es 400 no 399, si vas a devolver un array unidimencional como se supone que tiene que ser ordenado de x a y o de y a x

creo que serima mejor dejarlo como un array bidimensional

pone mas ejemplos.
Páginas: 1 2 3 4 5 6 7 8 9 10 11 12 13 [14] 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 ... 74
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines