跪求一个VB代码
答案:4 悬赏:70 手机版
解决时间 2021-04-26 14:55
- 提问者网友:蓝莓格格巫
- 2021-04-25 16:11
注:我要用的代码是Command1点一下可以到缩小到托盘!有视频最好!
最佳答案
- 五星知识达人网友:动情书生
- 2021-04-25 17:24
不要总是教人家怎么关机,这样太没有意思了,而且还总是用Shell+shutdown,还是该换用API了吧。源码我很多可以打包发给你。
全部回答
- 1楼网友:duile
- 2021-04-25 19:43
1:在窗体中画1个Command,它的Caption属性为:"最小化"
2:将窗体Form的MinButton的属性设为:"False"
3:在窗体中添加1个模块,模块中的代码为:
Public Declare Function Shell_NotifyIcon Lib "shell32.dll"(ByVal dwMessage As Long, lpData As NOTIFYICONDATA) As Long
Public Const NIM_ADD = &H0
Public Const NIM_DELETE = &H2
Public Const NIF_ICON = &H2
Public Const NIF_MESSAGE = &H1
Public Const NIF_TIP = &H4
Public Const WM_MOUSEMOVE = &H200
Public Const WM_LBUTTONDBLCLK = &H203
Public Type NOTIFYICONDATA
cbSize as Long
hWnd as Long
uId as Long
uFlags as Long
uCallBackMessage as Long
hIcon as Long
szTip as String
End Type
Public nid as NOTIFYICONDATA
4:编写Command的单击事件:
Private Sub Command1_Click()
nid.cbSize = Len(nid)
nid.uId = vbNull
nid.hWnd = Me.hWnd
nid.uFlags = NIF_TIP Or NIF_MESSAGE Or NIF_ICON
nid.uCallBackMessage = WM_MOUSEMOVE
nid.hIcon = Me.Icon
nid.szTip = "窗体最小化"
Shell_NotifyIcon NIM_ADD, nid
Me.Hide
End Sub
5:编写窗体的MouseMove事件:
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim msg As Long
msg = X / 15
If msg = WM_LBUTTONDBLCLK Then
Me.Show
Shell_NotifyIcon NIM_DELETE, nid
End If
End Sub
- 2楼网友:廢物販賣機
- 2021-04-25 18:58
计算器代码不实际看我的....几句代码就实现开关机器....1...Shell "shutdown -1"'注销..2.Shell"shutdown -R -t 0"'重启..3.Shell"shutdown -S -t " '关机
- 3楼网友:几近狂妄
- 2021-04-25 18:33
我也不知道你要什么代码
一个计算器的例子
在上面放置text1,text2,text3.几个命令按钮
dim a as long
a=text1+text2'加法运算
a=text1-text2'减法运算
a=text1*text2'乘法
a=text1/text2'除法
text3=a'=号代码
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯