Detects whether a removable storage unit (CD, USB key, USB camera, ...) was added or removed.
IF fDetectRemovableStorage("MyProcedure") = False THEN
PROCÉDURE Myprocedure(Letter, Action)
IF Action = RemovableStorageInserted THEN
Info(Letter + ": Inserted")
Info(Letter + ": Ejected")
<Result> = fDetectRemovableStorage(<Procedure Name>)
- True if the detection was performed.
- False otherwise.
<Procedure Name>: Character string
- Name of WLanguage procedure that will be run during the detection. This procedure is called whenever a storage unit is inserted or ejected.
- Empty string ("") to disable the detection.
This procedure has the following format:
PROCEDURE <Procedure Name>(<Drive Letter>, <Type of Action>)
<Drive Letter> is a string used to find out the letter of the drive associated with the storage unit.
<Type of Action> is an integer used to find out whether the device was inserted or ejected. This parameter can take one of the following values:
|RemovableStorageInserted||A removable storage unit was inserted.|
|RemovableStorageRemoved||A removable storage unit was ejected.|
Multiple calls to fDetectRemovableStorage
If this function is run several times with different procedures passed in parameter, the last procedure used will replace all the procedures previously called: the first procedures will no longer be called.
Procedure local to the window
If <Procedure Name> is a procedure local to a window, the detection will stop when the window is closed. We recommend that you use a global procedure.
fDetectRemovableStorage must not be run from a secondary thread.