modFormShowTop.bas 设置窗体是否为顶层显示
作者:parno 日期:2007-02-01
复制内容到剪贴板 程序代码
Attribute VB_Name = "Module1"
'*************************************************
'模块功能:设置窗体是否为顶层显示
'建立日期:2004-9-3
'建 立 者:杨勇 snake_man_y@hotmail.com
'备 注:
'*************************************************
Option Explicit
Private Const HWND_TOPMOST = -1
Private Const SWP_NOACTIVATE = &H10
Private Const SWP_SHOWWINDOW = &H40
Private Const SWP_HIDEWINDOW = &H80
Private Const SWP_NOZORDER = &H4
Private Const SWP_NOMOVE = &H2
Private Const SWP_NOREPOSITION = &H200
Private Const SWP_NOSIZE = &H1
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, _
ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, _
ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
'设置窗体是否为顶层显示
Public Sub FormShowTop(f As Form, Top As Boolean)
If Top Then
SetWindowPos f.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE + SWP_NOSIZE
Else
SetWindowPos f.hwnd, 0, 0, 0, 0, 0, SWP_NOMOVE + SWP_NOSIZE
End If
End Sub
'*************************************************
'模块功能:设置窗体是否为顶层显示
'建立日期:2004-9-3
'建 立 者:杨勇 snake_man_y@hotmail.com
'备 注:
'*************************************************
Option Explicit
Private Const HWND_TOPMOST = -1
Private Const SWP_NOACTIVATE = &H10
Private Const SWP_SHOWWINDOW = &H40
Private Const SWP_HIDEWINDOW = &H80
Private Const SWP_NOZORDER = &H4
Private Const SWP_NOMOVE = &H2
Private Const SWP_NOREPOSITION = &H200
Private Const SWP_NOSIZE = &H1
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, _
ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, _
ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
'设置窗体是否为顶层显示
Public Sub FormShowTop(f As Form, Top As Boolean)
If Top Then
SetWindowPos f.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE + SWP_NOSIZE
Else
SetWindowPos f.hwnd, 0, 0, 0, 0, 0, SWP_NOMOVE + SWP_NOSIZE
End If
End Sub
[本日志由 parno 于 2007-02-01 05:05 PM 编辑]
上一篇: VB中定义全局热键下一篇: 常用 Webdings 字体符号
文章来自: 杨勇
引用通告: 查看所有引用 | 我要引用此文章
Tags: VisualBasic
相关日志:
评论: 0 | 引用: 0 | 查看次数: 6763