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

 

 


Tema destacado: ¿Eres nuevo? ¿Tienes dudas acerca del funcionamiento de la comunidad? Lee las Reglas Generales


  Mostrar Mensajes
Páginas: [1]
1  Programación / Programación Visual Basic / Re: Problemas con apagado en: 25 Agosto 2006, 15:37 pm
El problema esta por que pasa de las 12 de la noche.

Entonces, la comparacion no la hace bien, tendrias que hacerlo comparando como si fueran dos dias, uno de 23 hasta las 12 de la noxe y otro desde las doce de la noche asta las 8 de la mañana

Otra cosa, es que conviertes a String, y comparas cadenas, eso tp lo hace bien, por que tienes que comparar tiempo y no cadena.

Para indicar poner en visual hora y dia se pone con # y compara directamente. Este codigo me ha funcionado.

  If (Time >= #11:00:00 PM# And Time <= #11:59:59 PM#) _
    Or (Time >= #12:00:00 AM# And Time <= #8:00:00 AM#) Then
    shell ("ShutDown -s")
  End If

Yo que tu pondria un mensaje para no proba apagando el pc.

y cuando veas que funcion ya pones el shell.

  If (Time >= #11:00:00 PM# And Time <= #11:59:59 PM#) _
    Or (Time >= #12:00:00 AM# And Time <= #8:00:00 AM#) Then
   MsgBox('Apagar')
   ' shell ("ShutDown -s")
  End If

Saludos
2  Programación / Programación Visual Basic / Re: CommonDialog en: 30 Diciembre 2005, 09:37 am
Crea un Form1 y pon un boton llamado Command1

Este es el codido:

Código:
Option Explicit

Private Type BROWSEINFO
     hOwner As Long
     pidlRoot As Long
     pszDisplayName As String
     lpszTitle As String
     ulFlags As Long
     lpfn As Long
     lParam As Long
     iImage As Long
End Type

Const BIF_RETURNONLYFSDIRS = &H1

Private Declare Function SHBrowseForFolder Lib "shell32.dll" Alias "SHBrowseForFolderA" (lpBrowseInfo As BROWSEINFO) As Long
Private Declare Function SHGetPathFromIDList Lib "shell32.dll" Alias "SHGetPathFromIDListA" (ByVal pidl As Long, ByVal pszPath As String) As Long


Function CambioDestino(ByVal hWnd As Long, ByVal Titulo As String) As String
Dim Destino As String
Dim Dialog As BROWSEINFO
Dim Result As Long, Path As String, Longitud As Long
Destino = ""

Dialog.hOwner = hWnd
Dialog.lpszTitle = Titulo
Dialog.ulFlags = BIF_RETURNONLYFSDIRS
Result = SHBrowseForFolder(Dialog)

Path = Space(512)
Result = SHGetPathFromIDList(ByVal Result, ByVal Path)

'Resolvemos la ruta...
Longitud = InStr(Path, Chr$(0))
Destino = Left$(Path, Longitud - 1)
'Aseguramos la barra '\' tanto por unidad C:\ que por
'subdirectorios C:\Ruta\
If Right$(Destino, 1) <> "\" And Len(Destino) > 2 Then ' len(Destino)>2 es C:\
   Destino = Destino + "\"
End If
If Destino = "" Then Destino = "Cancelar..." 'Si cancela o pulsa la aspa 'X'
CambioDestino = Destino

End Function



Private Sub Command1_Click()
  Dim Destino As String
  Destino = CambioDestino(Me.hWnd, "Seleccione el directorio...")
  If Destino <> "Cancelar..." Then MsgBox Destino
End Sub


Saludos
Páginas: [1]
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines