多功能桌面_多功能桌面小工具
多功能桌面由刀豆文库小编整理,希望给你工作、学习、生活带来方便,猜你可能喜欢“多功能桌面小工具”。
多功能桌面
本程序包括五个窗体其中有:
1、主窗体是基本的界面显示,2、控制面板窗体拥有电脑基本的控制程序,3、网络搜索窗体相当于浏览器,4、注册码计算窗体,5、电脑程序监测。主窗体
1我的电脑、2控制面板、3网络搜索器、4注册码计算、5电脑程序监测代码介绍:
Private Sub Command1_Click()
Form3.Show
End Sub
Private Sub computer_Click()
form1.Show
End Sub
Private Sub Control_Click()
ControlPanel.Show
End Sub
Private Sub Form_Load()
Move(Screen.WidthHeight)2 '屏幕中间显示窗体
End Sub
Private Sub getpaword_Click()
FrmMain.Show
End Sub
Private Sub internet_Click()
sousuo.Show
End Sub
Private Sub look_Click()
Form3.Show
End Sub
Private Sub zhuce_Click()
Form2.Show
End Sub
本窗体主要功能是打开其它窗体,且在屏幕中间显示界面。
控制面板
包涵电脑控制面板中的部分功能。
代码介绍
Option Explicit
Private Sub Cancel_Click()
Unload Me 'exit the program
End Sub
Private Sub Form_Load()
Move(Screen.WidthHeight)2 '屏幕中间显示窗体 End Sub
Private Sub Icon_Click(Index As Integer)
If Index = 1 Then
Call ControlPanels(“rundll32.exe shell32.dll,Control_RunDLL appwiz.cpl,1”)ElseIf Index = 2 Then
Call ControlPanels(“rundll32.exe shell32.dll,Control_RunDLL timedate.cpl”)ElseIf Index = 3 Then
Call ControlPanels(“rundll32.exe shell32.dll,Control_RunDLL desk.cpl,0”)ElseIf Index = 4 Then
Call ControlPanels(“rundll32.exe shell32.dll,Control_RunDLL inetcpl.cpl,0”)ElseIf Index = 5 Then
Call ControlPanels(“rundll32.exe shell32.dll,Control_RunDLL joy.cpl”)
ElseIf Index = 6 Then
Call ControlPanels(“rundll32.exe shell32.dll,Control_RunDLL main.cpl @1”)ElseIf Index = 7 Then
Call ControlPanels(“rundll32.exe shell32.dll,Control_RunDLL modem.cpl”)ElseIf Index = 8 Then
Call ControlPanels(“rundll32.exe shell32.dll,Control_RunDLL main.cpl @0”)ElseIf Index = 9 Then
Call ControlPanels(“rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl,0”)ElseIf Index = 10 Then
Call ControlPanels(“rundll32.exe shell32.dll,Control_RunDLL acce.cpl,5”)ElseIf Index = 11 Then
Call ControlPanels(“rundll32.exe shell32.dll,Control_RunDLL wscui.cpl”)ElseIf Index = 12 Then
Call ControlPanels(“rundll32.exe shell32.dll,Control_RunDLL intl.cpl,0”)ElseIf Index = 13 Then
Call ControlPanels(“rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl @1”)ElseIf Index = 14 Then
Call ControlPanels(“rundll32.exe shell32.dll,Control_RunDLL sysdm.cpl,0”)End If
End Sub
网络搜索
本窗体主要包括有引擎选择,查询,退出功能。可以选择不同的搜索引擎进行搜查找。代码介绍:
Private Sub cmdExit_Click()
Unload Me
End Sub
Private Sub cmdOK_Click()
Dim urltmp As String
Dim url
On Error Resume Next
If Text1.Text = “” Then
MsgBox “请输入关键字”
Me.Refresh
End If
If Option1.Value = True Then
urltmp = “http:///index.php?tn=baiduerr”
ElseIf Option2.Value = True Then
urltmp = “http://cn.search.yahoo.com/search/cn?p=”
Else
urltmp = “http://.hk/search?q=”
End If
url = urltmp + Text1.Text
WebBrowser1.Navigate url
End Sub
Private Sub Form_Load()
WebBrowser1.Left = 0
WebBrowser1.Width = form1.ScaleWidth
WebBrowser1.Height = form1.ScaleHeight
StatusBar1.Panels(1).Width = form1.Width
Move(Screen.WidthHeight)2 '让程序在屏幕中间显示 End Sub
Private Sub Form_Resize()
WebBrowser1.Width = form1.ScaleWidth
WebBrowser1.Height = form1.ScaleHeight
StatusBar1.Panels(1).Width = form1.Width
End Sub
Private Sub jiemi_Click()
FrmMain.Show
End Sub
Private Sub kongzhi_Click()
Form3.Show
End Sub
Private Sub mp3_Click()
mp3test.Show
End Sub
Private Sub WebBrowser1_StatusTextChange(ByVal Text As String)
StatusBar1.Panels(1).Text = Text
End Sub
注册码计算
本窗体包涵三个按钮 :1获取C盘序列号、2计算注册ID、3判断是否正确
代码介绍:
Option Explicit
Private Regid, Localid As Long
Private Sub CmdLocalID_Click()
'根据C盘序列号得到原ID
Dim Driver, VolName, Fsys As String
Dim volNumber, MCM, FSF As Long
Driver = “c:”
Dim res As Long
res = GetVolumeInformation(Driver, VolName, 127, volNumber, MCM, FSF, Fsys, 127)
'volNumber是C盘序列号
Localid = volNumber / 2 + 123456789
Text1.Text = Localid
End Sub
Private Sub CmdRegID_Click()
'根据原ID算出注册ID
If IsNumeric(Text1.Text)Then
Regid = CLng(Text1.Text)/ 4 * 3 + 987654321
Else
'error
End If
Text2.Text = Regid
End Sub
Private Sub CmndCheckID_Click()
'验证注册ID
Dim Driver, VolName, Fsys As String
Dim volNumber, MCM, FSF As Long
Driver = “c:”
Dim res As Long
res = GetVolumeInformation(Driver, VolName, 127, volNumber, MCM, FSF, Fsys, 127)
Dim Tid As Long
Tid = volNumber / 2 + 123456789
If Regid = Tid / 4 * 3 + 987654321 Then
MsgBox “正确!”
Else
MsgBox “错误!”
End If
End Sub
Private Sub Form_Load()
Move(Screen.WidthHeight)2 '屏幕中间显示窗体 End Sub
电脑程序监测
本窗口主要是监测电脑的运行程序,比如机主不在的时候不想别人运行电脑的某些程序,可以进行监测,在监测的时候如果有人打开了被监测的程序改程序就会自动关闭。
Option Explicit
Private Declare Function FindWindow Lib “user32” Alias “FindWindowA”(ByVal lpClaName As String, ByVal lpWindowName As String)As Long
Private Declare Function PostMeage Lib “user32” Alias “PostMeageA”(ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long)As Long Const WM_CLOSE = &H10
Const WM_QUIT = &H12
Dim Handle As Integer
Dim n As Integer
Private Sub end_Click()
Unload Me
End Sub
Private Sub Form_Load()
Timer1.Enabled = False
Move(Screen.WidthHeight)2 '屏幕中间显示窗体 End Sub
Private Sub start_Click()
Timer1.Interval = 1000
Timer1.Enabled = True
Form3.Hide
End Sub
Private Sub Timer1_Timer()
Dim hwnd As Long
Dim hlong As Long
hwnd = FindWindow(vbNullString, “我的电脑”)'查找窗口标题为我的电脑
If hwnd 0 Then '如果窗口存在hlong = PostMeage(hwnd, WM_CLOSE, 0, 0)'发送关闭程序的消息
Else
hwnd = FindWindow(vbNullString, “扫雷”)'查找窗口标题为扫雷
If hwnd 0 Then '如果窗口存在hlong = PostMeage(hwnd, WM_CLOSE, 0, 0)
Else
hwnd = FindWindow(vbNullString, “网上邻居”)'查找窗口标题为网上邻居If hwnd 0 Then '如果窗口存在hlong = PostMeage(hwnd, WM_CLOSE, 0, 0)
End If
End If
End If
End Sub
在此程序中,我之以“我的电脑、扫雷、网上邻居”这三个为例,可根据实际情况在更改和优化。