Jump to content
YOUR-AD-HERE
HOSTING
TOOLS

Locked Rutinas Interesantes [VB6]


Anto

Recommended Posts

RUTINAS INTERESANTES !

Como metodo de comodidad quiero dejar este post para poner funciones del VB6 para implementar a tus programas...

 

( En este hilo no se aceptaran comentarios aparte de funciones si tienes que postear aca como funciones, snippets, modulos y cls todo sirve )

Edited by Anto
Link to comment
Share on other sites

Re: Rutinas Interesantes [VB6]

 

Ingresar solo numero en un Textbox:

 

If ((KeyAscii < 48 Or KeyAscii > 57) And (KeyAscii < 44 Or KeyAscii > 44)) Then

If (KeyAscii <> 8) Then KeyAscii = 0

End If

Link to comment
Share on other sites

Re: Rutinas Interesantes [VB6]

 

Ejecutar programa una sola vez:

 

Private Sub Form_Load()

Dim Ya_Existe As Integer

Ya_Existe = App.PrevInstance

If Ya_Existe <> 0 Then

MsgBox "El Programa ya se esta ejecutando", 0 + 48, "News"

End

End If

End Sub

Link to comment
Share on other sites

Re: Rutinas Interesantes [VB6]

 

Saber desde que directorio se ejecuta mi aplicación:

 

Private Sub Form_Load()

Dim Directorio as String

ChDir App.Path

ChDrive App.Path

Directorio = App.Path

If Len(Directorio) > 3 Then

Directorio = Directorio & "\"

End If

End Sub

Link to comment
Share on other sites

Re: Rutinas Interesantes [VB6]

 

Apagar el equipo, reiniciar Windows, reiniciar el Sistema:

Private Declare Function ExitWindowsEx& Lib "user32" (ByVal

uFlags&, ByVal dwReserved&)

Private Sub Command1_Click()

Dim i as integer

i = ExitWindowsEx(1, 0&) 'Apaga el equipo

End Sub

Private Sub Command2_Click()

Dim i as integer

i = ExitWindowsEx(0, 0&) 'Reinicia Windows con nuevo usuario

End Sub

Private Sub Command3_Click()

Dim i as integer

i = ExitWindowsEx(2, 0&) 'Reinicia el Sistema

End Sub

Link to comment
Share on other sites

Re: Rutinas Interesantes [VB6]

 

Vaciar Papelera de Reciclaje:

 

Private Declare Function SHEmptyRecycleBin Lib "shell32.dll" Alias "SHEmptyRecycleBinA" (ByVal hwnd As Long, ByVal pszRootPath As String, ByVal dwFlags As Long) As Long

 

Private Const SHERB_NORMAL = &H0 'Normal execution

 

Private Const SHERB_NOCONFIRMATION = &H1 'execute without confirmation

 

Private Const SHERB_NOPROGRESSUI = &H2 'execute without progress window

 

Private Const SHERB_NOSOUND = &H4 'execute without sound

 

Private Const SHERB_NOALL = (SHERB_NOCONFIRMATION And SHERB_NOPROGRESSUI And SHERB_NOSOUND)

Dim RetVal As Long

 

Private Sub EmpRecBin()

RetVal = SHEmptyRecycleBin(0&, vbNullString, SHERB_NORMAL)

End Sub

 

En un botton:

 

Private Sub Command1_Click()

Call EmpRecBin

end sub

Link to comment
Share on other sites

Re: Rutinas Interesantes [VB6]

 

Reproducir Mp3, Wav :

 

Declare Function mciExecute Lib "winmm.dll" (ByVal lpstrCommand As String) As Long

 

Para reproducirlo:

 

iRESULT = mciExecute("Play C:\Gritos.mp3")

 

Para detener la reproducción:

 

iRESULT = mciExecute("stop C:\Gritos.mp3")
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.