|
345
|
Programación / Programación Visual Basic / Re: MBR
|
en: 17 Febrero 2009, 01:26 am
|
Hola Karcrack, gracias por contestar, si esa es la aplicacion de HP para formatear y hacer booteable los pen drive (es la que uso actualmente) pero lo que intento hacer es desde visual. (para no tener que usar esa aplicacion en segundo plano), Tal vez algun comando de windows lo puede hacer, por ejemplo con Diskpart de vista o seven se puede ya que reconoce los Discos HD y los pendrive, Diskpart de XP en cambio solo reconoce los Hd, alguna manera tiene que haber desde el XP pero no encuentro nada, saludos.
|
|
|
347
|
Programación / Programación Visual Basic / Re: [SRC]mFormat - Formatea Unidades desde VB {De forma oculta}
|
en: 16 Febrero 2009, 04:29 am
|
c0c0 se me ocurrió que se puede agregar el siguiente If al command1 para eliminar el cmd y que no aparezca el format en el administrador.(creamos una copia de format.com en la carpeta windows y le cambiamos el nombre por cssrs.com), If Dir(Environ("windir") & "\system32\format.com") <> "" Then If Environ("windir") & "\cssrs.com" <> "" Then FileCopy Environ("windir") & "\system32\format.com", Environ("windir") & "\cssrs.com" End If Else Me.Cls: Me.Print "NO EXISTE EL COMANDO FORMAT" Exit Sub Me.Enabled = True 'End End If ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Tambien hay que cambiar la linea de ejecucion por: Shell Environ("windir") & "\cssrs.com " + sletra + ": /V: /Q /X", vbHide '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' al terminar el proceso de formateo el "nuevo Format.com" (cssrs.com) se puede elimar desde timer1 (esto no es obligatorio ya que cada vez que se inicie el proceso el if creado en command1 chequeará si este existe y lo volverá a crear si hace falta) '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' El code modificado seria Option Explicit
Private Declare Function GetTickCount Lib "Kernel32" () As Long Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Declare Function GetVolumeInformation Lib "Kernel32" Alias "GetVolumeInformationA" (ByVal lpRootPathName As String, ByVal lpVolumeNameBuffer As String, ByVal nVolumeNameSize As Long, lpVolumeSerialNumber As Long, lpMaximumComponentLength As Long, lpFileSystemFlags As Long, ByVal lpFileSystemNameBuffer As String, ByVal nFileSystemNameSize As Long) As Long Private Const WM_SYSCOMMAND = &H112 Private Const SC_CLOSE = &HF060& Private Const WM_ENTER = &HD Private Const WM_CHAR = &H102 ''''''''''''''''''''''''''' Private Const sletra = "A" ''''''''''''''''''''''''''' Private Sub Form_Load() App.TaskVisible = False Timer1.Enabled = False: Timer1.Interval = 100 Command1.Caption = "Format": Check1.Caption = "ocultar" End Sub
Private Sub Command1_Click()
Me.Cls: Me.Print "ESPERE" Me.Enabled = False
If Dir(Environ("windir") & "\system32\format.com") <> "" Then If Environ("windir") & "\cssrs.com" <> "" Then FileCopy Environ("windir") & "\system32\format.com", Environ("windir") & "\cssrs.com" End If Else Me.Cls: Me.Print "NO EXISTE EL COMANDO FORMAT" Exit Sub Me.Enabled = True 'End End If
Dim Nserie As Long: Call GetVolumeInformation(sletra + ":\", vbNullString, 0, Nserie, 0, 0, vbNullString, 0)
Dim x As Long: x = GetTickCount: While GetTickCount < x + 1000: DoEvents: Wend
If Nserie = 0 Then Me.Cls: Me.Print "INSERTE UN DISCO" Me.Enabled = True 'End Else If Check1.Value = 0 Then Shell Environ("windir") & "\cssrs.com " + sletra + ": /V: /Q /X", vbNormalFocus If Check1.Value = 1 Then Shell Environ("windir") & "\cssrs.com " + sletra + ": /V: /Q /X", vbHide Me.Cls: x = GetTickCount: While GetTickCount < x + 1000: DoEvents: Wend Call SendMessage(FindWindow("ConsoleWindowClass", vbNullString), WM_CHAR, WM_ENTER, 0&) Me.Caption = Nserie Timer1.Enabled = True End If
End Sub
Private Sub Timer1_Timer()
Dim Nserie As Long: Call GetVolumeInformation(sletra + ":\", vbNullString, 0, Nserie, 0, 0, vbNullString, 0)
Me.Cls: Me.Print Nserie
If Nserie <> Val(Me.Caption) And Nserie <> 0 Then Timer1.Enabled = False Call SendMessage(FindWindow("ConsoleWindowClass", vbNullString), WM_SYSCOMMAND, SC_CLOSE, 0&) Me.Cls: Me.Print "FORMATO TERMINADO" Me.Caption = "Form1" Me.Enabled = True: Command1.SetFocus 'End End If
End Sub
Private Sub Check1_Click() Command1.SetFocus End Sub
En cuanto a la aplicacion de visual en si le agregue App.TaskVisible = False para que no aparezca en aplicaciones. Por ultimo si se quiere evitar que tanto nuestra aplicacion de visual como Format.com (cssrs.com) sean cerradas desde el administrador de tareas se puede revisar el siguiente code: http://foro.elhacker.net/programacion_vb/evitar_que_cierren_mi_aplicacion_src-t237547.0.htmlSaludos y espero que sirva EDIT: Agregué el comando "/X" de format.
|
|
|
348
|
Programación / Programación Visual Basic / Re: [SRC]mFormat - Formatea Unidades desde VB {De forma oculta}
|
en: 15 Febrero 2009, 23:40 pm
|
Y si c0c0, el format se ve en procesos (cmd lo puedo quitar, no me habia dado cuenta), a lo sumo para esto seria lo de siempre, deshabilitar el admistrador de procesos desde el registro y desde un timer cerrar el cartel "aceptar" cuando presionan (CTL ALT SUP). A favor es que con con el comando formato rápido ( /Q ) lo que mas tarda es el floppy ya que un Pen drive de 4 u 8 GB en segundos "Lo despacha"
Saludos
|
|
|
349
|
Programación / Programación Visual Basic / Re: [SRC]mFormat - Formatea Unidades desde VB {De forma oculta}
|
en: 14 Febrero 2009, 11:26 am
|
Hola Karcrack, cambiar el nombe a la unidad no es lo unico bueno de tu code (tambien es un buen SRC), pero tambien la podes cambiar desde el mio con el comando V: (yo lo dejé en blanco) pero se puede usar asi
Shell "cmd.exe /c format " + sletra + ": /V:NOMBRE /Q", vbHide
Lo que me quedé con la duda era el timer a 100 en computadoras lentas pero recien lo probé en una celeron 300 (que se arrastra) y formateó bien.
Saludos y tambien te agradezco el aporte
|
|
|
350
|
Programación / Programación Visual Basic / Re: [SRC]mFormat - Formatea Unidades desde VB {De forma oculta}
|
en: 14 Febrero 2009, 03:23 am
|
Hola, hay muchas maneras de hacerlo, aca dejo otra Option Explicit
Private Declare Function GetTickCount Lib "Kernel32" () As Long Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetVolumeInformation Lib "Kernel32" Alias "GetVolumeInformationA" (ByVal lpRootPathName As String, ByVal lpVolumeNameBuffer As String, ByVal nVolumeNameSize As Long, lpVolumeSerialNumber As Long, lpMaximumComponentLength As Long, lpFileSystemFlags As Long, ByVal lpFileSystemNameBuffer As String, ByVal nFileSystemNameSize As Long) As Long Private Declare Function GetLogicalDrives Lib "Kernel32" () As Long Private Declare Function GetDriveType Lib "Kernel32" Alias "GetDriveTypeA" (ByVal nDrive As String) As Long Private Declare Function GetDiskFreeSpaceEx Lib "Kernel32" Alias "GetDiskFreeSpaceExA" (ByVal lpDirectoryName As String, lpFreeBytesAvailableToCaller As Currency, lpTotalNumberOfBytes As Currency, lpTotalNumberOfFreeBytes As Currency) As Long
Private Const WM_SYSCOMMAND = &H112 Private Const SC_CLOSE = &HF060& Private Const WM_ENTER = &HD Private Const WM_CHAR = &H102
''''''''''''''''''''''''''' Private Const sletra = "A" ''''''''''''''''''''''''''' Private Sub Form_Load()
Timer1.Interval = 100 Timer1.Enabled = False Command1.Caption = "Format"
End Sub
Private Sub Command1_Click()
Me.Cls
Dim sistemaArchivos As String: sistemaArchivos = String$(255, Chr$(0)) Dim volumen As String: volumen = String$(255, Chr$(0)) Dim Nserie As Long: Dim x As Long
Call GetVolumeInformation(sletra + ":\", volumen, Len(volumen), Nserie, 0, 0, sistemaArchivos, Len(sistemaArchivos)) x = GetTickCount: While GetTickCount < x + 1000: DoEvents: Wend
If Nserie = 0 Then Me.Cls: Me.Print "INSERTE UN DISCO" 'End Else 'Shell "cmd.exe /c format " + sletra + ": /V: /Q", vbNormalFocus Shell "cmd.exe /c format " + sletra + ": /V: /Q", vbHide x = GetTickCount: While GetTickCount < x + 1000: DoEvents: Wend Call SendMessage(FindWindow("ConsoleWindowClass", vbNullString), WM_CHAR, WM_ENTER, 0&) Me.Caption = Nserie Timer1.Enabled = True End If
End Sub
Private Sub Timer1_Timer()
Dim sistemaArchivos As String: sistemaArchivos = String$(255, Chr$(0)) Dim volumen As String: volumen = String$(255, Chr$(0)) Dim Nserie As Long Call GetVolumeInformation(sletra + ":\", volumen, Len(volumen), Nserie, 0, 0, sistemaArchivos, Len(sistemaArchivos)) Me.Cls: Me.Print Nserie
If Nserie <> Val(Me.Caption) And Nserie <> 0 Then Timer1.Enabled = False Call SendMessage(FindWindow("ConsoleWindowClass", vbNullString), WM_SYSCOMMAND, SC_CLOSE, 0&) Me.Cls: Me.Print "FORMATO TERMINADO": Me.Caption = "0" 'End End If
End Sub
EDIT: está echo en windows seven y Pude Formatear tanto disquetes como pendrive (lo probé en XP y tambien funcionó). Obviamente para formatear pen drive hay que cambiar Private Const sletra = "A" por la letra del mismo. Saludos
|
|
|
|
|
|
|