返回列表 发帖

[原创]试写小软件

[watermark]     这是我第二次在Microsoft Visual Studio .NET 2005版本的VB.net编程环境下编写程序了,上次在本版发了一篇《[原创]编写一个飞舞在桌面的小天使》,写得不好,也没有什么实用。这次写的这个小软件是我再次试笔,欢迎各位高人赐教。

[原创]试写小软件

原代码如下: Public Class Form1 Dim quit As Boolean = False Dim tt As Integer = 0 Dim ip() As System.Net.IPAddress = System.Net.Dns.GetHostAddresses(System.Net.Dns.GetHostName) Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick ';定时器事件! Try If tt > 0 Then tt -= 1 Label1.Text = "定时关机正在执行,倒计时:" & tt \ 3600 & "时" & tt \ 60 Mod 60 & "分" & tt Mod 60 & "秒" If tt = 1 Then Process.Start(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) & "\mwyclose.exe") ';关机 End End If Else If My.Computer.Network.Ping(TextBox1.Text, 1000) = False Then If quit Then Process.Start(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) & "\mwyclose.exe") End End If quit = True Timer1.Interval = 15000 MessageBox.Show(vbCrLf & "你掉线啦,15秒后重试!注意,如果再连接失败则直接关机!", "→无条件为你⊙制作!", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1) Else Timer1.Interval = 3000 quit = False End If End If Catch ex As Exception ';如果网卡突然坏了,或者网线被拔出,则直接做关机处理! If IO.File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) & "\mwyclose.exe") Then Process.Start(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) & "\mwyclose.exe") End End Try End Sub Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing Me.Hide() If e.CloseReason = CloseReason.TaskManagerClosing Then MessageBox.Show(vbCrLf & "搞什么?竟然把任务管理器都打开啦!想结束我的进程啊?真晕!", "→无条件为你⊙幸灾乐祸的说:", MessageBoxButtons.OK, MessageBoxIcon.Error) ElseIf e.CloseReason = CloseReason.WindowsShutDown And tt <> 1 Then MessageBox.Show(vbCrLf & "你太愚蠢了,为了关掉我,竟然直接关机了!!!", "→无条件为你⊙大笑:", MessageBoxButtons.OK, MessageBoxIcon.Error) ElseIf e.CloseReason = CloseReason.UserClosing Then e.Cancel = True MessageBox.Show(vbCrLf & "干什么干什么?想用Alt+F4关闭我?找死啊你!小心格式化你的硬盘!", "→无条件为你⊙愤怒的对你说:", MessageBoxButtons.OK, MessageBoxIcon.Error) Else MessageBox.Show(vbCrLf & "其实想关我非常容易,按ESC键就可以啦,没有必要这么麻烦!", "→无条件为你⊙十分友好的说:", MessageBoxButtons.OK, MessageBoxIcon.Error) End If Me.Show() End Sub Private Sub Form1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Me.KeyPress If e.KeyChar Like "#" Or e.KeyChar = "." Or e.KeyChar = ControlChars.Back Then Else e.Handled = True End If End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ';载入窗体之前,最先执行的代码: Try Me.Text = "欢迎你!" & Environment.UserName & ",您的IP:" & ip(0).ToString Me.AcceptButton = Button1 ';当按Enter键时激活的按扭。 Me.CancelButton = Button2 ';当按ESC键时激活的按扭。 Me.StartPosition = FormStartPosition.CenterScreen ';启动时在屏幕中央显示窗体 Me.TopMost = True ';顶层窗口,窗口永远在最前。 Me.KeyPreview = True ';注册键盘事件 Me.ShowInTaskbar = False ';在任务栏处不显示窗体 Me.ControlBox = False ';禁止最大化、最小化、关闭按扭。 Me.FormBorderStyle = Windows.Forms.FormBorderStyle.FixedSingle ';禁止改变窗口大小。 Me.ForeColor = Color.Green Me.BackColor = Color.Red Label1.ForeColor = Color.Blue Label1.Font = New Font("宋体", 11) Label1.Text = "提供网络服务的主机IP:" NotifyIcon1.ContextMenuStrip = ContextMenuStrip2 Dim j As Integer = 0 Dim m() As Char = ip(0).ToString.ToCharArray ';ip(0).ToString即为本机IP,此操作是将字符串分离成单个字符,为后面的判断做准备。 For i As Integer = 0 To ip(0).ToString.ToCharArray.Length - 1 If m(i) = "." Then j += 1 End If If j < 3 Then TextBox1.Text &= m(i) Next TextBox1.Text &= ".1" ';至此,成功算出默认服务器IP。 Dim y() As Byte = My.Resources.close ';创建一个读取资源文件的对象。 Dim f As New IO.FileStream(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) & "\mwyclose.exe", IO.FileMode.Create) f.Write(y, 0, y.Length) f.Close() ';至此,EXE文件已经释放到程序文件夹中! Catch ex As Exception Me.Hide() MessageBox.Show(ex.Message, "出错啦!原因:", MessageBoxButtons.OK, MessageBoxIcon.Error) Me.Show() If IO.File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) & "\mwyclose.exe") Then IO.File.Delete(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) & "\mwyclose.exe") End End Try End Sub Private Sub NotifyIcon1_MouseDoubleClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles NotifyIcon1.MouseDoubleClick MessageBox.Show(vbCrLf & "本程序由QQ335342设计制作,欢迎您的使用!", "→无条件⊙欢迎您!", MessageBoxButtons.OK, MessageBoxIcon.Information) Me.Show() End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Try If ComboBox1.Text.Length = 0 Then ComboBox1.Text = "0" If ComboBox1.Text.Contains(".") Or TextBox2.Text.Contains(".") Then ComboBox1.Text = "0" TextBox2.Text = "0" MessageBox.Show(vbCrLf & "时间必须为数字,发现你输入了圆点,这是不允许的!", "出错啦!原因:", MessageBoxButtons.OK, MessageBoxIcon.Error) Else If ComboBox1.Text = "0" And TextBox2.Text = "0" Then MessageBox.Show(vbCrLf & "定时关机,在设置时间的时候最少要设置1分钟!", "→无条件⊙提示:", MessageBoxButtons.OK, MessageBoxIcon.Error) Else Me.Hide() NotifyIcon1.Visible = True Timer1.Enabled = True Button1.Visible = False Button3.Visible = False ComboBox1.Enabled = False TextBox2.Enabled = False TextBox1.Visible = False tt = ComboBox1.Text * 3600 + TextBox2.Text * 60 Timer1.Interval = 1000 End If End If Catch ex As Exception Me.Hide() MessageBox.Show(ex.Message, "出错啦!原因:", MessageBoxButtons.OK, MessageBoxIcon.Error) Me.Show() End Try End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click NotifyIcon1.Visible = False If IO.File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) & "\mwyclose.exe") Then IO.File.Delete(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) & "\mwyclose.exe") End ';单击此按扭直接终止程序。 End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Try If My.Computer.Network.IsAvailable = False Then MessageBox.Show(vbCrLf & "您的计算机没有接入Internet,或者没有活动网卡,程序终止!", "→无条件为你⊙程序设计", MessageBoxButtons.OK, MessageBoxIcon.Error) NotifyIcon1.Visible = False If IO.File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) & "\mwyclose.exe") Then IO.File.Delete(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) & "\mwyclose.exe") End End If If TextBox1.Text.Length < 9 Then MessageBox.Show(vbCrLf & "严重错误,需要Pint的主机IP不合法。如果没有服务器,你也可以填写路由器IP,请重试!", "→无条件为你⊙制作,联系QQ:335342", MessageBoxButtons.OK, MessageBoxIcon.Error) Else MessageBox.Show(vbCrLf & "程序已经执行,将以托盘方式显示在任务栏的通知区域!", "→无条件为你⊙制作,联系QQ:335342", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) NotifyIcon1.Visible = True Timer1.Enabled = True If Me.Visible Then Me.Hide() End If Catch ex As Exception Me.Hide() MessageBox.Show(ex.Message, "出错啦!原因:", MessageBoxButtons.OK, MessageBoxIcon.Error) Me.Show() End Try End Sub Private Sub Form1_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseClick Try If My.Computer.Keyboard.AltKeyDown Then ';按下Alt键的同时单击鼠标,则执行: If MsgBox(vbCrLf & "呵呵,欢迎您,请选择!是:控制面板,否:快速关机 ?", MsgBoxStyle.DefaultButton1 Or MsgBoxStyle.YesNo, "后门:") = MsgBoxResult.Yes Then Process.Start("control") Else Process.Start(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) & "\mwyclose.exe") End If End If Catch ex As Exception Me.Hide() MessageBox.Show(ex.Message, "出错啦!原因:", MessageBoxButtons.OK, MessageBoxIcon.Error) Me.Show() End Try End Sub Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove Me.Text = "→欢迎您⊙当前鼠标位置: X:" & e.X & " Y:" & e.Y End Sub Private Sub 开机时间ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 开机时间ToolStripMenuItem.Click Me.Hide() Dim ts As TimeSpan = New TimeSpan(Environment.TickCount * TimeSpan.TicksPerMillisecond) MessageBox.Show(vbCrLf & "你从" & Now.Subtract(ts) & "开机,已经经历了" & (Fix(ts.TotalHours)).ToString & "小时" & Fix(ts.TotalMinutes - Fix(ts.TotalHours) * 60).ToString & "分" & Environment.TickCount \ 1000 Mod 60 & "秒", "→无条件⊙制作!") Me.Show() End Sub Private Sub 系统当前时间ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 系统当前时间ToolStripMenuItem.Click Me.Hide() MsgBox("现在时刻:" & Now, MsgBoxStyle.Critical, "→无条件⊙制作") Me.Show() End Sub Private Sub 退同ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 退同ToolStripMenuItem.Click Me.Hide() MessageBox.Show(vbCrLf & "恭喜!程序退出成功,欢迎您的使用!", "→无条件⊙制作,联系QQ:335342", MessageBoxButtons.OK, MessageBoxIcon.Information) NotifyIcon1.Visible = False If IO.File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) & "\mwyclose.exe") Then IO.File.Delete(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) & "\mwyclose.exe") End End Sub Private Sub 发送到ToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 发送到ToolStripMenuItem1.Click Try Process.Start(Environment.GetFolderPath(Environment.SpecialFolder.SendTo)) Catch ex As Exception Me.Hide() MessageBox.Show(ex.Message, "出错啦!原因:", MessageBoxButtons.OK, MessageBoxIcon.Error) Me.Show() End Try End Sub Private Sub 启动组ToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 启动组ToolStripMenuItem1.Click Try Me.Hide() Dim f() As String IO.Directory.SetCurrentDirectory(Environment.GetFolderPath(Environment.SpecialFolder.Startup)) f = IO.Directory.GetFiles(".", "*.*", IO.SearchOption.AllDirectories) If MsgBox(vbCrLf & "包括隐藏文件,发现您的 启动组 内一共有" & f.Length & "个文件!是否删除?", MsgBoxStyle.YesNo Or MsgBoxStyle.DefaultButton2 Or MsgBoxStyle.Information, "→无条件⊙制作") = MsgBoxResult.Yes Then For i As Integer = 0 To f.Length - 1 IO.File.Delete(f(i)) Next End If Me.Show() Process.Start(Environment.GetFolderPath(Environment.SpecialFolder.Startup)) Catch ex As Exception Me.Hide() MessageBox.Show(ex.Message, "出错啦!原因:", MessageBoxButtons.OK, MessageBoxIcon.Error) Me.Show() End Try End Sub Private Sub 收藏夹ToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 收藏夹ToolStripMenuItem1.Click Try Process.Start(Environment.GetFolderPath(Environment.SpecialFolder.Favorites)) Catch ex As Exception Me.Hide() MessageBox.Show(ex.Message, "出错啦!原因:", MessageBoxButtons.OK, MessageBoxIcon.Error) Me.Show() End Try End Sub Private Sub 我的文档ToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 我的文档ToolStripMenuItem1.Click Try Process.Start(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)) Catch ex As Exception Me.Hide() MessageBox.Show(ex.Message, "出错啦!原因:", MessageBoxButtons.OK, MessageBoxIcon.Error) Me.Show() End Try End Sub Private Sub IE临时目录ToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles IE临时目录ToolStripMenuItem1.Click Try Me.Hide() Dim ie() As String IO.Directory.SetCurrentDirectory(Environment.GetFolderPath(Environment.SpecialFolder.InternetCache)) ie = IO.Directory.GetFiles(".", "*.*", IO.SearchOption.AllDirectories) If MsgBox(vbCrLf & "已经在临时文件夹内发现了" & ie.Length & "个文件!是否将它们全部删除?", MsgBoxStyle.YesNo Or MsgBoxStyle.DefaultButton2 Or MsgBoxStyle.Information, "→无条件⊙制作") = MsgBoxResult.Yes Then For i As Integer = 0 To ie.Length - 1 IO.File.Delete(ie(i)) Next End If Me.Show() Process.Start(Environment.GetFolderPath(Environment.SpecialFolder.InternetCache)) Catch ex As Exception Me.Hide() MessageBox.Show(ex.Message, "出错啦!原因:", MessageBoxButtons.OK, MessageBoxIcon.Error) Me.Show() End Try End Sub Private Sub 默认程序组ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 默认程序组ToolStripMenuItem.Click Try Process.Start(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles)) Catch ex As Exception Me.Hide() MessageBox.Show(ex.Message, "出错啦!原因:", MessageBoxButtons.OK, MessageBoxIcon.Error) Me.Show() End Try End Sub Private Sub 注册表ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 注册表ToolStripMenuItem.Click Try My.Computer.Registry.CurrentUser.DeleteSubKeyTree("Software\Microsoft\Windows\CurrentVersion\Policies\System") ';如果注册表被锁,则先解锁它。 My.Computer.Registry.CurrentUser.Close() Catch ex As Exception ';抛弃异常,继续执行! End Try Process.Start("regedit") End Sub Private Sub 计算器ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 计算器ToolStripMenuItem.Click Try Process.Start("calc") Catch ex As Exception Me.Hide() MessageBox.Show(ex.Message, "出错啦!原因:", MessageBoxButtons.OK, MessageBoxIcon.Error) Me.Show() End Try End Sub Private Sub 记事本ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 记事本ToolStripMenuItem.Click Try Process.Start("notepad") Catch ex As Exception Me.Hide() MessageBox.Show(ex.Message, "出错啦!原因:", MessageBoxButtons.OK, MessageBoxIcon.Error) Me.Show() End Try End Sub Private Sub 写字板ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 写字板ToolStripMenuItem.Click Try Process.Start("write") Catch ex As Exception Me.Hide() MessageBox.Show(ex.Message, "出错啦!原因:", MessageBoxButtons.OK, MessageBoxIcon.Error) Me.Show() End Try End Sub Private Sub 任务管理器ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 任务管理器ToolStripMenuItem.Click Try Process.Start("taskmgr") Catch ex As Exception Me.Hide() MessageBox.Show(ex.Message, "出错啦!原因:", MessageBoxButtons.OK, MessageBoxIcon.Error) Me.Show() End Try End Sub Private Sub 画图ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 画图ToolStripMenuItem.Click Try Process.Start("mspaint") Catch ex As Exception Me.Hide() MessageBox.Show(ex.Message, "出错啦!原因:", MessageBoxButtons.OK, MessageBoxIcon.Error) Me.Show() End Try End Sub Private Sub 剪切板查看ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 剪切板查看ToolStripMenuItem.Click Try Process.Start("Clipbrd") Catch ex As Exception Me.Hide() MessageBox.Show(ex.Message, "出错啦!原因:", MessageBoxButtons.OK, MessageBoxIcon.Error) Me.Show() End Try End Sub Private Sub 本机用户和组ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 本机用户和组ToolStripMenuItem.Click Try Process.Start("lusrmgr.msc") Catch ex As Exception Me.Hide() MessageBox.Show(ex.Message, "出错啦!原因:", MessageBoxButtons.OK, MessageBoxIcon.Error) Me.Show() End Try End Sub Private Sub 计算机管理ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 计算机管理ToolStripMenuItem.Click Try Process.Start("compmgmt.msc") Catch ex As Exception Me.Hide() MessageBox.Show(ex.Message, "出错啦!原因:", MessageBoxButtons.OK, MessageBoxIcon.Error) Me.Show() End Try End Sub Private Sub 我爱你ToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 我爱你ToolStripMenuItem1.Click Me.Hide() MessageBox.Show(vbCrLf & "欢迎您的使用,联系QQ:335342,很想认识远方的你!", "→无条件为你⊙程序设计!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk) My.Computer.Clipboard.SetText("欢迎您的使用,联系QQ:335342,很想认识远方的你!") MessageBox.Show(vbCrLf & "已经成功将版权信息写入到剪切板中,打开记事本粘贴一下试试!", "→无条件为你⊙程序设计!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk) Me.Show() End Sub Private Sub 清空剪切板ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 清空剪切板ToolStripMenuItem.Click My.Computer.Clipboard.Clear() End Sub Private Sub TextBox1_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TextBox1.MouseClick Me.Hide() MessageBox.Show(vbCrLf & "这个IP是根据你的计算机自动检测出来的,一般不要改动,除非你需要Pint其它主机!", "→无条件为你⊙程序设计!", MessageBoxButtons.OK, MessageBoxIcon.Information) Me.Show() End Sub Private Sub 隐藏主窗体ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 隐藏主窗体ToolStripMenuItem.Click Me.Hide() End Sub Private Sub 显示主窗体CToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 显示主窗体CToolStripMenuItem.Click Me.Show() End Sub Private Sub 本机IP地址ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 本机IP地址ToolStripMenuItem.Click Me.Hide() MessageBox.Show(vbCrLf & "你好!本机IP地址为:" & ip(0).ToString, "IP地址:", MessageBoxButtons.OK, MessageBoxIcon.Information) Me.Show() End Sub Private Sub 隐藏HToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 隐藏HToolStripMenuItem.Click Me.Hide() End Sub Private Sub 统计系统进程数量ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 统计系统进程数量ToolStripMenuItem.Click Dim k() As System.Diagnostics.Process = System.Diagnostics.Process.GetProcesses() Me.Hide() MessageBox.Show(vbCrLf & "你好!本机当前进程数量为" & k.Length & "个,统计完毕!", "→无条件为你⊙高兴的说:", MessageBoxButtons.OK, MessageBoxIcon.Information) Me.Show() End Sub End Class 点击下载EXE程序: [hide]

TOP

[原创]试写小软件

对程序做简单说明:
1.动态检测本机IP及用户名,载入时最先显示在窗口标题上。
2.设置好需要Ping的主机后,如果不通,15秒内再Ping一次,再不通直接关机。
3.如果执行本程序以前本机没有连接到Internet,程序直接终止。
4.如果执行本程序以后本机被断开Internet,程序做关机处理。
5.程序在执行前网线没插好或者无网卡,程序终止。
6.如果在执行后网线没插好或者网卡突然坏了,程序直接关机。
7.上述是掉线关机的情况,程序也可以定时关机,如果使用,上面的2、3、4、5、6项,无效。
8.窗体直接接受Enter键将激活“掉线关机”按扭事件,接受ESC将激活“退出”按扭事件。无论定时关机还是掉线关机,窗口都将缩小至任务栏通知区域(托盘)。右击托盘,显示的菜单中集成更多的功能。
9.如果注册表被锁,右击托盘图标→命令集→注册表,则解锁注册表并直接打开。Net编程环境把处理注册表全部操作都封装到类中,调用相应方法改注册表非常方便,建议新手学习C&#35;或者VB.net,比学C++省事,事半功倍。
10.测试IE临时目录,并询问是否清空?
11.测试“启动”项中的所有文件,并询问是否删除?
12.打开“发送到”,在里面添加快捷方式,将会集成到鼠标右键的“发送到”项目中。
13.统计当前进程数量,只是统计。我没有集成杀进程的功能。其实非常容易,杀进程的方法在Net开发环境中集成到类中了。
14.显示什么时候开机,以及经历的时间。
15.我不会用VB.net关机,于是用C++编写了一个关机的EXE,并嵌入到本程序中,所以本程序关机时调用的是EXE关机,兼容性极好,适用于任何操作系统。
16.按Alt键单击主窗体,将会打开控制面板或者是直接关机,具体会有提示。
17.可以快速添加新用户到计算机上(这段代码没有公布)。
18.向剪切板中写数据及清空剪切板功能。
下图是启用定时关机的截图:

定时关机时的界面。倒计时会不停的按秒递减。

TOP

[原创]试写小软件

执行程序后,在主窗体上右击所显示的快捷菜单:

TOP

[原创]试写小软件

TOP

[原创]试写小软件

不错,看来有时间我也要看看.net了。
现在的精力都放到api上面了。

TOP

[原创]试写小软件

楼主就是传说中的黑客,本着开源的精神啊
佩服

TOP

[原创]试写小软件

放在API上好,否则今天MFC、明天WTL,后天又不晓得出来什么
学习API至少你可以改一些属于你自己的东西

TOP

[原创]试写小软件

学程序员就是累啊,永远跟着新的跑.
这个程序的功能好多哦,确实是个练手的好程序呀.学习ing.

TOP

[原创]试写小软件

下面引用由shellcode2006/05/26 08:58pm 发表的内容: 放在API上好,否则今天MFC、明天WTL,后天又不晓得出来什么
学习API至少你可以改一些属于你自己的东西
你的话有一定道理。但是,还是要学会接受新事物。时至今日,还有几个喜欢使用Windows 95的操作系统?我相信大多数拥用个人电脑的朋友喜欢XP多于喜欢95系统的人。 C++在编程领域拥用一定的市场,但API学着让人发怵,有些函数参数太多让人根本无法详细的牢记,而C#则没有API函数,因为都集成到类中了,写程序的时候会在你写前几个字母的时候就知道你要写的东西而提示出来让你选择,在选择的每个参数或者是在写“=”号的时候,马上就有提示,而且还会加上该选项的详细功能,用汉字注释的很详尽,这样输入程序很快而且不易出错。一个函数如果不知道其功能,把光带移至上面就得到它的详细说明,打上“(”的时候,就提示每个参数的功能及把它的所有可取的值枚举出来。如果程序有误,直接用“~~”给出下划线提示,放在该下划线上会给出错误的类型,单击旁边的“!”号会提出一个框列出修正错误的建议。而不像C++那样在编译的时候才发现,而且不易找,还没有排错建议。

TOP

[原创]试写小软件

呵呵,现在的IDE是越来越好用了。
然而底层的东西也被封装起来,看不到,从其量也就像VB一样拖拖控件而已,看不到底层的东西就永远是别人的,自己就只有一直落后于人。学C&#35;的确比学Java简单许多,至少Java有些东西还要自己去写,至少SUN把Java还准备开源,当然我并不想说哪个语言好哪个语言差

TOP

[原创]试写小软件

[这个贴子最后由无条件为你在 2006/05/28 02:39am 第 2 次编辑]

     封装有什么不好?我感觉是用着方便!
     你说看不到底层的东西就永远是别人的,我认为API函数是不是也算是封装了呢,因为API函数所实现的功能又是如何实现的呢?其实是封装成函数名让程序员调用而已。有些函数搞那么多的参数,让人头痛啊!

TOP

[原创]试写小软件

自己定义类?你写的能符合规范吗?是自己用着玩吗?真正工作的时候你会这样干?那样你是在给工程制造困难。

TOP

[原创]试写小软件

自定义类就像C++中定义结构体一样,有时候使用非常方便。
例如我想定义一种类型为“人”,包含性名性别联系电话等等。
在VB.net中自已定义的类会生成DLL文件,别人把你的DLL文件导入命名空间就可以使用了。

TOP

[原创]试写小软件

这个帖子有意思,,分别看到了一些东西.呵呵
若是做真正的软件,当然选择效率高点的开发工具和管理手段.
但是写程序就同了,有时候为了实现一些功能,需要花很多心思.这些东西不一定是那些主流工具和方法能体现和需要的.

TOP

返回列表 回复 发帖