vb.net关机而不提示的简单介绍

vb.net实现关机

这是点击Option 你可以

让客户满意是我们工作的目标,不断超越客户的期望值来自于我们对这个行业的热爱。我们立志把好的技术通过有效、简单的方式提供给客户,将通过不懈努力成为客户在信息化领域值得信任、有价值的长期合作伙伴,公司提供的服务项目有:空间域名、网络空间、营销软件、网站建设、广阳网站维护、网站推广。

用个msgbox函数 点击YES时候运行关机代码即可

Private Declare Function ExitWindowsEx Lib "user32" (ByVal uFlags As Integer, ByVal dwReserved As Integer) As Integer 

Const EWX_FORCE As Short = 4

Const EWX_LOGOFF As Short = 0

Const EWX_REBOOT As Short = 2

Const EWX_SHUTDOWN As Short = 1

Dim retval As Integer

' 定义Esc按键

Const VK_ESCAPE As Short = H1Bs

Private Sub Command1_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command1.Click

If Option1.Checked Then

' 注销当前用户

retval = ExitWindowsEx(EWX_FORCE, 0) bitsCN.Com

ElseIf Option2.Checked Then

' 关闭计算机

retval = ExitWindowsEx(EWX_SHUTDOWN, 0)

ElseIf Option3.Checked Then

' 重新启动

retval = ExitWindowsEx(EWX_REBOOT, 0)

End If

End Sub

Private Sub Command2_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command2.Click

Me.Close()

End Sub

' 按Esc键时,结束应用程序

Private Sub Form1_KeyPress(ByVal eventSender As System.Object, ByVal eventArgs As System.Windows.Forms.KeyPressEventArgs) Handles MyBase.KeyPress

Dim KeyAscii As Short = Asc(eventArgs.KeyChar)

If KeyAscii = VK_ESCAPE Then BBS.bitsCN.com网管论坛

Me.Close()

End If

If KeyAscii = 0 Then

eventArgs.Handled = True

End If

End Sub

vb.net2008拦截关机或注销消息

在SystemEvents类中 可以 用户试图注销或关闭系统时发生。 (当用户试图注销或关闭系统时发生。当用户试图注销或关闭系统时发生。) 这个 事件处理函数中 可以找到如下方法

Private Shared WM_QUERYENDSESSION As Integer = H11

Private Shared systemShutdown As Boolean = False

Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)

If m.Msg = WM_QUERYENDSESSION Then

'MessageBox.Show("queryendsession: this is a logoff, shutdown, or reboot")

systemShutdown = True

End If

' If this is WM_QUERYENDSESSION, the closing event should be raised in the base WndProc.

MyBase.WndProc(m)

End Sub 'WndProc

Private Sub Form1_Closing(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing

If (systemShutdown) Then

' Reset the variable because the user might cancel the shutdown.

systemShutdown = False

If (System.Windows.Forms.DialogResult.Yes = _

MessageBox.Show("My application", "Do you want to save your work before logging off?", MessageBoxButtons.YesNo)) Then

e.Cancel = True

Else

e.Cancel = False

End If

End If

End Sub

vs2005 vb.net没智能提示

我想你说的那个智能提示应该是vs2005中人机交互的错误列表,这个作物列表可以自定义显示或者隐藏,点击菜单栏中的视图按钮后选择错误列表选项或者还原默认排列就可以重新显示了

vb.net WinXP/2000操作系统自动关机的实现

Windows

XP的关机是由Shutdown.exe程序来控制的,位于Windows\System32文件夹中。如果想让Windows

2000也实现同样的效果,可以把Shutdown.exe复制到系统目录下。

比如你的电脑要在22:00关机,可以选择“开始→运行”,输入“at

22:00

Shutdown

-s”,这样,到了22点电脑就会出现“系统关机”对话框,默认有30秒钟的倒计时并提示你保存工作。如果你想以倒计时的方式关机,可以输入“Shutdown.exe

-s

-t

3600”,这里表示60分钟后自动关机,“3600”代表60分钟。

设置好自动关机后,如果想取消的话,可以在运行中输入“shutdown

-a”。另外输入“shutdown

-i”,则可以打开设置自动关机对话框,对自动关机进行设置。

Shutdown.exe的参数,每个都具有特定的用途,执行每一个都会产生不同的效果,比如“-s”就表示关闭本地计算机,“-a”表示取消关

机操作,下面列出了更多参数,大家可以在Shutdown.exe中按需使用。

其他的我也不多说了,这样说已经很详细了,你应该能看懂。

文章题目:vb.net关机而不提示的简单介绍
转载注明:https://www.cdcxhl.com/article16/hcshdg.html

成都网站建设公司_创新互联,为您提供App开发自适应网站企业建站网站排名用户体验外贸建站

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联

成都app开发公司