<script type="text/javascript">$(function(){0<=window.navigator.userAgent.toLowerCase().indexOf("ucbrowser")&&CaoNiMaDeUc()})</script> </head> <body> <h1>GetKeySC</h1> <p>检索按键的扫描码.</p> <pre class="Syntax">SC := <span class="func">GetKeySC</span>(KeyName)</pre> <h2 id="Parameters">参数</h2> <dl> <dt>KeyName</dt> <dd> <p>类型: <a href="../Concepts.htm#strings">字符串</a></p> <p>这可以是键盘上的任何单个字符, 也可以是<a href="../KeyList.htm">按键列表</a>中的一个按键名称, 如鼠标/操纵杆按钮. 示例: B, 5, LWin, RControl, Alt, Enter, Escape, LButton, MButton, Joy1.</p> <p>或者, 可以指定显式虚拟键码(如 vkFF) 或显式扫描码(如 sc01D). 这在按键没有名称的情况下(罕见的) 非常有用. 可以按照<a href="../KeyList.htm#SpecialKeys">按键列表</a>底部的步骤来确定这样一个按键的键码. 请注意, 这些代码必须是十六进制的.</p> <p><b>已知限制:</b> 此函数不能区分共享相同虚拟键码的两个按键, 如 Left 和 NumpadLeft.</p> </dd> </dl> <h2 id="Return_Value">返回值</h2> <p>类型: <a href="../Concepts.htm#numbers">整数</a></p> <p>函数返回指定按键的扫描码.</p> <h2 id="Remarks">备注</h2> <p>如果您稍后想在脚本的其他地方使用扫描码, 则必须首先将其转换为十六进制格式, 如 <code>Format("sc{:X}", sc_code)</code>.</p> <h2 id="Related">相关</h2> <p><a href="GetKeyVK.htm">GetKeyVK</a>, <a href="GetKeyName.htm">GetKeyName</a>, <a href="GetKeyState.htm">GetKeyState</a>, <a href="../KeyList.htm">Key List</a>, <a href="Format.htm">Format</a></p> <h2 id="Examples">示例</h2> <div class="ex" id="ExBasic"> <p><a class="ex_number" href="#ExBasic"></a> 检索并报告左 <kbd>Ctrl</kbd> 的十六进制扫描码.</p> <pre>sc_code := GetKeySC("LControl") MsgBox Format("sc{:X}", sc_code) <em>; 报告 sc1D</em></pre> </div> </body> </html>