⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 s.html

📁 windowsAPI介绍。很详细的
💻 HTML
📖 第 1 页 / 共 2 页
字号:
windows.<br>
&nbsp;&nbsp;flags = SWP_NOSIZE Or SWP_DRAWFRAME 'Do not resize window<br>
&nbsp;&nbsp;x = SetWindowPos(Form1.hWnd, HWND_TOPMOST, 0, 0, 0, 0, flags)</code><br>
<br>
<b>Related Call:</b> <a HREF="g.html#getwindowrect">GetWindowRect</a><br>
<b>Category:</b> <a HREF="index.html#windows" REL="Index">Windows</a><br>
<a HREF="index.html" REL="Index">返回到索引.</a> </p>

<hr ALIGN="center" WIDTH="85%" SIZE="5">

<p ALIGN="left"><a NAME="setwindowtext"></a></p>

<h3 ALIGN="center">SetWindowText Function</h3>
<code>

<p align="center">Declare Function SetWindowText Lib &quot;user32.dll&quot; Alias 
&quot;SetWindowTextA&quot; (ByVal hwnd As Long, ByVal lpString As String) As Long</code><br>
SetWindowText alters the .Caption property of a window. While you could easily do this 
with objects in your programs, this is also able to change captions in other programs' 
windows! Obviously with its potential, this function should be used with care so you don't 
mess up another program. This function returns an error code which can safely be ignored.<br>
</p>

<table WIDTH="95%" BORDER="2" CELLSPACING="0">
  <tr>
    <td WIDTH="20%"><code>hwnd</code></td>
    <td WIDTH="80%">The handle of the window to change the .Caption property of. </td>
  </tr>
  <tr>
    <td><code>lpString</code></td>
    <td>The text to set as the window's caption. </td>
  </tr>
</table>
<b>

<p>Example:</b><br>
<code>&nbsp;&nbsp;'This changes the caption of button Command1<br>
&nbsp;&nbsp;x = SetWindowText(Command1.hWnd, &quot;&amp;Push me!&quot;)</code><br>
<br>
<b>Related Call:</b> <a HREF="g.html#getwindowtext">GetWindowText</a><br>
<b>Category:</b> <a HREF="index.html#windows" REL="Index">Windows</a><br>
<a HREF="index.html" REL="Index">返回到索引.</a> </p>

<hr ALIGN="center" WIDTH="85%" SIZE="5">

<p ALIGN="left"><a NAME="showcursor"></a></p>

<h3 ALIGN="center">ShowCursor Function</h3>
<code>

<p align="center">Declare Function ShowCursor Lib &quot;user32.dll&quot; (ByVal bShow As 
Long) As Long</code><br>
ShowCursor enables you to show and hide the cursor. This is not done directly, but through 
incrementing or decrementing a counter. Each function call raises or lowers the counter by 
1. If the counter is negative, the cursor is invisible. If it is non-negative (0 or 
greater), it is visible. Even if the cursor is invisible, it is still able to click 
buttons and such. The function returns the status of the counter after changing it.<br>
</p>

<table WIDTH="95%" BORDER="2" CELLSPACING="0">
  <tr>
    <td WIDTH="20%"><code>bShow</code></td>
    <td WIDTH="80%">If this is zero (False), decrement the counter by one. If non-zero (True), 
    increment the counter by one. </td>
  </tr>
</table>
<b>

<p>Example:</b><br>
<code>&nbsp;&nbsp;'This code hides the cursor<br>
&nbsp;&nbsp;Do<br>
&nbsp;&nbsp;&nbsp;&nbsp;x = ShowCursor(False) 'False = 0 (VB constant)<br>
&nbsp;&nbsp;Loop Until x <0 'if cursor is hidden<BR> &nbsp;&nbsp;'This code shows the cursor<br>
&nbsp;&nbsp;Do<br>
&nbsp;&nbsp;&nbsp;&nbsp;x = ShowCursor(True) 'True = -1 (VB constant)<br>
&nbsp;&nbsp;Loop Until x &gt;= 0 'if cursor is visible</code><br>
<br>
<b>Category:</b> <a HREF="index.html#mouse" REL="Index">Mouse</a><br>
<a HREF="index.html" REL="Index">返回到索引.</a> </p>

<hr ALIGN="center" WIDTH="85%" SIZE="5">

<p ALIGN="left"><a NAME="sleep"></a></p>

<h3 ALIGN="center">Sleep Sub</h3>
<code>

<p align="center">Declare Sub Sleep Lib &quot;kernel32.dll&quot; (ByVal dwMilliseconds As 
Long)</code><br>
Sleep halts program execution for a certain amount of time. This is smaller, more precise, 
and easier to use than checking Timer through a Do/Loop construct.<br>
</p>

<table WIDTH="95%" CELLSPACING="0" BORDER="2">
  <tr>
    <td WIDTH="20%"><code>dwMilliseconds</code></td>
    <td WIDTH="80%">How long to halt program execution in milliseconds (1000 milliseconds = 1 
    second). </td>
  </tr>
</table>
<b>

<p>Example:</b><br>
<code>&nbsp;&nbsp;'Demonstrate Sleep<br>
&nbsp;&nbsp;Debug.Print &quot;The time is &quot; &amp; Time$<br>
&nbsp;&nbsp;Sleep 2000 '2-second delay<br>
&nbsp;&nbsp;Debug.Print &quot;The time is &quot; &amp; Time$</code><br>
<br>
<b>Category:</b> <a HREF="index.html#misc" REL="Index">Miscellaneous/Uncategorized</a><br>
<a HREF="index.html" REL="Index">返回到索引.</a> </p>

<hr ALIGN="center" WIDTH="85%" SIZE="5">

<p ALIGN="left"><a NAME="sndplaysound"></a></p>

<h3 ALIGN="center">sndPlaySound Function</h3>
<code>

<p align="center">Declare Function sndPlaySound Lib &quot;winmm.dll&quot; (ByVal 
lpszSoundName As String, ByVal uFlags As Long) As Long</code><br>
sndPlaySound plays a .wav file without using the MMControl custom control. If you use the 
SND_ALIAS flag, it instead plays a Windows sound (chord, system start, etc.). If you use 
the NO_DEFAULT flag, the function returns 0 if the .wav file is not found and 1 if it is. 
If you omit it, it always returns 1 and plays the default sound if the .wav file is not 
found.<br>
</p>

<table WIDTH="95%" CELLSPACING="0" BORDER="2">
  <tr>
    <td WIDTH="20%"><code>lpszSoundName</code></td>
    <td WIDTH="80%">Either the path and filename of the .wav file, or the alias of the windows 
    sound. </td>
  </tr>
  <tr>
    <td><code>uFlags</code></td>
    <td>Zero or more of the <a HREF="appb.html#soundflags">sound flags</a>. </td>
  </tr>
</table>
<b>

<p>Example:</b><br>
<code>&nbsp;&nbsp;'Play the file and halt execution until it is finished.<br>
&nbsp;&nbsp;x = sndPlaySound(&quot;c:\windows\chord.wav&quot;, SND_FILENAME + SND_SYNC)</code><br>
<br>
<b>Category:</b> <a HREF="index.html#audio" REL="Index">Audio</a><br>
<a HREF="index.html" REL="Index">返回到索引.</a> </p>

<hr ALIGN="center" WIDTH="85%" SIZE="5">

<p ALIGN="left"><a NAME="stretchblt"></a></p>

<h3 ALIGN="center">StretchBlt Function</h3>
<code>

<p align="center">Declare Function StretchBlt Lib &quot;gdi32.dll&quot; (ByVal hdc As 
Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal 
hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal nSrcWidth As Long, ByVal 
nSrcHeight As Long, ByVal dwRop As Long) As Long</code><br>
StretchBlt transfers a piece of a graphic image from one object to another. You can resize 
the dimensions as well as change the size of the chunk. You have to do a manual refresh of 
the target object (using the <i>object</i>.Refresh method) for the changed image to appear 
on the screen. You can safely ignore the value returned. </p>

<table WIDTH="95%" CELLSPACING="0" BORDER="2">
  <tr>
    <td WIDTH="20%"><code>hdc</code></td>
    <td WIDTH="80%">The device context of the target object. </td>
  </tr>
  <tr>
    <td><code>x</code></td>
    <td>The x coordinate to use as the upper-left corner of the graphic chunk in the target. </td>
  </tr>
  <tr>
    <td><code>y</code></td>
    <td>The y coordinate to use as the upper-left corner of the graphic chunk in the target. </td>
  </tr>
  <tr>
    <td><code>nWidth</code></td>
    <td>The width of the graphic chunk in pixels in the target object. </td>
  </tr>
  <tr>
    <td><code>nHeight</code></td>
    <td>The height of the graphic chunk in pixels in the target object. </td>
  </tr>
  <tr>
    <td><code>hSrcDC</code></td>
    <td>The device context of the source object. </td>
  </tr>
  <tr>
    <td><code>xSrc</code></td>
    <td>The x coordinate of the upper-left corner of the graphic chunk in the source. </td>
  </tr>
  <tr>
    <td><code>ySrc</code></td>
    <td>The y coordinate of the upper-left corner of the graphic chunk in the source. </td>
  </tr>
  <tr>
    <td><code>nSrcWidth</code></td>
    <td>The width of the chunk in the source object. </td>
  </tr>
  <tr>
    <td><code>nSrcWidth</code></td>
    <td>The height of the chunk in the source object. </td>
  </tr>
  <tr>
    <td><code>dwRop</code></td>
    <td>A <a HREF="appb.html#blt">Blt flag</a> telling how to transfer the image. </td>
  </tr>
</table>
<b>

<p>Example:</b><br>
<code>&nbsp;&nbsp;'Copy part of picSource to picTarget, doubling both width and height<br>
&nbsp;&nbsp;x = StretchBlt(picTarget.hdc, 0, 0, 64, 64, picSource.hdc, 0, 0, 32, 32, 
SRCCOPY)<br>
&nbsp;&nbsp;picTarget.Refresh</code><br>
<br>
<b>Related Call:</b> <a HREF="b.html#bitblt">BitBlt</a><br>
<b>Category:</b> <a HREF="index.html#graphics" REL="Index">Graphics</a><br>
<a HREF="index.html" REL="Index">返回到索引.</a> </p>

<hr ALIGN="center" WIDTH="85%" SIZE="5">

<p ALIGN="left"><a NAME="subtractrect"></a></p>

<h3 ALIGN="center">SubtractRect Function</h3>
<code>

<p align="center">Declare Function SubtractRect Lib &quot;user32.dll&quot; lprcDst As <a
HREF="appa.html#rect">RECT</a>, lprcSrc1 As <a HREF="appa.html#rect">RECT</a>, lprcSrc2 As 
<a HREF="appa.html#rect">RECT</a>) As Long</code><br>
<br>
SubtractRect subtracts a smaller rectangle from a larger one. This is kind of difficult to 
visualize. The large and small rectangles must intersect completely along one entire side, 
and neither may extend farther along this side. In other words, they share a common side. 
Now you see that all of the large rectangle not part of the small rectangle is also a 
rectangle. This is the rectangle that is defined as the subtraction of the small from the 
large. If the small rectangle fails to meet these criteria, the subtracted rectangle is 
set equal to the large rectangle and the function returns 0. If the subtraction is 
possible, the function returns 1.<br>
</p>

<table WIDTH="95%" BORDER="2" CELLSPACING="0">
  <tr>
    <td WIDTH="20%"><code>lprcDst</code></td>
    <td WIDTH="80%">The rectangle to be set as the subtraction of the small rectangle from the 
    large one. </td>
  </tr>
  <tr>
    <td><code>lprcSrc1</code></td>
    <td>The large rectangle; that is, the rectangle subtracted from. </td>
  </tr>
  <tr>
    <td><code>lprcSrc2</code></td>
    <td>The small rectangle; that is, the rectangle subtracted. </td>
  </tr>
</table>
<b>

<p>Example:</b><br>
<code>&nbsp;&nbsp;'big.Left = 50, .Top = 50, .Right = 150, .Bottom = 100<br>
&nbsp;&nbsp;'small.Left = 50, .Top = 50, .Right = 100, .Bottom = 100<br>
&nbsp;&nbsp;Dim target As RECT, big As RECT, small As RECT<br>
&nbsp;&nbsp;x = SetRect(big, 50, 50, 150, 100)<br>
&nbsp;&nbsp;x = SetRect(small, 50, 50, 100, 100)<br>
&nbsp;&nbsp;x = SubtractRect(target, big, small) 'target = big - small<br>
&nbsp;&nbsp;'target.Left = 100, .Top = 50, .Right = 150, .Bottom = 100</code><br>
<br>
<b>Related Calls:</b> <a HREF="i.html#intersectrect">IntersectRect</a>, <a
HREF="u.html#unionrect">UnionRect</a><br>
<b>Category:</b> <a HREF="index.html#rectmanipulation" REL="Index">RECT Manipulation</a><br>
<a HREF="index.html" REL="Index">返回到索引.</a> </p>

<hr ALIGN="center" WIDTH="85%" SIZE="5">

<p ALIGN="left"> </p>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -