2280.html
来自「VB技巧问答10000例 VB技巧问答10000例」· HTML 代码 · 共 22 行
HTML
22 行
<html>
<head>
<title>Re: 使用 SetWindowPos API</title>
</head>
<BODY BACKGROUND="" BGCOLOR="white" TEXT="black" LINK="red" VLINK="#808080" ALINK="">
<center>
<h1>Re: 使用 SetWindowPos API</h1>
</center>
<HR><p>
Posted by <a href="mailto:h_c_chan@hotmail.com">陈凯程</a> on March 15, 1998 at 23:50:35:<p>
In Reply to: <a href="2250.html"><b>How to make </b></a> posted by Rpg之鬼 on March 14, 1998 at 01:51:40:<p>
Option Explicit<p>Private Declare Function SetWindowPos _<br>Lib "user32" ( _<br> ByVal hwnd As Long, _<br> ByVal hWndInsertAfter As Long, _<br> ByVal x As Long, _<br> ByVal y As Long, _<br> ByVal cx As Long, _<br> ByVal cy As Long, _<br> ByVal wFlags As Long _<br>) As Long<p>Private Const HWND_TOPMOST = -1<br>Private Const HWND_NOTOPMOST = -2<br>Private Const SWP_NOSIZE = &H1<br>Private Const SWP_NOMOVE = &H2<p>Public Sub SetOnTop(frm As Form, Topmost As Boolean)<br> If Topmost Then<br> SetWindowPos frm.hwnd, HWND_TOPMOST, 0, 0, 0, _<br> 0, SWP_NOSIZE Or SWP_NOMOVE<br> Else<br> SetWindowPos frm.hwnd, HWND_NOTOPMOST, 0, 0, 0, _<br> 0, SWP_NOSIZE Or SWP_NOMOVE<br> End If<br>End Sub<p>将以上的程式码放在一个 Module 中,在 Form_Load 中输入:<p>SetOnTop Me, True<p>这样便可以将 Form "Always On Top" 了!
<br>
<p>
<a name="followups">Follow Ups:</a><br>
<ul><!--insert: 2280-->
</ul><!--end: 2280-->
<br><HR><p>
</body></html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?