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

 

 


Tema destacado: Sigue las noticias más importantes de seguridad informática en el Twitter! de elhacker.NET


  Mostrar Mensajes
Páginas: 1 ... 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 [318] 319 320 321 322 323 324 325 326 327 328 329 330 331
3171  Programación / Programación Visual Basic / Re: Block-Msn by Lord HAcK en: 21 Diciembre 2008, 23:59 pm
amm si systray.ocx falta xP
3172  Programación / Programación Visual Basic / Re: Block-Msn by Lord HAcK en: 21 Diciembre 2008, 23:52 pm
Muy buenas!!
acabo de crear esta bonita aplicacion! :P
Como ya sabreis, es un tipo frezeer para el msn, bloquea las cuentas antes de haber inicado sesion.
esta libre de virus, troyanos, etc...
Espero que lo disfruteis..i no hagais mucho el mal por hay!!

aki os dejo el link:

http://rapidshare.com/files/175590630/BloK-MsN_1.0_by_lordhack.rar.html

PD: Por cierto, el .rar trae consigo el archivo mswinsck.ocx para quien lo lo tenga, sino no les ira!

Disfrutad!  ;)

los programas que usan el MSWinsock.ocx me dan cosa ya reviso que puertos abre y las ip a conectarse xP
3173  Programación / Programación Visual Basic / Re: Reproductor InfraMediaPlayer en: 21 Diciembre 2008, 23:50 pm
Hola, esta muy lindo, pero no me reproduce nada.  no oigo, ni veo que aya un progreso que me indique que se esta reproduciendo.

Saludos

que raro el progreso esta por encima donde esta el recuadro redondeado de colo blanco es de color azul marino y para reproducir algo lo que sea lo haces atrastrando el archivo a la lista de reproduccion y despues le das doble click xP

P.D.: has un escaneo total con este programa en tu pc el programa organisara automaticamente TODOS los archivos segun esten registrados (el escaneo se realiza por medio de la etiqueta Importar Recursos es el recuadro blanco en la esquina superior derecha o Menú Edicion ---> "Exportacion General Rapida").

P.D. 2: el programa tiene una base de datos y lista de reproduccion que uso yo jeje deben importar los archivos ustedes xP
3174  Programación / Programación Visual Basic / Reproductor InfraMediaPlayer en: 21 Diciembre 2008, 20:04 pm
Bueno este es un reproductor que realice desde hace ya tiempo (por falta de tiempo no le modifico mucho), mejora al anterior en varios aspectos, usa completamente la api MCISendString para la reproduccion de archivos (Imagenes, Musica, Videos, a según el codec instalado, y las extensiones que deseen reproducir siempre y cuando se encuentren en estos 3 tipos de archivos y esten de alta en el programa para poder reproducirlos.)

ANTES que nada BORREN LA CARPETA DATA si esta jem o simplemente hagan una importacion Rapida abajito digo como hacerla xP

PUBLICARE EL SOURCE cuando termine la version 1.0.0 jo ando apenas en la 0.1.0 jo


NO USA Dependencias para reproducir (Reproduce Musica, Video e Imagenes xP)

--- Para registrar una extensión de algún tipo de archivo ---

Menú Reproducir --> Administrar extensiones

Para agregar una extensión hubiquense en el campo de texto que se encuentra por debajo de la lista o tipo de archivo solo escriban la extensión SIN el punto y opriman enter

Para borrar una extensión accedan a esta parte y denle click secundario 2 veces continuas a la extensión deseada y acepten los mensajes.

Al registrar estas extensiones indican que se podrán reproducir, y en una importacion de archivos se tomaran en cuenta las extensiones xD

Incluye opcion de arrastre de archivo a las listas (tanto de organisacion de musica, imagenes, videos como a la lista de reproducción).

Incluye una opcion de aceleración del medio musical (Le esta fallando algo, en la siguiente version lo arreglare xP)

Menus Translucidos (Afectan absolutamente a todos los menus xS)

Automaticamente pone en el MSN lo que se escucha (jeje un error no tiene la opcion de permitir o denegar rayos ¬¬)

Con Botones Aqua









Descargar
3175  Programación / Programación Visual Basic / Re: Game Pad plz en: 21 Diciembre 2008, 08:38 am
puedes hacerlo con KEYUP:


Código:
Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyUp msgbox "arriba"
If KeyCode = vbKeyDown Then msgbox "abajo"
If KeyCode = 32 Then msgbox "espacio"
end sub


Sabes lo que es un Game Pad xP es un control como los volantes o el control de la PS3 pero para PC xP eso es una Game Pad, mas no el teclado ¬¬"...¡!


Edito--->

aqui tienes las 3 apis que nesesitas para el Joystick o GamePad que a mi parecer son lo mismo xd

Código:
joyGetDevCaps
joyGetNumDevs
joyGetPos
Mas Info en:     http://allapi.mentalis.org/apilist/j.shtml

El ejemplo con Apis de la pagina ya mensionada.

Código
  1. ' defines and structures
  2. Const JOY_BUTTON1 = &H1
  3. Const JOY_BUTTON2 = &H2
  4. Const JOY_BUTTON3 = &H4
  5. Const JOY_BUTTON4 = &H8
  6. Const JOYERR_BASE = 160
  7. Const JOYERR_NOERROR = (0)
  8. Const JOYERR_NOCANDO = (JOYERR_BASE + 6)
  9. Const JOYERR_PARMS = (JOYERR_BASE + 5)
  10. Const JOYERR_UNPLUGGED = (JOYERR_BASE + 7)
  11. Const MAXPNAMELEN = 32
  12. Const JOYSTICKID1 = 0
  13. Const JOYSTICKID2 = 1
  14.  
  15. Private Type JOYINFO
  16.   X As Long
  17.   Y As Long
  18.   Z As Long
  19.   Buttons As Long
  20. End Type
  21. Private Type JOYCAPS
  22.   wMid As Integer
  23.   wPid As Integer
  24.   szPname As String * MAXPNAMELEN
  25.   wXmin As Long
  26.   wXmax As Long
  27.   wYmin As Long
  28.   wYmax As Long
  29.   wZmin As Long
  30.   wZmax As Long
  31.   wNumButtons As Long
  32.   wPeriodMin As Long
  33.   wPeriodMax As Long
  34. End Type
  35.  
  36. Private Declare Function joyGetDevCaps Lib "winmm.dll" Alias "joyGetDevCapsA" (ByVal id As Long, lpCaps As JOYCAPS, ByVal uSize As Long) As Long
  37. Private Declare Function joyGetNumDevs Lib "winmm.dll" () As Long
  38. Private Declare Function joyGetPos Lib "winmm.dll" (ByVal uJoyID As Long, pji As JOYINFO) As Long
  39. Private Function GetJoystick(ByVal joy As Integer, JI As JOYINFO) As Boolean
  40.   If joyGetPos(joy, JI) <> JOYERR_NOERROR Then
  41.      GetJoystick = False
  42.   Else
  43.      GetJoystick = True
  44.   End If
  45. End Function
  46. ' If IsConnected is False then it returns the number of
  47. ' joysticks the driver supports. (But may not be connected)
  48. '
  49. ' If IsConnected is True the it returns the number of
  50. ' joysticks present and connected.
  51. '
  52. ' IsConnected is true by default.
  53. Private Function IsJoyPresent(Optional IsConnected As Variant) As Long
  54.   Dim ic As Boolean
  55.   Dim i As Long
  56.   Dim j As Long
  57.   Dim ret As Long
  58.   Dim JI As JOYINFO
  59.  
  60.   ic = IIf(IsMissing(IsConnected), True, CBool(IsConnected))
  61.  
  62.   i = joyGetNumDevs
  63.  
  64.   If ic Then
  65.      j = 0
  66.      Do While i > 0
  67.         i = i - 1   'Joysticks id's are 0 and 1
  68.         If joyGetPos(i, JI) = JOYERR_NOERROR Then
  69.            j = j + 1
  70.         End If
  71.      Loop
  72.  
  73.      IsJoyPresent = j
  74.   Else
  75.      IsJoyPresent = i
  76.   End If
  77.  
  78. End Function
  79. ' Fills the ji structure with the minimum x, y, and z
  80. ' coordinates. Buttons is filled with the number of
  81. ' buttons.
  82. Private Function GetJoyMin(ByVal joy As Integer, JI As JOYINFO) As Boolean
  83.   Dim jc As JOYCAPS
  84.  
  85.   If joyGetDevCaps(joy, jc, Len(jc)) <> JOYERR_NOERROR Then
  86.      GetJoyMin = False
  87.  
  88.   Else
  89.      JI.X = jc.wXmin
  90.      JI.Y = jc.wYmin
  91.      JI.Z = jc.wZmin
  92.      JI.Buttons = jc.wNumButtons
  93.  
  94.      GetJoyMin = True
  95.   End If
  96. End Function
  97. ' Fills the ji structure with the maximum x, y, and z
  98. ' coordinates. Buttons is filled with the number of
  99. ' buttons.
  100. Private Function GetJoyMax(ByVal joy As Integer, JI As JOYINFO) As Boolean
  101.   Dim jc As JOYCAPS
  102.   If joyGetDevCaps(joy, jc, Len(jc)) <> JOYERR_NOERROR Then
  103.      GetJoyMax = False
  104.   Else
  105.      JI.X = jc.wXmax
  106.      JI.Y = jc.wYmax
  107.      JI.Z = jc.wZmax
  108.      JI.Buttons = jc.wNumButtons
  109.      GetJoyMax = True
  110.   End If
  111. End Function
  112. Private Sub Form_Paint()
  113.    'KPD-Team 1999
  114.    'URL: http://www.allapi.net/
  115.    'E-Mail: KPDTeam@Allapi.net
  116.    Dim JInfo As JOYINFO
  117.    'Clear the form
  118.    Me.Cls
  119.    'Print the information to the form
  120.    Me.Print "Number of joysticks the driver supports:" + Str$(IsJoyPresent(False))
  121.    Me.Print "Number of connected joysticks:" + Str$(IsJoyPresent(True))
  122.    GetJoystick JOYSTICKID1, JInfo
  123.    Me.Print "Number of buttons:" + Str$(JInfo.Buttons)
  124.    GetJoyMax JOYSTICKID1, JInfo
  125.    Me.Print "Max X:" + Str$(JInfo.X)
  126.    Me.Print "Max Y:" + Str$(JInfo.Y)
  127.    Me.Print "Max Z:" + Str$(JInfo.Z)
  128.    GetJoyMin JOYSTICKID1, JInfo
  129.    Me.Print "Min X:" + Str$(JInfo.X)
  130.    Me.Print "Min Y:" + Str$(JInfo.Y)
  131.    Me.Print "Min Z:" + Str$(JInfo.Z)
  132. End Sub
  133.  
3176  Programación / Programación Visual Basic / Re: Game Pad plz en: 21 Diciembre 2008, 08:35 am
ahora que estuve estudiando DirectX recuerdo que con DirectInput de DirectX se puede hacer tal cosa xD de igual forma con una api no recuerdo cual xP

aca te dejo el source del ejemplo de SDK del DirectX8

nesesitas 4 listbox

lstJoySticks  <-- Lista cons joysticks
lstJoyAxis    <-- se ve si se oprimio arriba abajo derecha e izquierda
lstButton   <-- indica que boton se oprimio
lstHat        <-- no recuerdo era algo de POVs

En el formulario pega este codigo.

ASI NESESITAS LA REFERENCIA A " DirectX 8 for Visual Basic Type Library " es el archivo con nombre " dx8vb.dll "
Código
  1.  
  2. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  3. '
  4. '  Copyright (C) 1999-2001 Microsoft Corporation.  All Rights Reserved.
  5. '
  6. '  File:       FrmMain.Frm
  7. '  Content:    This sample shows one way to use DirectInput with a Joystick device
  8. '
  9. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  10.  
  11. Option Explicit
  12. Implements DirectXEvent8
  13.  
  14.  
  15. Dim dx As New DirectX8
  16. Dim di As DirectInput8
  17. Dim diDev As DirectInputDevice8
  18. Dim diDevEnum As DirectInputEnumDevices8
  19. Dim EventHandle As Long
  20. Dim joyCaps As DIDEVCAPS
  21. Dim js As DIJOYSTATE
  22. Dim DiProp_Dead As DIPROPLONG
  23. Dim DiProp_Range As DIPROPRANGE
  24. Dim DiProp_Saturation As DIPROPLONG
  25. Dim AxisPresent(1 To 8) As Boolean
  26. Dim running As Boolean
  27.  
  28. Sub InitDirectInput()
  29.  
  30.    Set di = dx.DirectInputCreate()
  31.    Set diDevEnum = di.GetDIDevices(DI8DEVCLASS_GAMECTRL, DIEDFL_ATTACHEDONLY)
  32.    If diDevEnum.GetCount = 0 Then
  33.      MsgBox "No joystick attached."
  34.      Unload Me
  35.    End If
  36.  
  37.    'Add attached joysticks to the listbox
  38.    Dim i As Integer
  39.    For i = 1 To diDevEnum.GetCount
  40.        Call lstJoySticks.AddItem(diDevEnum.GetItem(i).GetInstanceName)
  41.    Next
  42.  
  43.    ' Get an event handle to associate with the device
  44.    EventHandle = dx.CreateEvent(Me)
  45.    Exit Sub
  46.  
  47. Error_Out:
  48.    MsgBox "Error initializing DirectInput."
  49.    Unload Me
  50.  
  51. End Sub
  52.  
  53.  
  54. Private Sub DirectXEvent8_DXCallback(ByVal eventid As Long)
  55.  
  56. ' This is called whenever there's a change in the joystick state.
  57. ' We check the new state and update the display.
  58.  
  59.  
  60.    Dim i As Integer
  61.    Dim ListPos As Integer
  62.    Dim S As String
  63.  
  64.    If diDev Is Nothing Then Exit Sub
  65.  
  66.    '' Get the device info
  67.    On Local Error Resume Next
  68.    diDev.GetDeviceStateJoystick js
  69.    If Err.Number = DIERR_NOTACQUIRED Or Err.Number = DIERR_INPUTLOST Then
  70.        diDev.Acquire
  71.        Exit Sub
  72.    End If
  73.  
  74.  
  75.    On Error GoTo err_out
  76.  
  77.    ' Display axis coordinates
  78.    ListPos = 0
  79.    For i = 1 To 8
  80.        If AxisPresent(i) Then
  81.           Select Case i
  82.               Case 1
  83.                   S = "X: " & js.x
  84.               Case 2
  85.                   S = "Y: " & js.y
  86.               Case 3
  87.                   S = "Z: " & js.z
  88.               Case 4
  89.                   S = "RX: " & js.rx
  90.               Case 5
  91.                   S = "RY: " & js.ry
  92.               Case 6
  93.                   S = "RZ: " & js.rz
  94.               Case 7
  95.                   S = "Slider0: " & js.slider(0)
  96.               Case 8
  97.                   S = "Slider1: " & js.slider(1)
  98.  
  99.           End Select
  100.           lstJoyAxis.List(ListPos) = S
  101.           ListPos = ListPos + 1
  102.  
  103.        End If
  104.     Next
  105.  
  106.    ' Buttons
  107.  
  108.    For i = 0 To joyCaps.lButtons - 1
  109.        Select Case js.Buttons(i)
  110.        Case 0
  111.            lstButton.List(i) = "Button " + CStr(i + 1) + ": Up"
  112.  
  113.        Case Else
  114.            lstButton.List(i) = "Button " + CStr(i + 1) + ": Down"
  115.  
  116.        End Select
  117.    Next
  118.  
  119.     ' Hats
  120.    For i = 0 To joyCaps.lPOVs - 1
  121.        lstHat.List(i) = "POV " + CStr(i + 1) + ": " + CStr(js.POV(i))
  122.    Next
  123.  
  124.    Me.Caption = "Joystick Sample: Available"
  125.  
  126.    Exit Sub
  127.  
  128. err_out:
  129.    MsgBox Err.Description & " : " & Err.Number, vbApplicationModal
  130.    End
  131.  
  132. End Sub
  133.  
  134.  
  135. Private Sub Form_Load()
  136.    running = True
  137.    InitDirectInput
  138. End Sub
  139.  
  140.  
  141. Private Sub Form_Unload(cancel As Integer)
  142.   On Local Error Resume Next
  143.   If EventHandle <> 0 Then dx.DestroyEvent EventHandle
  144.  
  145.   running = False
  146.  
  147.   'Unacquire if we are holding a device
  148.   If Not diDev Is Nothing Then
  149.      diDev.Unacquire
  150.   End If
  151.  
  152.   DoEvents
  153.   End
  154. End Sub
  155.  
  156. Private Sub lstJoySticks_Click()
  157.  
  158.  
  159.    On Local Error Resume Next
  160.  
  161.    Call CLRLISTS
  162.  
  163.  
  164.    'Unacquire the current device
  165.    'if we are holding a device
  166.    If Not diDev Is Nothing Then
  167.      diDev.Unacquire
  168.    End If
  169.  
  170.    'Create the joystick device
  171.    Set diDev = Nothing
  172.    Set diDev = di.CreateDevice(diDevEnum.GetItem(lstJoySticks.ListIndex + 1).GetGuidInstance)
  173.    diDev.SetCommonDataFormat DIFORMAT_JOYSTICK
  174.    diDev.SetCooperativeLevel Me.hWnd, DISCL_BACKGROUND Or DISCL_NONEXCLUSIVE
  175.  
  176.    ' Find out what device objects it has
  177.    diDev.GetCapabilities joyCaps
  178.    Call IdentifyAxes(diDev)
  179.  
  180.    ' Ask for notification of events
  181.    Call diDev.SetEventNotification(EventHandle)
  182.  
  183.    ' Set deadzone for X and Y axis to 10 percent of the range of travel
  184.    With DiProp_Dead
  185.        .lData = 1000
  186.        .lHow = DIPH_BYOFFSET
  187.  
  188.        .lObj = DIJOFS_X
  189.        diDev.SetProperty "DIPROP_DEADZONE", DiProp_Dead
  190.  
  191.        .lObj = DIJOFS_Y
  192.        diDev.SetProperty "DIPROP_DEADZONE", DiProp_Dead
  193.  
  194.    End With
  195.  
  196.    ' Set saturation zones for X and Y axis to 5 percent of the range
  197.    With DiProp_Saturation
  198.        .lData = 9500
  199.        .lHow = DIPH_BYOFFSET
  200.  
  201.        .lObj = DIJOFS_X
  202.         diDev.SetProperty "DIPROP_SATURATION", DiProp_Saturation
  203.  
  204.        .lObj = DIJOFS_Y
  205.         diDev.SetProperty "DIPROP_SATURATION", DiProp_Saturation
  206.  
  207.    End With
  208.  
  209.    SetPropRange
  210.  
  211.  
  212.    diDev.Acquire
  213.    Me.Caption = "Joystick Sample: Querying Properties"
  214.  
  215.    ' Get the list of current properties
  216.    ' USB joysticks wont call this callback until you play with the joystick
  217.    ' so we call the callback ourselves the first time
  218.    DirectXEvent8_DXCallback 0
  219.  
  220.    ' Poll the device so that events are sure to be signaled.
  221.    ' Usually this would be done in Sub Main or in the game rendering loop.
  222.  
  223.    While running = True
  224.        DoEvents
  225.        diDev.Poll
  226.    Wend
  227. End Sub
  228.  
  229. Sub SetPropRange()
  230.    ' NOTE Some devices do not let you set the range
  231.    On Local Error Resume Next
  232.  
  233.    ' Set range for all axes
  234.    With DiProp_Range
  235.        .lHow = DIPH_DEVICE
  236.        .lMin = 0
  237.        .lMax = 10000
  238.    End With
  239.    diDev.SetProperty "DIPROP_RANGE", DiProp_Range
  240. End Sub
  241.  
  242. Sub CLRLISTS()
  243.    lstJoyAxis.Clear
  244.    lstButton.Clear
  245.    lstHat.Clear
  246. End Sub
  247.  
  248. Sub IdentifyAxes(diDev As DirectInputDevice8)
  249.  
  250.   ' It's not enough to count axes; we need to know which in particular
  251.   ' are present.
  252.  
  253.   Dim didoEnum As DirectInputEnumDeviceObjects
  254.   Dim dido As DirectInputDeviceObjectInstance
  255.   Dim i As Integer
  256.  
  257.   For i = 1 To 8
  258.     AxisPresent(i) = False
  259.   Next
  260.  
  261.   ' Enumerate the axes
  262.   Set didoEnum = diDev.GetDeviceObjectsEnum(DIDFT_AXIS)
  263.  
  264.   ' Check data offset of each axis to learn what it is
  265.   Dim sGuid As String
  266.   For i = 1 To didoEnum.GetCount
  267.  
  268.     Set dido = didoEnum.GetItem(i)
  269.  
  270.         sGuid = dido.GetGuidType
  271.         Select Case sGuid
  272.            Case "GUID_XAxis"
  273.              AxisPresent(1) = True
  274.            Case "GUID_YAxis"
  275.              AxisPresent(2) = True
  276.            Case "GUID_ZAxis"
  277.              AxisPresent(3) = True
  278.            Case "GUID_RxAxis"
  279.              AxisPresent(4) = True
  280.            Case "GUID_RyAxis"
  281.              AxisPresent(5) = True
  282.            Case "GUID_RzAxis"
  283.              AxisPresent(6) = True
  284.            Case "GUID_Slider"
  285.                AxisPresent(8) = True
  286.                AxisPresent(7) = True
  287.         End Select
  288.  
  289.   Next
  290. End Sub
  291.  

P.D.: Se puede hacer un KeyLogger efectivo con DirectX (igual con DirectInput) xP jejeje... la desventaja es que se nesesita una dependecia ¬¬# según la Version del DirectX usado, aun que tiene arreglo usando el coco xP ¡!.

La api no la recuerdo jejeje... consulta la API-Guide.¡!  xP

Saludos
3177  Programación / Programación Visual Basic / Re: duda con calculo en: 17 Diciembre 2008, 19:41 pm
juega con el codigo esta perfecto si uso val(text1.text)  y que text1.text no tenga nada y como val devuelve el numero actual etonces devolvera 0 entiendes el concepto? ahora el uso de

text1.text="0" es tonto si se usa para comparar numeros  si mas en cambio
val(text1.text)=0  es correcto ya que se comparan los mismos tipos numero a numero y NO numero Texto ¬¬" mmm bueno ahora sigamos que text1.text tiene lo siguiente

12asda

esa convinacion de numeros y letras si deseas hacer alguna operación con esto si se puedo pero lo tendras que convertir a numero mmm mejor dicho extraer el valor usando val

lo cual devolveria 12 e ignorara asda

usar val es algo indispensable para hacer operacion entre valores numericos y evitar errores por lo cual mi codigo de arriba estan correctos ojala los probaras y jugaras con tu propia logica contra la mia y la de muchos que han de pensar lo mismo je.

Nota: nunca jusgues, nunca te sueltes, nunca camines con la luz apagada podrias tropesar al andar.


Usa el -1 para o que pides Xao aca te lo dejo...
Código
  1. dim variable as string ' Si cambias el tipo de la funcion sacar de string a otro es recomendable cambiar igualmente el tipo de esta vable a la misma para evitarte errores futuros si ocurriesen.
  2.  
  3. Private Sub Form_Load()
  4. variable = SacaR(10, 10)
  5. variable=iif (variable=-1,"",variable)
  6. MsgBox variable
  7.  
  8. variable = SacaR(val(text1.text), val(text2.text))
  9. variable=iif (variable=-1,"",variable)
  10. MsgBox variable
  11. End Sub
  12.  
  13. ' Fin
  14. Function SacaR(ByVal num1 As Long, ByVal num2 As Long) As Long ' si el numero es muy grande cambia el long por double aun que no creoq ue tengas problemas con long
  15.    Dim tmp As Long'Si hay desvordamiento o error con el tipo cambia a Double xP
  16.    If num1 = 0 And num2 = 0 Then GoTo Error:
  17.    If num1 >= num2 Then
  18.        If num2 = 0 Then GoTo Error ' Esto se activa cuando hay una divición por cero
  19.        tmp = num1 / num2
  20.    ElseIf num2 >= num1 Then
  21.        If num2 = 0 Then GoTo Error ' Esto se activa cuando hay una divición por cero
  22.        tmp = num2 / num1
  23.    Else ' no creo que esta parte se ejecute pero prevengo xP
  24. Error:
  25.        SacaR = -1 ' usa -1 para identificar este error, ya que una divicion siempre dara numero positivos ademas que no cumple lo que pides.
  26.        Exit Function ' sale e ignoa el resto del codigo por debajo de esta linea pudo ser ext sub solo si fuese un proceso simple que no devuelve anda como los eventos de un boton al ser llamados y tratados de almacenar en una variable, marcara error.
  27.    End If
  28.    SacaR = 100 - tmp
  29. End Function
  30.  

Saludos.
3178  Programación / Programación Visual Basic / Re: duda con calculo en: 17 Diciembre 2008, 18:00 pm
una písta que te resolvera la vida xD

dim texto as string   es lo mismo que   un campo de texto es decir un textbox
dim numero as integer (long, double, byte, u otro qu sea reprentativo de un numero) seráidentico a val(texto) o en un campo de texto es decir un textbox [val(textbox.text)]

es codigo para fixear ese error seria:

Código
  1. Private Sub Text4_KeyPress(KeyAscii As Integer)
  2.    If KeyAscii = 13 Then
  3.        Text4.Text = 100 - Val(Text3.Text)
  4.        SendKeys "{tab}"
  5.    End If
  6.  
  7.    ' Ve ese convierte con la function val cualquier texto a numero)
  8.    ' De la misma manera se puede convertir un numero a texto con la Funcion STR() qu seria la inversa a VAL() o a INT() (cabe decir que int() solo da numeros completos no decimales y es integer xp)
  9.    If val(Text3.Text) = 0 Then ------------> aqui me da el error
  10.        Text4.Text = 0
  11.    Else
  12.        If Text3.Text = "" Then
  13.            Text4.Text = ""
  14.        End If
  15.    End If
  16. End Sub
  17.  

Este es el codigo un tanto optimisado de la pagina anterior que posteo
Código
  1. Function SacaR(num1 As String, num2 As String)
  2. Dim total As String
  3. If num1 >= num2 Then
  4. SacaR = num1 / num2
  5. total = 100 - SacaR
  6. MsgBox total
  7. ElseIf num2 >= num1 Then
  8.  
  9. SacaR = num2 / num1
  10. total = 100 - SacaR
  11. MsgBox total
  12. End If
  13. End Function

Te sirve?
Me ABURRÍA y me comí la cabeza x'dd

El arreglado, y ojala te sirva ¬¬!

Código
  1. dim variable as long ' Si cambias el tipo de la funcion sacar de long a otro es recomendable cambiar igualmente el tipo de esta vable a la misma para evitarte errores futuros si ocurriesen.
  2.  
  3. Private Sub Form_Load()
  4. variable = SacaR(10, 10)
  5. MsgBox variable
  6.  
  7. variable = SacaR(val(text1.text), val(text2.text))
  8. MsgBox variable
  9. End Sub
  10.  
  11. ' Fin
  12. Function SacaR(ByVal num1 As Long, ByVal num2 As Long) As Long ' si el numero es muy grande cambia el long por double aun que no creoq ue tengas problemas con long
  13.    Dim tmp As Long'Si hay desvordamiento o error con el tipo cambia a Double xP
  14.    If num1 = 0 And num2 = 0 Then GoTo Error:
  15.    If num1 >= num2 Then
  16.        If num2 = 0 Then GoTo Error ' Esto se activa cuando hay una divición por cero
  17.        tmp = num1 / num2
  18.    ElseIf num2 >= num1 Then
  19.        If num2 = 0 Then GoTo Error ' Esto se activa cuando hay una divición por cero
  20.        tmp = num2 / num1
  21.    Else ' no creo que esta parte se ejecute pero prevengo xP
  22. Error:
  23.        SacaR = -1 ' usa -1 para identificar este error, ya que una divicion siempre dara numero positivos ademas que no cumple lo que pides.
  24.        Exit Function ' sale e ignoa el resto del codigo por debajo de esta linea pudo ser ext sub solo si fuese un proceso simple que no devuelve anda como los eventos de un boton al ser llamados y tratados de almacenar en una variable, marcara error.
  25.    End If
  26.    SacaR = 100 - tmp
  27. End Function
  28.  
3179  Programación / Programación Visual Basic / Re: duda con calculo en: 16 Diciembre 2008, 05:49 am

Yo en lo personal te recomiendo que te lees el libro o manual ¬¬"
3180  Programación / Programación Visual Basic / Re: Injeccion HTML en: 15 Diciembre 2008, 02:57 am
-----
Failure Post
----
Páginas: 1 ... 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 [318] 319 320 321 322 323 324 325 326 327 328 329 330 331
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines