ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Standard functions / Windows functions / USB functions
  • Multiple calls to USBDetectRemovableStorage
  • Procedure local to the window
  • Limitations
  • Equivalence
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
USBDetectRemovableStorage (Function)
In french: USBDétecteStockageAmovible
Detects whether a removable storage unit (CD, USB key, USB camera, ...) was added or removed.
Example
IF USBDetectRemovableStorage("ProcédureUSB") = False THEN
	Error(ErrorInfo())
END
// ----------------------------------------
PROCEDURE ProcédureUSB(Lettre, Action)
IF Action = RemovableStorageInserted THEN
	Info(Lettre + ": Inséré")
ELSE
	Info(Lettre + ": Ejecté")
END
Syntax
<Result> = USBDetectRemovableStorage(<WLanguage procedure>)
<Result>: Boolean
  • True if the detection was performed.
  • False otherwise.
<WLanguage procedure>: Procedure name
  • Name of WLanguage procedure that will be run during the detection,
  • Empty string ("") to disable the detection.
This procedure is called whenever a storage unit is inserted or ejected.
This procedure has the following format:
PROCEDURE <WLanguage procedure>(<Drive letter>, <Type of action>)
<Drive letter> is a string used to find out the letter of the drive associated with the storage unit.
Note: If the storage device causes several drive letters to appear, these will be separated by tabs (<Lettre lecteur 1> + TAB + <Lettre lecteur 2> + ... + TAB + <Lettre lecteur N>).
The <Type of action> parameter is an integer constant used to find out whether the device was inserted or ejected. This parameter can take one of the following values:
RemovableStorageInsertedA removable storage unit was inserted.
RemovableStorageRemovedA removable storage unit was ejected.
Remarks

Multiple calls to USBDetectRemovableStorage

If this function is run several times with different procedures passed as parameters, the last procedure used will replace all previously called procedures: the first procedures will no longer be recalled.

Procedure local to the window

If the WLanguage procedure is local to a window, the detection will stop when the window is closed. We recommend that you use a global procedure.

Limitations

USBDetectRemovableStorage must not be run from a secondary thread.

Equivalence

USBDetectRemovableStorage and fDetectRemovableStorage are equivalent.
Component: wd300std.dll
Minimum version required
  • Version 10
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 03/28/2025

Send a report | Local help