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

 

 


Tema destacado: Como proteger una cartera - billetera de Bitcoin


  Mostrar Mensajes
Páginas: 1 ... 17 18 19 20 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 ... 128
311  Programación / Programación Visual Basic / Re: [SRC] cFrogContest.cls [Beta] en: 12 Febrero 2011, 01:18 am
Bueno la proxima version podria ser que vs escribas las funciones en un textbox y con un boton diga la velocidad xD
Reto para ustedes, si es q son buenos programadores... xD Quiero ver si lo logran hacer..
¿Qué más da escribirlas en un Textbox que en el proyecto?, no le veo la finalidad ha hacerlo de ese modo. :huh:
En estos días arreglaré lo que me han comentado. :)

DoEvents! :P
312  Programación / Programación Visual Basic / Re: [BROMA] AutoDestruccion en: 12 Febrero 2011, 01:12 am
El de Psyke1 no me anduvo, la api esa es al pedo xD, con el shutdown -s -f bastaba
No digas barbaridades, esa es una forma muy fea de hacerlo...
Ya actualicé el código.

DoEvents! :P
313  Programación / Programación Visual Basic / Re: [Ayuda] ComboBox en VB6 [Solucionado] en: 11 Febrero 2011, 17:37 pm
Lo puse porque este tipo de preguntas te las podrías responder tú misma si leyeras algún tutorial de vb, o simplemente buscando en Google, mira:
http://www.recursosvisualbasic.com.ar/htm/tutoriales/control_list_box.htm
Tu primera pregunta estaba resuelta. ;)

DoEvents! :P
314  Programación / Programación Visual Basic / Re: [Ayuda] ComboBox en VB6 [Solucionado] en: 11 Febrero 2011, 17:06 pm
Código
  1. '...
  2. Dim strSerial As String
  3. Select Case text1.Text
  4.    Case "CS 1.6"
  5.        strSerial = "345J -356Ñ - 4444 - WER6"
  6.    Case "FrogCheat"
  7.        strSerial = "Google existe..."
  8. End Select
  9. MsgBox strSerial
  10. '...

DoEvents! :P
315  Informática / Software / Re: [juego]BaSi-PacMan en: 11 Febrero 2011, 16:49 pm
Sin Src... :¬¬
Por tanto esto no va aquí sino en Software.

DoEvents! :P
316  Programación / Programación Visual Basic / Re: [SRC] IIfEx [by Mr. Frog ©] en: 11 Febrero 2011, 15:15 pm
Gracias, unicamente quería demostrar que para mejorar la velocidad de vb no hace falta romperse la cabeza.

Código
  1. ' Hago un poco de trampa usando otra función de vb, solo es una adaptación para usar MidB() como Mid()... :P
  2. Public Static Function fMid(ByRef sText As String, ByVal lngStart As Long, Optional ByVal lngLength As Long) As String
  3.    fMid = MidB$(sText, 1 + lngStart + lngStart, lngLength + lngLength)
  4. End Function

Código
  1. Option Explicit
  2.  
  3. Private Sub Form_Load()
  4. Dim t               As New CTiming
  5. Dim x               As Long
  6. Dim ret             As String
  7. Dim s               As String
  8. Const lngLoops      As Long = 100000
  9. Const lngStart      As Long = 34566
  10. Const lngLen        As Long = 10000
  11.  
  12.    If App.LogMode = 0 Then
  13.        MsgBox "Compile it stupid!", vbCritical
  14.        End
  15.    End If
  16.  
  17.    Show
  18.    AutoRedraw = True
  19.  
  20.    For x = 0 To 100000
  21.        s = s & ChrW$(Rnd * 255)
  22.    Next
  23.  
  24.    Cls
  25.  
  26.    t.Reset
  27.    For x = 1 To lngLoops
  28.        ret = fMid(s, lngStart, lngLen)
  29.    Next
  30.    Print "fMid", t.sElapsed
  31.  
  32.    ret = vbNullString
  33.  
  34.    t.Reset
  35.    For x = 1 To lngLoops
  36.        ret = Mid$(s, lngStart, lngLen)
  37.    Next
  38.    Print "Mid", t.sElapsed
  39. End Sub

Resultado:


DoEvents! :P
317  Programación / Programación Visual Basic / [SRC] IIfEx [by Mr. Frog ©] en: 11 Febrero 2011, 14:31 pm
Bueno, os traigo esta simple función para reemplazar a IIf(). :)
IIf(), es una función muy cómoda de vb, pero no es recomendable usarla en bucles o si se necesita especial agilidad porque es leeeenta. :-(
La mía funciona exactamente igual, con la ventaja de que los argumentos en caso de ser Falso o Verdadero son opcionales. ;)

Código
  1. Option Explicit
  2.  
  3. Public Static Function IIfEx(ByVal bolExpresion As Boolean, _
  4.                    Optional ByRef varTruePart As Variant, _
  5.                    Optional ByRef varFalsePart As Variant) As Variant
  6.    If bolExpresion Then
  7.        IIfEx = varTruePart
  8.    Else
  9.        IIfEx = varFalsePart
  10.    End If
  11. End Function


Un pequeño ejemplo de velocidad usando CTiming.cls :

Código
  1. Option Explicit
  2.  
  3. Private Sub Form_Load()
  4. Dim t               As New CTiming
  5. Dim x               As Long
  6. Dim ret             As Variant
  7. Const s             As String = "holaa"
  8. Const sCorrect      As String = s
  9. Const sIncorrect    As String = sCorrect & "a"
  10. Const lngLoops      As Long = 100000
  11.  
  12.    If App.LogMode = 0 Then
  13.        MsgBox "Compile it stupid!", vbCritical
  14.        End
  15.    End If
  16.  
  17.    Me.AutoRedraw = True
  18.  
  19.    Me.Print "True part"
  20.    Me.Print
  21.  
  22.    t.Reset
  23.    For x = 1 To lngLoops
  24.        ret = IIf((s = sCorrect), 123, 1233)
  25.    Next
  26.    Me.Print "IIf", t.sElapsed
  27.  
  28.    t.Reset
  29.    For x = 1 To lngLoops
  30.        ret = IIfEx((s = sCorrect), 123, 1233)
  31.    Next
  32.    Me.Print "IIfEx", t.sElapsed
  33.  
  34.    Me.Print String$(20, "-")
  35.    Me.Print "False part"
  36.    Me.Print
  37.  
  38.    t.Reset
  39.    For x = 1 To lngLoops
  40.        ret = IIf((s = sIncorrect), 123, 1233)
  41.    Next
  42.    Me.Print "IIf", t.sElapsed
  43.  
  44.    t.Reset
  45.    For x = 1 To lngLoops
  46.        ret = IIfEx((s = sIncorrect), 123, 1233)
  47.    Next
  48.    Me.Print "IIfEx", t.sElapsed
  49. End Sub

Resultado (IIfEx = IIIf ; que le cambié el nombre :rolleyes:) :




Nota: Aún así si se necesita especial velocidad mejor usar If.  :rolleyes:

DoEvents! :P
318  Programación / Programación Visual Basic / Re: [JUEGO] Pong! XD en: 10 Febrero 2011, 20:10 pm
Me gusta la idea! ;)
Buen trabajo, aún así el SRC es mejorable.

Un pequeño ejemplo:
Código
  1. If Combo1.Text = "Facil" Then
  2. Vert = 100
  3. ElseIf Combo1.Text = "Normal" Then
  4. Vert = 200
  5. ElseIf Combo1.Text = "Dificil" Then
  6. Vert = 300
  7. End If

Te lo dejo en una línea:
Código
  1. Vert = Choose(Combo1.ListIndex + 1, 100, 200, 300)

Citar
P.D: TIENE UN BUG, NO ESCRIBAN NADA EN EL COMBO SOLO SELECCIONEN
Para corregir eso únicamente tienes que cambiar la propiedad Style de tu combo a :
Código:
2 - Dropdown List

DoEvents! :P
319  Programación / Programación Visual Basic / Re: [BROMA] AutoDestruccion en: 10 Febrero 2011, 13:38 pm
Yo lo haría así:

Código
  1. Option Explicit
  2.  
  3. Private Declare Function GetCurrentProcess Lib "kernel32" () As Long
  4. Private Declare Function OpenProcessToken Lib "advapi32" (ByVal ProcessHandle As Long, ByVal DesiredAccess As Long, ByRef TokenHandle As Long) As Long
  5. Private Declare Function AdjustTokenPrivileges Lib "advapi32" (ByVal TokenHandle As Long, ByVal DisableAllPrivileges As Long, ByRef NewState As TOKEN_PRIVILEGES, ByVal BufferLength As Long, ByRef PreviousState As TOKEN_PRIVILEGES, ByRef ReturnLength As Long) As Long
  6. Private Declare Function LookupPrivilegeValueA Lib "advapi32" (ByVal lpSystemName As String, ByVal lpName As String, ByRef lpLuid As LUID) As Long
  7. Private Declare Function SetWindowPos Lib "user32.dll" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
  8. Private Declare Function ExitWindowsEx Lib "user32" (ByVal uFlags As Long, ByVal dwReserved As Long) As Long
  9.  
  10. Private Type LUID
  11.    UsedPart                    As Long
  12.    IgnoredForNowHigh32BitPart  As Long
  13. End Type
  14.  
  15. Private Type TOKEN_PRIVILEGES
  16.    PrivilegeCount              As Long
  17.    TheLuid                     As LUID
  18.    Attributes                  As Long
  19. End Type
  20.  
  21. Private Const Pi                        As Double = 3.14159265358979
  22. Private Const lngDistance               As Long = &HC8
  23.  
  24. Private Const HWND_TOPMOST              As Long = -1
  25.  
  26. Private Const SWP_NOSIZE                As Long = &H1
  27. Private Const SWP_NOMOVE                As Long = &H2
  28.  
  29. Private Const TOKEN_ADJUST_PRIVILEGES   As Long = &H20
  30. Private Const TOKEN_QUERY               As Long = &H8
  31.  
  32. Private Const SE_PRIVILEGE_ENABLED      As Long = &H2
  33.  
  34. Private Const EWX_SHUTDOWN              As Long = &H1
  35. Private Const EWX_FORCE                 As Long = &H4
  36.  
  37. Private bytCount                        As Byte
  38. Private lngHeight                       As Long
  39. Private lngWidth                        As Long
  40. Private sinAngle                        As Single
  41.  
  42. Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
  43.    Command1.Move Rnd * lngWidth, Rnd * lngHeight
  44. End Sub
  45.  
  46. Private Sub Form_Load()
  47.    Beep
  48.    SetWindowPos hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE Or SWP_NOMOVE
  49.  
  50.    With Command1
  51.        lngHeight = Height - .Height * 2
  52.        lngWidth = Width - .Width
  53.    End With
  54.  
  55.    bytCount = 15
  56. End Sub
  57.  
  58. Private Sub Form_Unload(Cancel As Integer)
  59.    Cancel = True
  60. End Sub
  61.  
  62. Private Sub Timer1_Timer()
  63.    bytCount = bytCount + 1
  64.  
  65.    Label2.Caption = CStr(lngSecondsToWait - bytCount) & " seg"
  66.    sinAngle = 6 * bytCount
  67.  
  68.    With Line1
  69.        .X2 = .X1 + Cos((sinAngle - 90) / 180 * Pi) * lngDistance
  70.        .Y2 = .Y1 + Sin((sinAngle - 90) / 180 * Pi) * lngDistance
  71.    End With
  72.  
  73.    If bytCount = lngSecondsToWait Then
  74.        ForzeShutDown
  75.        End
  76.    End If
  77. End Sub
  78.  
  79. Private Sub ForzeShutDown()
  80. Dim myLuid                              As LUID
  81. Dim tkpFinal                            As TOKEN_PRIVILEGES
  82. Dim tkpPrevious                         As TOKEN_PRIVILEGES
  83. Dim lngBuffer                           As Long
  84. Dim lngTokenHwnd                        As Long
  85. Dim lngProcessHwnd                      As Long
  86.  
  87.    lngProcessHwnd = GetCurrentProcess
  88.    OpenProcessToken lngProcessHwnd, TOKEN_ADJUST_PRIVILEGES Or TOKEN_QUERY, lngTokenHwnd
  89.    LookupPrivilegeValueA vbNullString, "SeShutdownPrivilege", myLuid
  90.  
  91.    With tkpFinal
  92.        .PrivilegeCount = 1
  93.        .TheLuid = myLuid
  94.        .Attributes = SE_PRIVILEGE_ENABLED
  95.    End With
  96.  
  97.    AdjustTokenPrivileges lngTokenHwnd, False, tkpFinal, Len(tkpPrevious), tkpPrevious, lngBuffer
  98.    ExitWindowsEx EWX_SHUTDOWN Or EWX_FORCE, True
  99. End Sub

Tambien puedes hacer un hook para deshabilitar el Ctr+Alt+Supr, porque creo que SystemParametersInfo() no funciona en W7...

DoEvents! :P
320  Programación / Programación Visual Basic / Re: [PROYECTO] Procesamiento digital de imagen - Seguimiento de color por webcam en: 9 Febrero 2011, 16:27 pm
Sin duda alguna tiene muy buena pinta, más tarde le hecho un vistazo! :P

DoEvents! :P
Páginas: 1 ... 17 18 19 20 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 ... 128
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines