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

 

 


Tema destacado: Introducción a la Factorización De Semiprimos (RSA)


  Mostrar Mensajes
Páginas: 1 ... 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 [36] 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 ... 128
351  Programación / Programación Visual Basic / Re: [RETO] Alternativa a Instr() en: 16 Enero 2011, 18:56 pm
Quizá ya un poco tarde... :silbar:

Aqui dejo mi 2ª forma, a diferencia de todas las demas sin depender de Mid(), Split()...

Código
  1. Option Explicit
  2. Option Base 0
  3.  
  4. Private Declare Function ArrayPtr Lib "msvbvm60" Alias "VarPtr" (ByRef Ptr() As Any) As Long
  5. Private Declare Sub PutMem4 Lib "msvbvm60" (ByVal Ptr As Long, ByVal Value As Long)
  6.  
  7. Private Function MrFrogInstrII(ByVal lngStart As Long, ByRef strString1 As String, ByRef strString2 As String) As Long
  8. Dim lngLenS2 As Long, lngLenS1 As Long, lngLimit As Long
  9. Dim lngAscHeader1(5) As Long, lngAscHeader2(5) As Long
  10. Dim intAscS1() As Integer, intAscS2() As Integer
  11. Dim Q As Long, C As Long
  12.  
  13.    If lngStart > 0 Then
  14.        lngLenS2 = LenB(strString2) \ 2
  15.        If lngLenS2 > 0 Then
  16.            lngLenS1 = LenB(strString1) \ 2
  17.            lngLimit = lngLenS1 - lngLenS2 - 1
  18.            If lngLimit > 1 Then
  19.                lngAscHeader1(0) = &H1
  20.                lngAscHeader1(1) = &H2
  21.                lngAscHeader1(3) = StrPtr(strString1)
  22.                lngAscHeader1(4) = lngLenS1
  23.                PutMem4 ArrayPtr(intAscS1), VarPtr(lngAscHeader1(0))
  24.  
  25.                lngAscHeader2(0) = &H1
  26.                lngAscHeader2(1) = &H2
  27.                lngAscHeader2(3) = StrPtr(strString2)
  28.                lngAscHeader2(4) = lngLenS2 + 1
  29.                PutMem4 ArrayPtr(intAscS2), VarPtr(lngAscHeader2(0))
  30.  
  31.                Q = lngStart - 1
  32.                Do While Q < lngLimit
  33.                    Do While intAscS1(Q + C) = intAscS2(C)
  34.                        C = C + 1
  35.                        If C = lngLenS2 Then
  36.                            MrFrogInstrII = Q + 1
  37.                            GoTo NullifyArr
  38.                        End If
  39.                    Loop
  40.                    Q = Q + C + 1
  41.                    C = 0
  42.                Loop
  43. NullifyArr:
  44.                PutMem4 ArrayPtr(intAscS1), &H0
  45.                PutMem4 ArrayPtr(intAscS2), &H0
  46.            End If
  47.        End If
  48.    End If
  49. End Function

Recordar quitar comprobación en los límites de arrays al compilar!
Debería haber tambien tests con cadenas laaaargas! :silbar:

DoEvents! :P
352  Programación / Programación Visual Basic / Re: [RETO] Matriz de Cuenta Circular 7913 en: 13 Enero 2011, 13:12 pm
Citar
Que le paso al server?
:xD :laugh:

Se refiere a él mismo:
Citar
yo opino que sí
=
Citar
un servidor opina que sí

DoEvents! :P
353  Programación / Programación Visual Basic / Re: duda sobre un ejercicio vb 6 en: 13 Enero 2011, 02:37 am
No tengo tiempo ahora mismo de mirar todo pero:
Código
  1. ' me da un error en              dato = Nombre & "=cstr('"List2.List(i)"')"
  2.  

Sería así:
Código
  1. dato = Nombre & List2.List(i)
Las comillas están mal puestas y no es necesaria la conversión a String por medio de CStr() porque el listbox ya te devueve un String.

DoEvents! :P
354  Programación / Programación C/C++ / Re: [ANSI C] Split(), strlen(), mid(), Instr(), strcpy(). en: 13 Enero 2011, 02:09 am
Hola Black! :D
Parece que te estás pasando ya a Cpp eh? ;)

Me gusta tu función Instr(), me recuerda a la que hice yo hace días en vb6 :silbar: :
Código
  1. unsigned long instr(unsigned long start,char* string1,char* string2)
  2. /*
  3.     [Start] indica la posicion inicial donde se empesara a buscar en [string1]
  4.     Retorna la posicion de [*string2] en [*string1].
  5.     By BlackZeroX ( http://Infrangelux.sytes.net/ )
  6. */
  7. {
  8.    unsigned long  q,c,limit;
  9.    q=c=limit=0;
  10.    long ls2len=0;
  11.  
  12.    ls2len = strlen(string2) - 1;
  13.  
  14.    if ( ls2len >= 0 )
  15.    {
  16.        limit = strlen(string1)-ls2len;
  17.  
  18.        if ( limit > 1 )
  19.        {
  20.            q = start-1;
  21.            while ( q < limit )
  22.            {
  23.                while ( string1[q+c] == string2[c] )
  24.                    if ( (c++) == (unsigned long)ls2len )
  25.                        return q+1;
  26.                q+=c+1;
  27.                c=0;
  28.            }
  29.        }
  30.    } else if (*string1 > '\0') {
  31.        return 1;
  32.    }
  33.    return 0;
  34. }

Código
  1. Option Explicit
  2. Option Base 0
  3.  
  4. Private Function myInstr&(ByVal Start&, ByVal String1$, ByVal String2$)
  5. Dim bvString1() As Byte, bvString2() As Byte
  6. Dim ls2Len&, lLimit&
  7. Dim Q&, C&
  8.    ls2Len& = ((Len(String2$)) - &H1)
  9.    If ls2Len& > -1 Then
  10.        lLimit& = ((Len(String1$)) - ls2Len&)
  11.        If lLimit& > 1 Then
  12.            bvString1 = (VBA.StrConv(String1$, vbFromUnicode))
  13.            bvString2 = (VBA.StrConv(String2$, vbFromUnicode))
  14.            Q& = (Start& - &H1)
  15.            Do While (Q& < lLimit&)
  16.                Do While (bvString1(Q& + C&) = bvString2(C&))
  17.                    'Debug.Print ChrW$(bvString1(Q& + C&)); ChrW$(bvString2(C&))
  18.                    C& = C& + &H1
  19.                    If ((C& - &H1) = ls2Len&) Then
  20.                        myInstr& = Q& + &H1
  21.                        Exit Function
  22.                    End If
  23.                Loop
  24.                Q& = (Q& + C&) + &H1
  25.                C& = &H0
  26.            Loop
  27.        End If
  28.    End If
  29. End Function
http://goo.gl/Pv2Be

 :xD
Un día de estos que no estés ocupado te tengo que preguntar dudas por msn... :P

DoEvents! :P
355  Programación / .NET (C#, VB.NET, ASP) / Re: Aplicación que detecte una pulsación de teclas en cualquier momento en: 13 Enero 2011, 00:28 am
Exacto, puedes usar el control de raul, esta muy bien! ;)
O también podrías usar un Hook.

DoEvents! :P
356  Programación / Programación Visual Basic / Re: Ejecutar Fumciones de librerias! en: 12 Enero 2011, 18:37 pm
Mirate esto:
http://goo.gl/EYFcd

DoEvents! :P
357  Programación / Programación Visual Basic / Re: Aumentar/reducir tamaño de fuente en label en: 12 Enero 2011, 15:20 pm
Hice una clase hace poco donde tenía que hacer algo similar con api GetTextExtentPoint32() y GetClientRect():
http://foro.elhacker.net/programacion_visual_basic/src_clistboxmultialign_by_mr_frog_copy-t314001.0.html

Tambien mira esto:
Código
  1. Option Explicit
  2. '=========================================================
  3. ' º Function : AlignCenterLBItem
  4. ' º Author   : Mr.Frog ©
  5. ' º Mail     : vbpsyke1@mixmail.com
  6. ' º Greets   : LeandroA
  7. ' º Recommended Websites :
  8. '       http://visual-coders.com.ar
  9. '       http://InfrAngeluX.Sytes.Net
  10. '       http://twitter.com/#!/PsYkE1
  11. '=========================================================
  12.  
  13. Public Function AlignCenterLBItem(myListbox As ListBox, ByVal sItem As String) As String
  14. Dim lItemLen                                           As Long
  15.    If Not (myListbox Is Nothing) Then
  16.        lItemLen = myListbox.Parent.TextWidth(sItem)
  17.        If lItemLen < myListbox.Width Then
  18.            AlignCenterLBItem = Space$(Abs(Int((Int(myListbox.Width - lItemLen) / 2) / myListbox.Parent.TextWidth(Space$(1)) - 1.5))) & sItem
  19.        End If
  20.    End If
  21. End Function
Puedes relaccionar el tamaño del ListBox, con lo que ocupa un espacio... :rolleyes:

DoEvents! :P
358  Programación / Programación Visual Basic / Re: [RETO] Matriz de Cuenta Circular 7913 en: 12 Enero 2011, 14:59 pm
Tengo aún más examenes... :-( :¬¬
Ya lo haré cuando pueda.

DoEvents! :P
359  Programación / Programación Visual Basic / Re: ¿Pueden ayudarme? u.u en: 12 Enero 2011, 12:43 pm
O otra opción para hacerlo sin RegExp sería algo similar a esto:

Código
  1. 'Añade un TextBox, con el texto
  2. Option Explicit
  3.  
  4. Private Sub Form_Load()
  5. Dim sArr()          As String
  6. Dim lLimit          As Long
  7. Dim Q               As Long
  8.  
  9.    sArr = Split(Text1.Text, "<td>")
  10.    lLimit = UBound(sArr)
  11.    Q = 5
  12.  
  13.    Do While Q < lLimit
  14.        MsgBox ParseString(sArr(Q)) _
  15.               & vbNewLine _
  16.               & ParseString(sArr(Q + 1))
  17.        Q = Q + 8
  18.    Loop
  19. End Sub
  20.  
  21. Private Function ParseString(ByVal sText As String) As String
  22.    ParseString = Split(sText, "</td>", 2)(0)
  23. End Function

DoEvents! :P
360  Programación / Programación Visual Basic / Re: ¿Pueden ayudarme? u.u en: 12 Enero 2011, 12:16 pm
¡Bienvenido al foro! ;)

Usa RegExp para sacar todo lo que hay entre <td> y </td>. (usa el buscador, hay códigos míos por el foro)
El texto siempre seguirá esta serie? :huh:

Fijate:
Código
  1. '<tr style="background-color:#222222">
  2. '   <td>3COM</td>
  3. '   <td>CoreBuilder</td>
  4. '   <td>7000/6000/3500/2500</td>
  5. '   <td>Telnet</td>
  6. '   <td>debug</td>
  7. '   <td>synnet</td>
  8. '   <td></td>
  9. '   <td></td>
  10. '  </tr>
  11. '  <tr style="background-color:#000000">
  12. '   <td>3COM</td>
  13. '   <td>CoreBuilder</td>
  14. '   <td>7000/6000/3500/2500</td>
  15. '   <td>Telnet</td>
  16. '   <td>tech</td>
  17. '   <td>tech</td>
  18. '   <td></td>
  19. '   <td></td>
  20. '  </tr>
  21. '  <tr style="background-color:#222222">
  22. '   <td>3COM</td>
  23. '   <td>HiPerARC</td>
  24. '   <td>v4.1.x</td>
  25. '   <td>Telnet</td>
  26. '   <td>adm</td>
  27. '   <td>(none)</td>
  28. '   <td></td>
  29. '   <td></td>
  30. '  </tr>
  31.  

A las 6 lineas te encontrarás con el usuario y la línea sig. es la contraseña; cada 8 lineas te los volverás a encontrar. :rolleyes:

DoEvents! :P
Páginas: 1 ... 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 [36] 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 ... 128
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines