重庆分公司,新征程启航
为企业提供网站建设、域名注册、服务器等服务
窗体的 MinButton、MaxButton 属性设为False , 或者设置 BorderStyle属性
创新互联专业为企业提供舞钢网站建设、舞钢做网站、舞钢网站设计、舞钢网站制作等企业网站建设、网页设计与制作、舞钢企业网站模板建站服务,10年舞钢做网站经验,不只是建网站,更提供有价值的思路和整体网络服务。
关闭按钮无效的代码:
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 Const MF_REMOVE = H1000
Private Const SC_CLOSE = HF060
Sub Disabled(ChWnd As Long) '设置窗体关闭按钮不可用的子过程
Dim hMenu, hendMenu As Long
Dim c As Long
hMenu = GetSystemMenu(ChWnd, 0)
RemoveMenu hMenu, SC_CLOSE, MF_REMOVE
End Sub
Private Sub Form_Load()
Disabled Me.hwnd '调用子过程
End Sub
你想一边运行,一边填充数据,我给你出的主意是多线程,用另一个线程来Invoke数据,
Thread和线程Timer(不是Form中的Timer),要是同时访问一块数据注意用
SyncLock锁
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 Const MF_REMOVE = H1000
Private Const SC_COLSE = HF060
Private Const SC_MAXIMIZE = HF030
Private Const SC_MINIMIZE = HF020
Private Sub Form_Load()Sub Form_Load()
RemoveMenu GetSystemMenu(Me.hWnd, 0), SC_COLSE, MF_REMOVE
RemoveMenu GetSystemMenu(Me.hWnd, 0), SC_MAXIMIZE, MF_REMOVE
RemoveMenu GetSystemMenu(Me.hWnd, 0), SC_MINIMIZE, MF_REMOVE
可以通过API函数使关闭按钮失效,也就是当窗体出现时,关闭按钮是不可用的状态。