start_any_viewer($file)
start_html_viewer($file)
start_ps_viewer($file)
start_ps_print($file)
start_mail_composer($mailaddr)
get_class_by_ext($ext)
install_extension(%args)
write_uninstall_information(%args)
get_home_dir()
create_shortcut(%args)
create_internet_shortcut(%args)
add_recent_doc($doc)
create_program_group(%args)
client_window_region($tk_window)
screen_region($tk_window)
maximize($tk_window)
get_sys_color($what)
disable_dosbox_close_button()
Win32Util - a collection of Win32 related functions
use Win32Util;
This is a collection of Win32 related functions. There are no strict prerequirements for this module, however, full functionality can only be achieved if some CPAN modules (Win32::Registry, Win32::API, Win32::DDE, Win32::Shortcut ...) are available. By default, most of these modules are already bundled with the popular ActivePerl package.
start_any_viewer($file)
Based on extension of the given $file, start the appropriate viewer.
start_html_viewer($file)
Start a html viewer with the given file. This is mostly a WWW browser.
start_ps_viewer($file)
Start a postscript viewer with the given file.
start_ps_print($file)
Print a postscript file via a postscript viewer.
start_mail_composer($mailaddr)
Start a mail composer with $mailaddr as the recipient.
Start an external program named $cmd. $cmd should be the full path to the executable. @args are passed to the program. The program is spawned, that is, executed in the background.
Return a hash reference with all environment variable names changed to uppercase.
Start a program via DDE. (What is $app and $topic?)
Get a command from registry for $filetype. The "open" type is returned, except stated otherwise.
get_class_by_ext($ext)
Return the class name for the given extension.
install_extension(%args)
Install a new extension (class) to the registry. The function may take the following key-value parameters:
Required. The extension to be installed. The extension should start with a dot. This can also be an array reference to a number of extensions.
Required. The class name of the new extension. May be something like Excel.Application.
The (full) path to a default icon file (format should be .ico).
The default open command (used if the file is double-clicked in the explorer).
The default print command.
An optional description.
The mime type of the extension (something like text/plain).
write_uninstall_information(%args)
The application name. This is required.
The command for the uninstall process (???). is required.
Current owner of the registry entry (???). If not specified, the current user is used.
Version number of application. This should consist of a major and
minor number. The full application name will be created of $appname
and $version
.
The date of installation. If not specified, the current date is used.
Get current windows user.
Guess if current user has admin rights.
Get the folder path for the current user, or, if $public is set to a true value, for the whole system. If $foldertype is not given, the "Personal" subfolder is returned.
Get the folder path for the program files (usually C:\Program Files).
get_home_dir()
Get home directory (from domain server) or the $HOME variable.
lwp_auto_proxy($lwp_user_agent)
Set the proxy for a LWP::UserAgent object (similar to the unix-centric env_proxy method). Uses the Internet Explorer proxy setting.
send_mail(%args)
Send an email through MAPI or other means. Some of the following arguments are recognized:
Required. The sender who is sending the mail.
The MAPI password (?)
The recipient of the mail.
The subject of the message.
The body text of the message.
This is from Win32 FAQ. Not tested, because MAPI is not installed on my system.
create_shortcut(%args)
Create a shortcut (a desktop link). The following arguments are recognized:
Path to program (required).
Additional arguments for the program.
Path to the .ico icon file.
Title of the program (required).
Specify where to save the .lnk file. If -file is not given, the file will be stored on the current user desktop. The filename will consist of the -name parameter and the .lnk extension.
Description for the file.
Working directory of this file.
If true, create a shortcut visible for all users.
Create shortlink in Autostart folder.
create_internet_shortcut(%args)
Create an internet shortcut. The following arguments are recognized:
URL for the shortcur (required).
Path to the .ico icon file.
Title of the program (required).
Specify where to save the .lnk file. If -file is not given, the file will be stored on the current user desktop. The filename will consist of the -url parameter and the .lnk extension.
Description for the file (not used yet).
add_recent_doc($doc)
Add the specified document to the list of recent documents.
create_program_group(%args)
Create a program group. Following arguments are recognized:
Required. The name of the new program group.
Required. The files to be included into the new program group. The argument may be either a file name or an array with a number of file names. The file names can be either a string or a hash like {-path => 'path', -name => 'name'}. In the latter case, this hash will be used as an argument for create_shortcut.
If true, create a program group in the public section, not in the user section of the start menu.
Return a list of CDROM drives on the system.
get_drives([$drive_filter])
Return a list of drives on the system. The optional parameter
$drive_filter
should be a comma-separated string with the possible
values cdrom
, fixed
(for fixed drives like harddisks),
ramdisk
, remote
(for net drives), and removable
(for
removable drives like ZIP or floppy disk drives).
Expand a normal absolute path to a UNC path.
client_window_region($tk_window)
Return maximum region for a window (without borders, title bar, taskbar area). Format is ($x, $y, $width, $height).
screen_region($tk_window)
Return maximum screen size without taskbar area.
maximize($tk_window)
Maximize the window. If Win32::API is installed, then the taskbar will not be obscured.
get_sys_color($what)
Return ($r,$g,$b) values from 0 to 255 for the requested system color.
$what
is any of: scrollbar, background, activecaption,
inactivecaption, menu, window, windowframe, menutext, windowtext,
captiontext, activeborder, inactiveborder, appworkspace, highlight,
highlighttext, btnface, btnshadow, graytext, btntext,
inactivecaptiontext, btnhighlight, 3ddkshadow, 3dlight, infotext,
infobk.
disable_dosbox_close_button()
As the function name says :-). Derived from a posting from Jack D.
NOT YET TESTED!
Keep the window $tk_window
on top. If Win32::API
is not
available, a crude hack with a <Visibility> binding is used instead.
If the optional variable $flag
is false, "keep on top" is disabled.
sort_cmp_hack($a,$b)
"use locale" does not work on Windows. This is a hack to be used in sort for german umlauts.
perlwin32, Win32::API, Win32::OLE, Win32::Registry, Win32::Process, Win32::DDE, Win32::Shortcut, Tk, the LWP::UserAgent manpage.
Slaven Rezic <slaven@rezic.de>
Copyright (c) 1999, 2000, 2001, 2002 Slaven Rezic. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.