📄 ch22_11.htm
字号:
<dd>Resource contains more resources</p></dd></dl><p>The functions in Win32::NetResource use the<tt class="literal">share_info</tt> and <tt class="literal">netresource</tt>structures as input and output arguments. These arguments are used inthe description of the functions below; you should name them whateveryou want.</p><a name="INDEX-3313" /><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>AddConnection</b></font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>AddConnection (\%<em class="replaceable">netresource</em>, <em class="replaceable">password</em>, <em class="replaceable">username</em>, <em class="replaceable">connection</em>)</pre><p><a name="INDEX-3313" />Connects to the resourcedescribed in<tt class="literal">%</tt><em class="replaceable"><tt>netresource</tt></em>, with the<em class="replaceable"><tt>password</tt></em> and<em class="replaceable"><tt>username</tt></em> of the user. The<tt class="sgmltag-element"><connection></tt> flag indicates whether the connectionshould be remembered for the user for all logins.</p></div><a name="INDEX-3314" /><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>CancelConnection</b></font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>CancelConnection (<em class="replaceable">name</em>, <em class="replaceable">connection</em>, <em class="replaceable">force</em>)</pre><p><a name="INDEX-3314" />Cancels a connection to aresource connected to the local device specified by<em class="replaceable"><tt>name</tt></em>.<em class="replaceable"><tt>connection</tt></em> indicates the type ofconnection, with <tt class="literal">1</tt> being a persistent connectionand <tt class="literal">0</tt> being nonpersistent. The<em class="replaceable"><tt>force</tt></em> value is a Boolean indicatingwhether to force the connection.</p></div><a name="INDEX-3315" /><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>GetError</b></font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>GetError ($<em class="replaceable">code</em>)</pre><p><a name="INDEX-3315" />Gets the last errorcaused by a Win32 network call and saves it in the variable named by<em class="replaceable"><tt>code</tt></em>.</p></div><a name="INDEX-3316" /><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>GetSharedResources</b></font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>GetSharedResources (\@<em class="replaceable">resources</em>, <em class="replaceable">type</em>)</pre><p><a name="INDEX-3316" />Gets a list of allnetwork resources and saves the list as references to<tt class="literal">%</tt><em class="replaceable"><tt>netresource</tt></em> hashes in<tt class="literal">@</tt><em class="replaceable"><tt>resources</tt></em>.<em class="replaceable"><tt>type</tt></em> is the type of enumeration.</p></div><a name="INDEX-3317" /><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>GetUNCName</b></font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>GetUNCName ($<em class="replaceable">uncname</em>, <em class="replaceable">path</em>)</pre><p><a name="INDEX-3317" />Gets the UNC name of theshare connected to the local <em class="replaceable"><tt>path</tt></em> andsaves it to the variable specified by<em class="replaceable"><tt>uncname</tt></em>.</p></div><a name="INDEX-3318" /><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>NetShareAdd</b></font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>NetShareAdd (\%<em class="replaceable">shareinfo</em>, $<em class="replaceable">error</em>, [<em class="replaceable">server</em>])</pre><p><a name="INDEX-3318" />Makes a disk resourcedescribed by <em class="replaceable"><tt>shareinfo</tt></em> available forsharing on the network. <em class="replaceable"><tt>server</tt></em> is the nameof the server for the shared resource (<tt class="literal">local</tt> isassumed if not specified). Any error that occurs is saved in thevariable named by <em class="replaceable"><tt>error</tt></em>.</p></div><a name="INDEX-3319" /><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>NetShareCheck</b></font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>NetShareCheck (<em class="replaceable">device</em>, $<em class="replaceable">type</em>, [<em class="replaceable">server</em>])</pre><p><a name="INDEX-3319" />Returns true if a shareon <em class="replaceable"><tt>device</tt></em> is available for connection. Thetype of share is saved in the variable named by<em class="replaceable"><tt>type</tt></em> (if the function returns true).</p></div><a name="INDEX-3320" /><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>NetShareDel</b></font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>NetShareDel (<em class="replaceable">name</em>, [<em class="replaceable">server</em>])</pre><p><a name="INDEX-3320" />Removes the share named<em class="replaceable"><tt>name</tt></em> on optional<em class="replaceable"><tt>server</tt></em> from a machine'slist of shares.</p></div><a name="INDEX-3321" /><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>NetShareGetInfo</b></font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>NetShareGetInfo (<em class="replaceable">name</em>, \%<em class="replaceable">shareinfo</em>, [<em class="replaceable">server</em>])</pre><p><a name="INDEX-3321" />Gets the shareinformation for the share <em class="replaceable"><tt>name</tt></em> on optional<em class="replaceable"><tt>server</tt></em> and saves it in the specified<em class="replaceable"><tt>shareinfo</tt></em> variable.</p></div><a name="INDEX-3322" /><a name="INDEX-3323" /><a name="INDEX-3324" /><a name="INDEX-3325" /><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>NetShareSetInfo</b></font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>NetShareSetInfo (<em class="replaceable">name</em>, \%<em class="replaceable">shareinfo</em>, $<em class="replaceable">error</em>, [<em class="replaceable">server</em>])</pre><p><a name="INDEX-3322" />Sets the information forthe share <em class="replaceable"><tt>name</tt></em> on<em class="replaceable"><tt>server</tt></em> to the parameters given by<em class="replaceable"><tt>shareinfo</tt></em>. The error status is saved tothe variable named by <em class="replaceable"><tt>error</tt></em>.<a name="INDEX-3323" /><a name="INDEX-3324" /><a name="INDEX-3325" /></p></div><a name="INDEX-3326" /><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>WNetGetLastError</b></font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>WNetGetLastError ($<em class="replaceable">code</em>, $<em class="replaceable">description</em>, $<em class="replaceable">name</em>)</pre><p><a name="INDEX-3326" />Gets the extended networkerror and saves its information to the variables named by<em class="replaceable"><tt>code</tt></em>,<em class="replaceable"><tt>description</tt></em>, and<em class="replaceable"><tt>name</tt></em>. An extended network error is givenonly when Win32::GetLastError returns<tt class="literal">ERROR_EXTENDED_ERROR</tt>.</p></div><hr width="684" align="left" /><div class="navbar"><table width="684" border="0"><tr><td align="left" valign="top" width="228"><a href="ch22_10.htm"><img src="../gifs/txtpreva.gif" alt="Previous" border="0" /></a></td><td align="center" valign="top" width="228"><a href="index.htm"><img src="../gifs/txthome.gif" alt="Home" border="0" /></a></td><td align="right" valign="top" width="228"><a href="ch22_12.htm"><img src="../gifs/txtnexta.gif" alt="Next" border="0" /></a></td></tr><tr><td align="left" valign="top" width="228">22.10. Win32::NetAdmin</td><td align="center" valign="top" width="228"><a href="index/index.htm"><img src="../gifs/index.gif" alt="Book Index" border="0" /></a></td><td align="right" valign="top" width="228">22.12. Win32::PerfLib</td></tr></table></div><hr width="684" align="left" /><img src="../gifs/navbar.gif" usemap="#library-map" border="0" alt="Library Navigation Links" /><p><p><font size="-1"><a href="copyrght.htm">Copyright © 2002</a> O'Reilly & Associates. All rights reserved.</font></p><map name="library-map"><area shape="rect" coords="1,0,85,94" href="../index.htm"><area shape="rect" coords="86,1,178,103" href="../lwp/index.htm"><area shape="rect" coords="180,0,265,103" href="../lperl/index.htm"><area shape="rect" coords="267,0,353,105" href="../perlnut/index.htm"><area shape="rect" coords="354,1,446,115" href="../prog/index.htm"><area shape="rect" coords="448,0,526,132" href="../tk/index.htm"><area shape="rect" coords="528,1,615,119" href="../cookbook/index.htm"><area shape="rect" coords="617,0,690,135" href="../pxml/index.htm"></map></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -