4个回答
展开全部
'第一种:这下只能在多窗口程序中有效:private
sub
form_deactivate()
msgbox
"失去焦点了"
end
sub
'第二种:要用api:'添加一个定时器,interval设为1000private
declare
function
getactivewindow
lib
"user32"
()
as
long
dim
h
as
long
private
sub
timer1_timer()
h
=
getactivewindow
if
h
<>
me.hwnd
then
msgbox
"失去焦点"
end
if
end
sub
sub
form_deactivate()
msgbox
"失去焦点了"
end
sub
'第二种:要用api:'添加一个定时器,interval设为1000private
declare
function
getactivewindow
lib
"user32"
()
as
long
dim
h
as
long
private
sub
timer1_timer()
h
=
getactivewindow
if
h
<>
me.hwnd
then
msgbox
"失去焦点"
end
if
end
sub
展开全部
//使关闭按钮灰色(不是消失哦)
Private Declare Function GetSystemMenu Lib "User32" (ByVal hwnd As Long, ByVal bRevert As Long) As Long
Private Declare Function RemoveMenu Lib "User32" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long
Private Declare Function DrawMenuBar Lib "User32" (ByVal hwnd As Long) As Long
Private Declare Function GetMenuItemCount Lib "User32" (ByVal hMenu As Long) As Long
Private Const MF_BYPOSITION = &H400&
Private Sub Form_Load()
Dim hMenu As Long, nCount As Long
hMenu = GetSystemMenu(Frm.hwnd, 0)
nCount = GetMenuItemCount(hMenu)
Call RemoveMenu(hMenu, nCount - 1, MF_BYPOSITION)
DrawMenuBar Frm.hwnd
End Sub
Private Declare Function GetSystemMenu Lib "User32" (ByVal hwnd As Long, ByVal bRevert As Long) As Long
Private Declare Function RemoveMenu Lib "User32" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long
Private Declare Function DrawMenuBar Lib "User32" (ByVal hwnd As Long) As Long
Private Declare Function GetMenuItemCount Lib "User32" (ByVal hMenu As Long) As Long
Private Const MF_BYPOSITION = &H400&
Private Sub Form_Load()
Dim hMenu As Long, nCount As Long
hMenu = GetSystemMenu(Frm.hwnd, 0)
nCount = GetMenuItemCount(hMenu)
Call RemoveMenu(hMenu, nCount - 1, MF_BYPOSITION)
DrawMenuBar Frm.hwnd
End Sub
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
窗体的退出键?
是说那个红色的叉叉吗?还是什么?
失去焦点是什么意思?是说不可以点击还是?
哎,,没搞懂你的意思,,不知怎么回答你啊。。
如果要让那个红色的叉叉不可以点击,那得要调用系统API了!
是说那个红色的叉叉吗?还是什么?
失去焦点是什么意思?是说不可以点击还是?
哎,,没搞懂你的意思,,不知怎么回答你啊。。
如果要让那个红色的叉叉不可以点击,那得要调用系统API了!
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
我一般采用 把controlbox改成false隐藏控制按钮
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询