Newsgroup: it.comp.lang.visual-basic
Titolo: [?] Accedere al form di formattazione

Ciao a tutti!
Come da soggetto, avrei la necessita' di lanciare, da VB6, il form di
formattazione di una unita', passandogli anche il nome del drive su cui
effettuare la formattazione stessa. Pensavo vi si potesse accedere mediante
qualche metodo dell'oggetto FileSystemObject, ma sbagliavo. Presumo si
tratti di una funzione della libreria shell32, ma non so quale sia. Potreste
darmi qualche suggerimento?
Grazie anticipatamente
--
Massimo Fauro

 wrote in message
news:3b305b06$1...@news.bluewin.ch...

HOWTO: Call SHFormatDrive in Windows 95 and Windows NT
Q173688
----------------------------------------------------------------------------
----
The information in this article applies to:
Microsoft Win32 Application Programming Interface (API)
----------------------------------------------------------------------------
----
SUMMARY
Although most Win32 applications do not need to be able to format disks,
some do. Windows 95 and Windows NT provide an API function called
SHFormatDrive, which presents the same dialog box as the Windows 95 and
Windows NT shells, formats the specified diskette. This article describes
how to call SHFormatDrive.
[...]
Additional query words: format disk diskette initialize create critical
error
Keywords : kbAPI kbFileIO kbKernBase kbLib kbNTOS400 kbWinOS2000 kbGrpUser
kbWinOS95 kbWinOS98 kbshell kbGrpShell
Issue type : kbhowto
Technology : kbvcSearch
HTH,
*

 wrote in message
news:3b305b06$1...@news.bluewin.ch...

Inoltre, se vuoi scrivere un po' di C:
Level 0 Lock
The level 0 lock cannot be obtained on volumes that have any open files or
handles. This restriction includes handles returned by the Windows
FindFirstFile and FindFirstChangeNotification functions. Because the system
always has open files, an application cannot take a level 0 lock on the
drive that contains the Windows 95/98/Me system files. The locking hierarchy
can be used on volumes with open files and handles. If the system fails a
level 0 lock request because of open files, an application can obtain a list
of all the open files on the volume by calling Enumerate Open Files
(Interrupt 21h Function 440Dh Minor Code 6Dh).
Before returning from the call to lock the volume, Windows 95/98/Me flushes
to disk all data from the file system cache. To ensure that the disk and
file system remain in a consistent state, the system puts the cache into
write-through mode so that it can immediately commit to disk all data from
file write operations. If an application has obtained a lock on a child
volume, the system does not automatically flush the file system cache after
a write operation to the parent volume. To ensure that the cache is flushed
when opening files with Open or Create File (Interrupt 21h Function 716Ch),
an application should specify the OPEN_FLAGS_NO_BUFFERING (0100h) value. If
a file has not been opened with OPEN_FLAGS_NO_BUFFERING or Absolute Disk
Write (Interrupt 26h) has been used to write to the parent volume, an
application should call Reset Drive (Interrupt 21h Function 710Dh) to flush
the cache.
After a process obtains a level 0 lock, the system only allows the lock
owner to have access to the volume. The system fails all read operations,
write operations, and new file mappings by other processes until the lock
owner releases the lock. An application should use a level 0 lock whenever
possible, because it guarantees that no other process can access the locked
volume.
An application that formats volumes must obtain a more restrictive mode of
the level 0 lock. To format a volume, the application should follow these
steps:
Call the lock volume function to obtain a level 0 lock.
Do any needed file system I/O that uses the Interrupt 21h file handle I/O
functions while in the level 0 lock.
Call the lock volume function a second time to obtain the more restrictive
level 0 lock for formatting. When calling the lock volume function the
second time, an application should specify 0 as the lock level and specify 4
in the permissions. The application, however, must already own the level 0
lock to obtain this lock.
Format the disk using the Interrupt 21h IOCTL functions (such as
Read/Write/Format/Verify Track on Logical Drive or Get/Set Device
Parameters). Interrupt 13h will work too, but it is not the preferred method
for performance reasons. The system allows direct disk I/O, but it fails all
other file system I/O that uses the Interrupt 21h file handle I/O functions
while the restrictive level 0 lock is in effect.
Release the level 0 lock for formatting. An application is still in a level
0 lock at this point. Before the application releases this lock, the disk
must be in a state that would be recognizable as normal FAT media.
Otherwise, the functions mentioned in step 6 will not work.
Resume normal file system I/O using the Interrupt 21h file handle I/O
functions.
Release the level 0 lock.

scusa, da VB quale funzione devo richiamare per utilizzare quegli interrupt
di cui hai parlato?
MarioH

>> Inoltre, se vuoi scrivere un po' di C:
Claro? :)
Ciaotutti,
Asterix