资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

vb点虐 获取关机 vbnet dir

小技巧:VB.NET实现关机和重新启动

Private Declare Function ExitWindowsEx Lib user (ByVal uFlags As Integer ByVal dwReserved As Integer) As IntegerConst EWX_FORCE As Short = Const EWX_LOGOFF As Short = Const EWX_REBOOT As Short = Const EWX_SHUTDOWN As Short = Dim retval As Integer 定义Esc按键Const VK_ESCAPE As Short = H BsPrivate Sub Command _Click(ByVal eventSender As System Object ByVal eventArgs As System EventArgs) Handles Command ClickIf Option Checked Then 注销当前用户retval = ExitWindowsEx(EWX_FORCE )ElseIf Option Checked Then 关闭计算机retval = ExitWindowsEx(EWX_SHUTDOWN )ElseIf Option Checked Then 重新启动retval = ExitWindowsEx(EWX_REBOOT )End IfEnd SubPrivate Sub Command _Click(ByVal eventSender As System Object ByVal eventArgs As System EventArgs) Handles Command ClickMe Close()End Sub 按Esc键时 结束应用程序Private Sub Form _KeyPress(ByVal eventSender As System Object ByVal eventArgs As System Windows Forms KeyPressEventArgs) Handles MyBase KeyPressDim KeyAscii As Short = Asc(eventArgs KeyChar)If KeyAscii = VK_ESCAPE ThenMe Close()End IfIf KeyAscii = TheneventArgs Handled = TrueEnd IfEnd Sub本实例通过使用ExitWindowEx()API函数来达到关机和重新启动的目的 在ExitWindowEx()函数中 参数uFlags指定要进行何种操作 在表 中列出了参数uFlags的值及其说明 表  参数uFlags的值及说明 lishixinzhi/Article/program/net/201311/13585

创新互联建站坚持“要么做到,要么别承诺”的工作理念,服务领域包括:成都做网站、网站建设、企业官网、英文网站、手机端网站、网站推广等服务,满足客户于互联网时代的东平网站设计、移动媒体设计的需求,帮助企业找到有效的互联网解决方案。努力成为您成熟可靠的网络建设合作伙伴!

VB.NET 中怎么获取开机时间与关机时间

2000以上系统系统日志都有记录的,直接读系统日志就可以了,多此一举

请问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点抗 网管论坛

Me.Close()

End If

If KeyAscii = 0 Then

eventArgs.Handled = True

End If

End Sub


本文标题:vb点虐 获取关机 vbnet dir
文章起源:http://cdkjz.cn/article/ddjhhei.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

大客户专线   成都:13518219792   座机:028-86922220