Unless mentioned otherwise all functions work both under WinNT and Win95.
Version 0.10.1
Copy CopyConfirm CopyConfirmEach CopyEx
Move MoveConfirm MoveConfirmEach MoveEx
MoveFile MoveFileEx CopyFile MoveAtReboot
Recycle RecycleConfirm RecycleConfirmEach RecycleEx
Delete DeleteConfirm DeleteConfirmEach DeleteEx DeleteAtReboot
Compress Uncompress Compressed SetCompression GetCompression CompressDir UncompressDir
AddToRecentDocs EmptyRecentDocs
WriteToINI WriteToWININI ReadINI ReadWININI
DeleteFromINI DeleteFromWININI
OpenDialog SaveAsDialog BrowseForFolder
Same as: $handle = $Win32::FileOp::DesktopHandle
Used to get desktop window handle when confirmation is used. The value of the handle can be gotten from $Win32::FileOp::DesktopHandle.
Returns the Desktop Window handle.
Same as: $handle = $Win32::FileOp::WindowHandle
Used to get the console window handle when confirmation is used. The value of the handle can be gotten from $Win32::FileOp::WindowHandle.
Returns the Console Window handle.
Copies the specified files. Doesn't show any confirmation nor progress dialogs.
It may show an error message dialog, because I had to omit FOF_NOERRORUI from its call to allow for autocreating directories.
You should end the directory names by backslash so that they are not mistaken for filenames. It is not necessary if the directory already exists or if you use Copy \@filenames => $dirname.
Returns true if successful.
Copies the specified files. In case of a collision, shows a confirmation dialog. Shows progress dialogs.
Returns true if successful.
Copies the specified files. See below for the available options ( FOF_ constants).
Returns true if successful.
It may show an error message dialog, because I had to omit FOF_NOERRORUI from its call to allow for autocreating directories.
This function moves the file during the next start of the system.
Move files. This function uses API function MoveFileEx as well as MoveAtReboot. It may be a little quicker than Move , but it doesn't understand wildcards and the $DestFileName may not be a directory.
This is a simple wrapper around the API function MoveFileEx, it calls the function for every pair of files with the $options you specify. See below for the available options ( FOF_ ... constants).
Copy a file somewhere. This function is not able to copy directories!
Send the files into the recycle bin. You will not get any confirmation dialogs.
Returns true if successful.
Send the files into the recycle bin. You will get a confirmation dialog if you have ``Display delete confirmation dialog'' turned on in your recycle bin. You will confirm the deletion of all the files at once.
Returns true if successful. Please remember that this function is successful even if the user chose [No] on the confirmation dialog!
Send the files into the recycle bin. You will get a separate confirmation dialog for each file if you have ``Display delete confirmation dialog'' turned on in your recycle bin. You will confirm the deletion of all the files at once.
Returns the number of files that were successfully deleted.
Send the files into the recycle bin. You may specify the options for deleting, see below. You may get a confirmation dialog if you have "Display delete confirmation dialog" turned on in your recycle bin, if so, you will confirm the deletion of all the files at once.
Returns true if successful. Please remember that this function is successful even if the user chose [No] on the confirmation dialog!
The $options may be constructed from FOF_ ... constants.
Deletes the files. You will not get any confirmation dialogs.
Returns true if successful.
Deletes the the files. You will get a confirmation dialog to confirm the deletion of all the files at once.
Returns true if successful. Please remember that this function is successful even if the user selected [No] on the confirmation dialog!
Deletes the files. You will get a separate confirmation dialog for each file.
Returns the number of files that were successfully deleted.
Deletes the files. You may specify the options for deleting, see below. You may get a confirmation dialog if you have "Display delete confirmation dialog" turned on in your recycle bin.
Returns true if successful. Please remember that this function is successful even if the user selected [No] on the confirmation dialog!
This function moves the file during the next start of the system.
Copy the newer or updated files from $SourceDir to $DestDir. Processes subdirectories! The &callback function is called for each file to be copied. The parameters it gets are exactly the same as the callback function in File::Find. That is $_, $File::Find::dir and $File::Find::name.
If this function returns a false value, the file is skipped.
Copy the files from $SourceDir not present in $DestDir. Processes subdirectories! The &callback works the same as in UpdateDir.
Compresses the file(s) or directories using the transparent WinNT compression (The same as checking the ``Compressed'' checkbox in Explorer properties fo the file).
It doesn't compress all files and subdirectories in a directory you specify. Use ComressDir for that. Compress($directory) only sets the compression flag for the directory so that the new files are compressed by default.
WinNT only!
Uncompresses the file(s) using the transparent WinNT compression (The same as unchecking the ``Compressed'' checkbox in Explorer properties fo the file).
WinNT only!
Checks the compression status for a file.
Sets the compression status for file(s). The $value should be either 1 or 0.
Checks the compression status for a file.
Recursively descends the directory(ies) specified and compresses all files and directories within. If you specify the \&callback, the specified function gets executed for each of the files and directories. If the callback returns false, no compression is done on the file/directory.
The parameters the callback gets are exactly the same as the callback function in File::Find. That is $_, $File::Find::dir and $File::Find::name.
The counterpart of CompressDir.
Add a shortcut(s) to the file(s) into the Recent Documents folder. The shortcuts will appear in the Documents submenu of Start Menu.
The paths may be relative.
Deletes all shortcuts from the Recent Documents folder.
Copies a string into the specified section of the specified initialization file. You may pass several name/value pairs at once.
Returns 1 if successful, undef otherwise. See Win32::GetLastError & Win32::FormatMessage(Win32::GetLastError) if failed for the error code and message.
Copies a string into the specified section of WIN.INI. You may pass several name/value pairs at once.
Please note that some values or sections of WIN.INI and some other INI files are mapped to registry so they do not show up in the INI file even if they were successfully written!
Reads a value from an INI file. If you do not specify the default and the value is not found you'll get undef.
Reads a value from WIN.INI file. If you do not specify the default and the value is not found you'll get undef.
Please note that some values or sections of WIN.INI and some other INI files are mapped to registry so even that they do not show up in the INI file this function will find and read them!
Delete a value from an INI file.
Delete a value from WIN.INI.
Enumerate the sections in a INI file. If you do not specify the INI file, it enumerates the contents of win.ini.
Enumerate the keys in a section of a INI file. If you do not specify the INI file, it enumerates the contents of win.ini.
Creates the standard Open dialog allowing you to select some files.
Returns a list of selected files or undef if the user pressed [Escape]. It also sets two global variables :
Creates the standard ``Browse For Folder'' dialog. The $title specifies the text to be displayed below the title of the dialog. The $rootFolder may be one of the CSIDL_ ... constants. For $options you should use the BIF_ ... constants. Description of the constants is bellow.
Map a drive letter or LTPx to a network resource. If successfull returns the drive letter/LPTx.
If you do not specify the drive letter, the function uses the last free letter. Since the function doesn't require the ':' in the drive name you may use the function like this:
Breaks an existing network connection. It can also be used to remove remembered network connections that are not currently connected.
$drive_or_share specifies the name of either the redirected local device or the remote network resource to disconnect from. If this parameter specifies a redirected local resource, only the specified redirection is broken; otherwise, all connections to the remote network resource are broken.
The only difference from Disconnect is that persistent=>1 is the default.
This function retrieves the name of the network resource associated with a local device. Or vice versa.
If you do not specify any parameter, you get a hash of drives and shares.
To get the error message from most of these functions, you should not use $!, but Win32::FormatMessage(Win32::GetLastError())!
Specifies that the File Name list box allows multiple selections. If you also set the OFN_EXPLORER flag, the dialog box uses the Explorer-style user interface; otherwise, it uses the old-style user interface.
If the user specifies a file that does not exist, this flag causes the dialog box to prompt the user for permission to create the file. If the user chooses to create the file, the dialog box closes and the function returns the specified name; otherwise, the dialog box remains open.
Since I cannot implement hook procedures through Win32::API (AFAIK), this option in not necessary.
Specifies that the user can type only names of existing files in the File Name entry field. If this flag is specified and the user enters an invalid name, the dialog box procedure displays a warning in a message box. If this flag is specified, the OFN_PATHMUSTEXIST flag is also used.
Hides the Read Only check box.
For old-style dialog boxes, this flag causes the dialog box to use long filenames. If this flag is not specified, or if the OFN_ALLOWMULTISELECT flag is also set, old-style dialog boxes use short filenames (8.3 format) for filenames with spaces. Explorer-style dialog boxes ignore this flag and always display long filenames.
Restores the current directory to its original value if the user changed the directory while searching for files.
Directs the dialog box to return the path and filename of the selected shortcut (.LNK) file. If this value is not given, the dialog box returns the path and filename of the file referenced by the shortcut
For old-style dialog boxes, this flag causes the dialog box to use short filenames (8.3 format). Explorer-style dialog boxes ignore this flag and always display long filenames.
Hides and disables the Network button.
Specifies that the returned file does not have the Read Only check box checked and is not in a write-protected directory.
Specifies that the file is not created before the dialog box is closed. This flag should be specified if the application saves the file on a create-nonmodify network sharepoint. When an application specifies this flag, the library does not check for write protection, a full disk, an open drive door, or network protection. Applications using this flag must perform file operations carefully, because a file cannot be reopened once it is closed.
Specifies that the dialog boxes allow invalid characters in the returned filename.
Causes the Save As dialog box to generate a message box if the selected file already exists. The user must confirm whether to overwrite the file.
Specifies that the user can type only valid paths and filenames. If this flag is used and the user types an invalid path and filename in the File Name entry field, the dialog box function displays a warning in a message box.
Causes the Read Only check box to be checked initially when the dialog box is created. If the check box is checked when the dialog box is closed $Win32::FileOp::ReadOnly is set to true.
Specifies that if a call to the OpenFile function fails because of a network sharing violation, the error is ignored and the dialog box returns the selected filename.
Causes the dialog box to display the Help button. The hwndOwner member must specify the window to receive the HELPMSGSTRING registered messages that the dialog box sends when the user clicks the Help button.
Does not include network folders below the domain level in the tree view control.
Only returns file system directories. If the user selects folders that are not part of the file system, the OK button is grayed.
Only returns file system ancestors. If the user selects anything other than a file system ancestor, the OK button is grayed.
This option is strange, cause it seems to allow you to select only computers. I don't know the definition of a filesystem ancestor, but I didn't think it would be a computer. ?-|
Only returns computers. If the user selects anything other than a computer, the OK button is grayed.
Only returns printers. If the user selects anything other than a printer, the OK button is grayed.
Since it is currently impossible to define callbacks, this options is useless.
Recycle bin --- file system directory containing file objects in the user's recycle bin. The location of this directory is not in the registry; it is marked with the hidden and system attributes to prevent the user from moving or deleting it.
CSIDL_CONTROLS
Control Panel --- virtual folder containing icons for the control panel applications.
CSIDL_DESKTOP
Windows desktop --- virtual folder at the root of the name space.
CSIDL_DESKTOPDIRECTORY
File system directory used to physically store file objects on the desktop (not to be confused with the desktop folder itself).
CSIDL_DRIVES
My Computer --- virtual folder containing everything on the local computer: storage devices, printers, and Control Panel. The folder may also contain mapped network drives.
CSIDL_FONTS
Virtual folder containing fonts.
CSIDL_NETHOOD
File system directory containing objects that appear in the network neighborhood.
CSIDL_NETWORK
Network Neighborhood --- virtual folder representing the top level of the network hierarchy.
CSIDL_PERSONAL
File system directory that serves as a common repository for documents.
CSIDL_PRINTERS
Printers folder --- virtual folder containing installed printers.
CSIDL_PROGRAMS
File system directory that contains the user's program groups (which are also file system directories).
CSIDL_RECENT
File system directory that contains the user's most recently used documents.
CSIDL_SENDTO
File system directory that contains Send To menu items.
CSIDL_STARTMENU
File system directory containing Start menu items.
CSIDL_STARTUP
File system directory that corresponds to the user's Startup program group.
CSIDL_TEMPLATES
File system directory that serves as a common repository for document templates.
Not all options make sense in all functions!
This variable (if defined) contains the text to be displayed on the progress dialog if using FOF_SIMPLEPROGRESS. This allows you to present the user with your own message about what is happening to his computer.
If the options for the call do not contain FOF_SIMPLEPROGRESS, this variable is ignored.
List of handles and functions that use them:
The available groups are :
Examples:
This module contains all methods from Win32::RecycleBin. The only change you have to do is to use this module instead of the old Win32::RecycleBin. Win32:RecycleBin is not supported anymore!