home *** CD-ROM | disk | FTP | other *** search
/ CD Shareware Magazine 1999 April / CD_Shareware_Magazine_31.iso / Free / Prg / API24.exe / Form1.frm (.txt) next >
Encoding:
Visual Basic Form  |  1999-01-08  |  1.3 KB  |  42 lines

  1. VERSION 5.00
  2. Begin VB.Form Form1 
  3.    Caption         =   "Form1"
  4.    ClientHeight    =   2940
  5.    ClientLeft      =   60
  6.    ClientTop       =   345
  7.    ClientWidth     =   4380
  8.    LinkTopic       =   "Form1"
  9.    ScaleHeight     =   2940
  10.    ScaleWidth      =   4380
  11.    StartUpPosition =   3  'Windows Default
  12.    Begin VB.CommandButton Command1 
  13.       Caption         =   "Formatear Unidad A"
  14.       Height          =   1095
  15.       Left            =   480
  16.       TabIndex        =   0
  17.       Top             =   960
  18.       Width           =   3255
  19.    End
  20. Attribute VB_Name = "Form1"
  21. Attribute VB_GlobalNameSpace = False
  22. Attribute VB_Creatable = False
  23. Attribute VB_PredeclaredId = True
  24. Attribute VB_Exposed = False
  25. Option Explicit
  26. Private Declare Function SHFormatDrive Lib "shell32" (ByVal hwnd As Long, ByVal Drive As Long, ByVal fmtID As Long, ByVal options As Long) As Long
  27. Private Sub Command1_Click()
  28.     Formatear "A"
  29. End Sub
  30. Public Function Formatear(Raiz As String, Optional VentanaMadre As Long) As Boolean
  31.     Dim DriveNumber As Long
  32.     DriveNumber = (Asc(Raiz) - 65) ' Cambiar la letra a n
  33. mero: A=0 y an
  34. logamente
  35.     Formatear = SHFormatDrive(VentanaMadre, DriveNumber, vbNull, vbNull)
  36.     'Esta 
  37. ltima l
  38. nea tambi
  39. n puede ser
  40.     'Formatear = SHFormatDrive(VentanaMadre, DriveNumber, 0&, 0&)
  41. End Function
  42.