.\" Automatically generated by Pod::Man v1.34, Pod::Parser v1.13 .\" .\" Standard preamble: .\" ======================================================================== .de Sh \" Subsection heading .br .if t .Sp .ne 5 .PP \fB\\$1\fR .PP .. .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. | will give a .\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to .\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' .\" expand to `' in nroff, nothing in troff, for use with C<>. .tr \(*W-|\(bv\*(Tr .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .\" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .hy 0 .if n .na .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "WIN32 1" .TH WIN32 1 "2002-11-24" "perl v5.8.0" "Perl Programmers Reference Guide" .SH "NAME" Win32 \- Interfaces to some Win32 API Functions .SH "DESCRIPTION" .IX Header "DESCRIPTION" Perl on Win32 contains several functions to access Win32 APIs. Some are included in Perl itself (on Win32) and some are only available after explicitly requesting the Win32 module with: .PP .Vb 1 \& use Win32; .Ve .PP The builtin functions are marked as [\s-1CORE\s0] and the other ones as [\s-1EXT\s0] in the following alphabetical listing. The \f(CW\*(C`Win32\*(C'\fR module is not part of the Perl source distribution; it is distributed in the libwin32 bundle of Win32::* modules on \s-1CPAN\s0. The module is already preinstalled in binary distributions like ActivePerl. .Sh "Alphabetical Listing of Win32 Functions" .IX Subsection "Alphabetical Listing of Win32 Functions" .IP "Win32::AbortSystemShutdown(\s-1MACHINE\s0)" 4 .IX Item "Win32::AbortSystemShutdown(MACHINE)" [\s-1EXT\s0] Aborts a system shutdown (started by the InitiateSystemShutdown function) on the specified \s-1MACHINE\s0. .IP "\fIWin32::BuildNumber()\fR" 4 .IX Item "Win32::BuildNumber()" [\s-1CORE\s0] Returns the ActivePerl build number. This function is only available in the ActivePerl binary distribution. .IP "Win32::CopyFile(\s-1FROM\s0, \s-1TO\s0, \s-1OVERWRITE\s0)" 4 .IX Item "Win32::CopyFile(FROM, TO, OVERWRITE)" [\s-1CORE\s0] The \fIWin32::CopyFile()\fR function copies an existing file to a new file. All file information like creation time and file attributes will be copied to the new file. However it will \fBnot\fR copy the security information. If the destination file already exists it will only be overwritten when the \s-1OVERWRITE\s0 parameter is true. But even this will not overwrite a read-only file; you have to \fIunlink()\fR it first yourself. .IP "\fIWin32::DomainName()\fR" 4 .IX Item "Win32::DomainName()" [\s-1CORE\s0] Returns the name of the Microsoft Network domain that the owner of the current perl process is logged into. This function does \&\fBnot\fR work on Windows 9x. .IP "Win32::ExpandEnvironmentStrings(\s-1STRING\s0)" 4 .IX Item "Win32::ExpandEnvironmentStrings(STRING)" [\s-1EXT\s0] Takes \s-1STRING\s0 and replaces all referenced environment variable names with their defined values. References to environment variables take the form \f(CW\*(C`%VariableName%\*(C'\fR. Case is ignored when looking up the VariableName in the environment. If the variable is not found then the original \f(CW\*(C`%VariableName%\*(C'\fR text is retained. Has the same effect as the following: .Sp .Vb 1 \& $string =~ s/%([^%]*)%/$ENV{$1} || "%$1%"/eg .Ve .IP "Win32::FormatMessage(\s-1ERRORCODE\s0)" 4 .IX Item "Win32::FormatMessage(ERRORCODE)" [\s-1CORE\s0] Converts the supplied Win32 error number (e.g. returned by \&\fIWin32::GetLastError()\fR) to a descriptive string. Analogous to the \&\fIperror()\fR standard-C library function. Note that \f(CW$^E\fR used in a string context has much the same effect. .Sp .Vb 2 \& C:\e> perl -e "$^E = 26; print $^E;" \& The specified disk or diskette cannot be accessed .Ve .IP "\fIWin32::FsType()\fR" 4 .IX Item "Win32::FsType()" [\s-1CORE\s0] Returns the name of the filesystem of the currently active drive (like '\s-1FAT\s0' or '\s-1NTFS\s0'). In list context it returns three values: (\s-1FSTYPE\s0, \s-1FLAGS\s0, \s-1MAXCOMPLEN\s0). \s-1FSTYPE\s0 is the filesystem type as before. \s-1FLAGS\s0 is a combination of values of the following table: .Sp .Vb 12 \& 0x00000001 supports case-sensitive filenames \& 0x00000002 preserves the case of filenames \& 0x00000004 supports Unicode in filenames \& 0x00000008 preserves and enforces ACLs \& 0x00000010 supports file-based compression \& 0x00000020 supports disk quotas \& 0x00000040 supports sparse files \& 0x00000080 supports reparse points \& 0x00000100 supports remote storage \& 0x00008000 is a compressed volume (e.g. DoubleSpace) \& 0x00010000 supports object identifiers \& 0x00020000 supports the Encrypted File System (EFS) .Ve .Sp \&\s-1MAXCOMPLEN\s0 is the maximum length of a filename component (the part between two backslashes) on this file system. .IP "Win32::FreeLibrary(\s-1HANDLE\s0)" 4 .IX Item "Win32::FreeLibrary(HANDLE)" [\s-1EXT\s0] Unloads a previously loaded dynamic-link library. The \s-1HANDLE\s0 is no longer valid after this call. See LoadLibrary for information on dynamically loading a library. .IP "\fIWin32::GetArchName()\fR" 4 .IX Item "Win32::GetArchName()" [\s-1EXT\s0] Use of this function is deprecated. It is equivalent with \&\f(CW$ENV\fR{\s-1PROCESSOR_ARCHITECTURE\s0}. This might not work on Win9X. .IP "\fIWin32::GetChipName()\fR" 4 .IX Item "Win32::GetChipName()" [\s-1EXT\s0] Returns the processor type: 386, 486 or 586 for Intel processors, 21064 for the Alpha chip. .IP "\fIWin32::GetCwd()\fR" 4 .IX Item "Win32::GetCwd()" [\s-1CORE\s0] Returns the current active drive and directory. This function does not return a \s-1UNC\s0 path, since the functionality required for such a feature is not available under Windows 95. .IP "Win32::GetFullPathName(\s-1FILENAME\s0)" 4 .IX Item "Win32::GetFullPathName(FILENAME)" [\s-1CORE\s0] GetFullPathName combines the \s-1FILENAME\s0 with the current drive and directory name and returns a fully qualified (aka, absolute) path name. In list context it returns two elements: (\s-1PATH\s0, \s-1FILE\s0) where \&\s-1PATH\s0 is the complete pathname component (including trailing backslash) and \s-1FILE\s0 is just the filename part. Note that no attempt is made to convert 8.3 components in the supplied \s-1FILENAME\s0 to longnames or vice\-versa. Compare with Win32::GetShortPathName and Win32::GetLongPathName. .Sp This function has been added for Perl 5.6. .IP "\fIWin32::GetLastError()\fR" 4 .IX Item "Win32::GetLastError()" [\s-1CORE\s0] Returns the last error value generated by a call to a Win32 \s-1API\s0 function. Note that \f(CW$^E\fR used in a numeric context amounts to the same value. .IP "Win32::GetLongPathName(\s-1PATHNAME\s0)" 4 .IX Item "Win32::GetLongPathName(PATHNAME)" [\s-1CORE\s0] Returns a representation of \s-1PATHNAME\s0 composed of longname components (if any). The result may not necessarily be longer than \s-1PATHNAME\s0. No attempt is made to convert \s-1PATHNAME\s0 to the absolute path. Compare with Win32::GetShortPathName and Win32::GetFullPathName. .Sp This function has been added for Perl 5.6. .IP "\fIWin32::GetNextAvailDrive()\fR" 4 .IX Item "Win32::GetNextAvailDrive()" [\s-1CORE\s0] Returns a string in the form of \*(L":\*(R" where is the first available drive letter. .IP "\fIWin32::GetOSVersion()\fR" 4 .IX Item "Win32::GetOSVersion()" [\s-1CORE\s0] Returns the array (\s-1STRING\s0, \s-1MAJOR\s0, \s-1MINOR\s0, \s-1BUILD\s0, \s-1ID\s0), where the elements are, respectively: An arbitrary descriptive string, the major version number of the operating system, the minor version number, the build number, and a digit indicating the actual operating system. For the \s-1ID\s0, the values are 0 for Win32s, 1 for Windows 9X and 2 for Windows \s-1NT/2000/XP\s0. In scalar context it returns just the \s-1ID\s0. .Sp Currently known values for \s-1ID\s0 \s-1MAJOR\s0 and \s-1MINOR\s0 are as follows: .Sp .Vb 10 \& OS ID MAJOR MINOR \& Win32s 0 - - \& Windows 95 1 4 0 \& Windows 98 1 4 10 \& Windows Me 1 4 90 \& Windows NT 3.51 2 3 51 \& Windows NT 4 2 4 0 \& Windows 2000 2 5 0 \& Windows XP 2 5 1 \& Windows .NET Server 2 5 1 .Ve .Sp Unfortunately as of June 2002 there is no way to distinguish between \&.NET servers and \s-1XP\s0 servers without using additional modules. .IP "\fIWin32::GetOSName()\fR" 4 .IX Item "Win32::GetOSName()" [\s-1EXT\s0] In scalar context returns the name of the Win32 operating system being used. In list context returns a two element list of the \s-1OS\s0 name and whatever edition information is known about the particular build (for Win9x boxes) and whatever service packs have been installed. The latter is roughly equivalent to the first item returned by \&\fIGetOSVersion()\fR in list context. .Sp Currently the possible values for the \s-1OS\s0 name are .Sp .Vb 1 \& Win32s Win95 Win98 WinMe Win2000 WinXP/.Net WinNT3.51 WinNT4 .Ve .Sp This routine is just a simple interface into \fIGetOSVersion()\fR. More specific or demanding situations should use that instead. Another option would be to use \fIPOSIX::uname()\fR, however the latter appears to report only the \s-1OS\s0 family name and not the specific \s-1OS\s0. In scalar context it returns just the \s-1ID\s0. .IP "Win32::GetShortPathName(\s-1PATHNAME\s0)" 4 .IX Item "Win32::GetShortPathName(PATHNAME)" [\s-1CORE\s0] Returns a representation of \s-1PATHNAME\s0 composed only of short (8.3) path components. The result may not necessarily be shorter than \s-1PATHNAME\s0. Compare with Win32::GetFullPathName and Win32::GetLongPathName. .IP "Win32::GetProcAddress(\s-1INSTANCE\s0, \s-1PROCNAME\s0)" 4 .IX Item "Win32::GetProcAddress(INSTANCE, PROCNAME)" [\s-1EXT\s0] Returns the address of a function inside a loaded library. The information about what you can do with this address has been lost in the mist of time. Use the Win32::API module instead of this deprecated function. .IP "\fIWin32::GetTickCount()\fR" 4 .IX Item "Win32::GetTickCount()" [\s-1CORE\s0] Returns the number of milliseconds elapsed since the last system boot. Resolution is limited to system timer ticks (about 10ms on WinNT and 55ms on Win9X). .IP "Win32::InitiateSystemShutdown" 4 .IX Item "Win32::InitiateSystemShutdown" (\s-1MACHINE\s0, \s-1MESSAGE\s0, \s-1TIMEOUT\s0, \s-1FORCECLOSE\s0, \s-1REBOOT\s0) .Sp [\s-1EXT\s0] Shutsdown the specified \s-1MACHINE\s0, notifying users with the supplied \s-1MESSAGE\s0, within the specified \s-1TIMEOUT\s0 interval. Forces closing of all documents without prompting the user if \s-1FORCECLOSE\s0 is true, and reboots the machine if \s-1REBOOT\s0 is true. This function works only on WinNT. .IP "\fIWin32::IsWinNT()\fR" 4 .IX Item "Win32::IsWinNT()" [\s-1CORE\s0] Returns non zero if the Win32 subsystem is Windows \s-1NT\s0. .IP "\fIWin32::IsWin95()\fR" 4 .IX Item "Win32::IsWin95()" [\s-1CORE\s0] Returns non zero if the Win32 subsystem is Windows 95. .IP "Win32::LoadLibrary(\s-1LIBNAME\s0)" 4 .IX Item "Win32::LoadLibrary(LIBNAME)" [\s-1EXT\s0] Loads a dynamic link library into memory and returns its module handle. This handle can be used with Win32::GetProcAddress and Win32::FreeLibrary. This function is deprecated. Use the Win32::API module instead. .IP "\fIWin32::LoginName()\fR" 4 .IX Item "Win32::LoginName()" [\s-1CORE\s0] Returns the username of the owner of the current perl process. .IP "Win32::LookupAccountName(\s-1SYSTEM\s0, \s-1ACCOUNT\s0, \s-1DOMAIN\s0, \s-1SID\s0, \s-1SIDTYPE\s0)" 4 .IX Item "Win32::LookupAccountName(SYSTEM, ACCOUNT, DOMAIN, SID, SIDTYPE)" [\s-1EXT\s0] Looks up \s-1ACCOUNT\s0 on \s-1SYSTEM\s0 and returns the domain name the \s-1SID\s0 and the \s-1SID\s0 type. .IP "Win32::LookupAccountSID(\s-1SYSTEM\s0, \s-1SID\s0, \s-1ACCOUNT\s0, \s-1DOMAIN\s0, \s-1SIDTYPE\s0)" 4 .IX Item "Win32::LookupAccountSID(SYSTEM, SID, ACCOUNT, DOMAIN, SIDTYPE)" [\s-1EXT\s0] Looks up \s-1SID\s0 on \s-1SYSTEM\s0 and returns the account name, domain name, and the \s-1SID\s0 type. .IP "Win32::MsgBox(\s-1MESSAGE\s0 [, \s-1FLAGS\s0 [, \s-1TITLE\s0]])" 4 .IX Item "Win32::MsgBox(MESSAGE [, FLAGS [, TITLE]])" [\s-1EXT\s0] Create a dialogbox containing \s-1MESSAGE\s0. \s-1FLAGS\s0 specifies the required icon and buttons according to the following table: .Sp .Vb 6 \& 0 = OK \& 1 = OK and Cancel \& 2 = Abort, Retry, and Ignore \& 3 = Yes, No and Cancel \& 4 = Yes and No \& 5 = Retry and Cancel .Ve .Sp .Vb 4 \& MB_ICONSTOP "X" in a red circle \& MB_ICONQUESTION question mark in a bubble \& MB_ICONEXCLAMATION exclamation mark in a yellow triangle \& MB_ICONINFORMATION "i" in a bubble .Ve .Sp \&\s-1TITLE\s0 specifies an optional window title. The default is \*(L"Perl\*(R". .Sp The function returns the menu id of the selected push button: .Sp .Vb 1 \& 0 Error .Ve .Sp .Vb 7 \& 1 OK \& 2 Cancel \& 3 Abort \& 4 Retry \& 5 Ignore \& 6 Yes \& 7 No .Ve .IP "\fIWin32::NodeName()\fR" 4 .IX Item "Win32::NodeName()" [\s-1CORE\s0] Returns the Microsoft Network node-name of the current machine. .IP "Win32::RegisterServer(\s-1LIBRARYNAME\s0)" 4 .IX Item "Win32::RegisterServer(LIBRARYNAME)" [\s-1EXT\s0] Loads the \s-1DLL\s0 \s-1LIBRARYNAME\s0 and calls the function DllRegisterServer. .IP "Win32::SetChildShowWindow(\s-1SHOWWINDOW\s0)" 4 .IX Item "Win32::SetChildShowWindow(SHOWWINDOW)" [\s-1CORE\s0] Sets the \fIShowMode\fR of child processes started by \fIsystem()\fR. By default \fIsystem()\fR will create a new console window for child processes if Perl itself is not running from a console. Calling \&\fISetChildShowWindow\fR\|(0) will make these new console windows invisible. Calling \fISetChildShowWindow()\fR without arguments reverts \fIsystem()\fR to the default behavior. The return value of \fISetChildShowWindow()\fR is the previous setting or \f(CW\*(C`undef\*(C'\fR. .Sp [\s-1EXT\s0] The following symbolic constants for \s-1SHOWWINDOW\s0 are available (but not exported) from the Win32 module: \s-1SW_HIDE\s0, \s-1SW_SHOWNORMAL\s0, \&\s-1SW_SHOWMINIMIZED\s0, \s-1SW_SHOWMAXIMIZED\s0 and \s-1SW_SHOWNOACTIVATE\s0. .IP "Win32::SetCwd(\s-1NEWDIRECTORY\s0)" 4 .IX Item "Win32::SetCwd(NEWDIRECTORY)" [\s-1CORE\s0] Sets the current active drive and directory. This function does not work with \s-1UNC\s0 paths, since the functionality required to required for such a feature is not available under Windows 95. .IP "Win32::SetLastError(\s-1ERROR\s0)" 4 .IX Item "Win32::SetLastError(ERROR)" [\s-1CORE\s0] Sets the value of the last error encountered to \s-1ERROR\s0. This is that value that will be returned by the \fIWin32::GetLastError()\fR function. This functions has been added for Perl 5.6. .IP "Win32::Sleep(\s-1TIME\s0)" 4 .IX Item "Win32::Sleep(TIME)" [\s-1CORE\s0] Pauses for \s-1TIME\s0 milliseconds. The timeslices are made available to other processes and threads. .IP "Win32::Spawn(\s-1COMMAND\s0, \s-1ARGS\s0, \s-1PID\s0)" 4 .IX Item "Win32::Spawn(COMMAND, ARGS, PID)" [\s-1CORE\s0] Spawns a new process using the supplied \s-1COMMAND\s0, passing in arguments in the string \s-1ARGS\s0. The pid of the new process is stored in \&\s-1PID\s0. This function is deprecated. Please use the Win32::Process module instead. .IP "Win32::UnregisterServer(\s-1LIBRARYNAME\s0)" 4 .IX Item "Win32::UnregisterServer(LIBRARYNAME)" [\s-1EXT\s0] Loads the \s-1DLL\s0 \s-1LIBRARYNAME\s0 and calls the function DllUnregisterServer.