win32.html
来自「perl教程」· HTML 代码 · 共 667 行 · 第 1/2 页
HTML
667 行
<dt><strong><a name="item_getosversion">Win32::GetOSVersion()</a></strong>
<dd>
<p>[CORE] Returns the list (STRING, MAJOR, MINOR, BUILD, ID), 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 ID, the values are 0 for Win32s, 1 for Windows 9X/Me and 2 for
Windows NT/2000/XP/2003. In scalar context it returns just the ID.</p>
</dd>
<dd>
<p>Currently known values for ID MAJOR and MINOR are as follows:</p>
</dd>
<dd>
<pre>
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 Server 2003 2 5 2
Windows Vista 2 6 0</pre>
</dd>
<dd>
<p>On Windows NT 4 SP6 and later this function returns the following
additional values: SPMAJOR, SPMINOR, SUITEMASK, PRODUCTTYPE.</p>
</dd>
<dd>
<p>SPMAJOR and SPMINOR are are the version numbers of the latest
installed service pack.</p>
</dd>
<dd>
<p>SUITEMASK is a bitfield identifying the product suites available on
the system. Known bits are:</p>
</dd>
<dd>
<pre>
VER_SUITE_SMALLBUSINESS 0x00000001
VER_SUITE_ENTERPRISE 0x00000002
VER_SUITE_BACKOFFICE 0x00000004
VER_SUITE_COMMUNICATIONS 0x00000008
VER_SUITE_TERMINAL 0x00000010
VER_SUITE_SMALLBUSINESS_RESTRICTED 0x00000020
VER_SUITE_EMBEDDEDNT 0x00000040
VER_SUITE_DATACENTER 0x00000080
VER_SUITE_SINGLEUSERTS 0x00000100
VER_SUITE_PERSONAL 0x00000200
VER_SUITE_BLADE 0x00000400
VER_SUITE_EMBEDDED_RESTRICTED 0x00000800
VER_SUITE_SECURITY_APPLIANCE 0x00001000</pre>
</dd>
<dd>
<p>The VER_SUITE_xxx names are listed here to crossreference the Microsoft
documentation. The Win32 module does not provide symbolic names for these
constants.</p>
</dd>
<dd>
<p>PRODUCTTYPE provides additional information about the system. It should
be one of the following integer values:</p>
</dd>
<dd>
<pre>
1 - Workstation (NT 4, 2000 Pro, XP Home, XP Pro)
2 - Domaincontroller
3 - Server</pre>
</dd>
</li>
<dt><strong><a name="item_getosname">Win32::GetOSName()</a></strong>
<dd>
<p>[EXT] In scalar context returns the name of the Win32 operating system
being used. In list context returns a two element list of the OS 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
<a href="#item_getosversion"><code>GetOSVersion()</code></a> in list context.</p>
</dd>
<dd>
<p>Currently the possible values for the OS name are</p>
</dd>
<dd>
<pre>
Win32s Win95 Win98 WinMe WinNT3.51 WinNT4 Win2000 WinXP/.Net Win2003</pre>
</dd>
<dd>
<p>This routine is just a simple interface into GetOSVersion(). More
specific or demanding situations should use that instead. Another
option would be to use POSIX::uname(), however the latter appears to
report only the OS family name and not the specific OS. In scalar
context it returns just the ID.</p>
</dd>
<dd>
<p>The name "WinXP/.Net" is used for historical reasons only, to maintain
backwards compatibility of the Win32 module. Windows .NET Server has
been renamed as Windows 2003 Server before final release and uses a
different major/minor version number than Windows XP.</p>
</dd>
</li>
<dt><strong><a name="item_getshortpathname">Win32::GetShortPathName(PATHNAME)</a></strong>
<dd>
<p>[CORE] Returns a representation of PATHNAME that is composed of short
(8.3) path components where available. For path components where the
file system has not generated the short form the returned path will
use the long form, so this function might still for instance return a
path containing spaces. Compare with Win32::GetFullPathName() and
Win32::GetLongPathName().</p>
</dd>
</li>
<dt><strong><a name="item_getprocaddress">Win32::GetProcAddress(INSTANCE, PROCNAME)</a></strong>
<dd>
<p>[EXT] 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.</p>
</dd>
</li>
<dt><strong><a name="item_gettickcount">Win32::GetTickCount()</a></strong>
<dd>
<p>[CORE] 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).</p>
</dd>
</li>
<dt><strong><a name="item_guidgen">Win32::GuidGen()</a></strong>
<dd>
<p>[EXT] Creates a globally unique 128 bit integer that can be used as a
persistent identifier in a distributed setting. To a very high degree
of certainty this function returns a unique value. No other
invocation, on the same or any other system (networked or not), should
return the same value.</p>
</dd>
<dd>
<p>The return value is formatted according to OLE conventions, as groups
of hex digits with surrounding braces. For example:</p>
</dd>
<dd>
<pre>
<span class="operator">{</span><span class="number">09531</span><span class="variable">CF1</span><span class="operator">-</span><span class="variable">D0C7</span><span class="operator">-</span><span class="number">4860</span><span class="operator">-</span><span class="number">840</span><span class="variable">C</span><span class="operator">-</span><span class="number">1</span><span class="variable">C8C8735E2AD</span><span class="operator">}</span>
<span class="comment">=item Win32::InitiateSystemShutdown
</span>
</pre>
</dd>
<dd>
<p>(MACHINE, MESSAGE, TIMEOUT, FORCECLOSE, REBOOT)</p>
</dd>
<dd>
<p>[EXT] Shutsdown the specified MACHINE, notifying users with the
supplied MESSAGE, within the specified TIMEOUT interval. Forces
closing of all documents without prompting the user if FORCECLOSE is
true, and reboots the machine if REBOOT is true. This function works
only on WinNT.</p>
</dd>
</li>
<dt><strong><a name="item_isadminuser">Win32::IsAdminUser()</a></strong>
<dd>
<p>[EXT] Returns non zero if the account in whose security context the
current process/thread is running belongs to the local group of
Administrators in the built-in system domain; returns 0 if not.
On Windows Vista it will only return non-zero if the process is
actually running with elevated privileges. Returns the undefined
value and prints a warning if an error occurred. This function always
returns 1 on Win9X.</p>
</dd>
</li>
<dt><strong><a name="item_iswinnt">Win32::IsWinNT()</a></strong>
<dd>
<p>[CORE] Returns non zero if the Win32 subsystem is Windows NT.</p>
</dd>
</li>
<dt><strong><a name="item_iswin95">Win32::IsWin95()</a></strong>
<dd>
<p>[CORE] Returns non zero if the Win32 subsystem is Windows 95.</p>
</dd>
</li>
<dt><strong><a name="item_loadlibrary">Win32::LoadLibrary(LIBNAME)</a></strong>
<dd>
<p>[EXT] 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.</p>
</dd>
</li>
<dt><strong><a name="item_loginname">Win32::LoginName()</a></strong>
<dd>
<p>[CORE] Returns the username of the owner of the current perl process.
The return value may be a Unicode string.</p>
</dd>
</li>
<dt><strong><a name="item_lookupaccountname">Win32::LookupAccountName(SYSTEM, ACCOUNT, DOMAIN, SID, SIDTYPE)</a></strong>
<dd>
<p>[EXT] Looks up ACCOUNT on SYSTEM and returns the domain name the SID and
the SID type.</p>
</dd>
</li>
<dt><strong><a name="item_lookupaccountsid">Win32::LookupAccountSID(SYSTEM, SID, ACCOUNT, DOMAIN, SIDTYPE)</a></strong>
<dd>
<p>[EXT] Looks up SID on SYSTEM and returns the account name, domain name,
and the SID type.</p>
</dd>
</li>
<dt><strong><a name="item_msgbox">Win32::MsgBox(MESSAGE [, FLAGS [, TITLE]])</a></strong>
<dd>
<p>[EXT] Create a dialogbox containing MESSAGE. FLAGS specifies the
required icon and buttons according to the following table:</p>
</dd>
<dd>
<pre>
0 = OK
1 = OK and Cancel
2 = Abort, Retry, and Ignore
3 = Yes, No and Cancel
4 = Yes and No
5 = Retry and Cancel</pre>
</dd>
<dd>
<pre>
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</pre>
</dd>
<dd>
<p>TITLE specifies an optional window title. The default is "Perl".</p>
</dd>
<dd>
<p>The function returns the menu id of the selected push button:</p>
</dd>
<dd>
<pre>
0 Error</pre>
</dd>
<dd>
<pre>
1 OK
2 Cancel
3 Abort
4 Retry
5 Ignore
6 Yes
7 No</pre>
</dd>
</li>
<dt><strong><a name="item_nodename">Win32::NodeName()</a></strong>
<dd>
<p>[CORE] Returns the Microsoft Network node-name of the current machine.</p>
</dd>
</li>
<dt><strong><a name="item_registerserver">Win32::RegisterServer(LIBRARYNAME)</a></strong>
<dd>
<p>[EXT] Loads the DLL LIBRARYNAME and calls the function DllRegisterServer.</p>
</dd>
</li>
<dt><strong><a name="item_setchildshowwindow">Win32::SetChildShowWindow(SHOWWINDOW)</a></strong>
<dd>
<p>[CORE] Sets the <em>ShowMode</em> of child processes started by system().
By default <a href="../lib/Pod/perlfunc.html#item_system"><code>system()</code></a> will create a new console window for child
processes if Perl itself is not running from a console. Calling
<a href="#item_setchildshowwindow"><code>SetChildShowWindow(0)</code></a> will make these new console windows invisible.
Calling <a href="#item_setchildshowwindow"><code>SetChildShowWindow()</code></a> without arguments reverts <a href="../lib/Pod/perlfunc.html#item_system"><code>system()</code></a> to the
default behavior. The return value of <a href="#item_setchildshowwindow"><code>SetChildShowWindow()</code></a> is the
previous setting or <a href="../lib/Pod/perlfunc.html#item_undef"><code>undef</code></a>.</p>
</dd>
<dd>
<p>[EXT] The following symbolic constants for SHOWWINDOW are available
(but not exported) from the Win32 module: SW_HIDE, SW_SHOWNORMAL,
SW_SHOWMINIMIZED, SW_SHOWMAXIMIZED and SW_SHOWNOACTIVATE.</p>
</dd>
</li>
<dt><strong><a name="item_setcwd">Win32::SetCwd(NEWDIRECTORY)</a></strong>
<dd>
<p>[CORE] Sets the current active drive and directory. This function does not
work with UNC paths, since the functionality required to required for
such a feature is not available under Windows 95.</p>
</dd>
</li>
<dt><strong><a name="item_setlasterror">Win32::SetLastError(ERROR)</a></strong>
<dd>
<p>[CORE] Sets the value of the last error encountered to ERROR. This is
that value that will be returned by the Win32::GetLastError()
function.</p>
</dd>
</li>
<dt><strong><a name="item_sleep">Win32::Sleep(TIME)</a></strong>
<dd>
<p>[CORE] Pauses for TIME milliseconds. The timeslices are made available
to other processes and threads.</p>
</dd>
</li>
<dt><strong><a name="item_spawn">Win32::Spawn(COMMAND, ARGS, PID)</a></strong>
<dd>
<p>[CORE] Spawns a new process using the supplied COMMAND, passing in
arguments in the string ARGS. The pid of the new process is stored in
PID. This function is deprecated. Please use the Win32::Process module
instead.</p>
</dd>
</li>
<dt><strong><a name="item_unregisterserver">Win32::UnregisterServer(LIBRARYNAME)</a></strong>
<dd>
<p>[EXT] Loads the DLL LIBRARYNAME and calls the function
DllUnregisterServer.</p>
</dd>
</li>
</dl>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?