如何关闭和启动explorer.exe?

yanzhao 2003-12-30 05:14:48
我的代码如下。问题是,按了button1以后,explorer.exe虽然退出,但马上又启动了。我该如何实现任意开闭explorer.exe呢?
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim myprocesses() As Process
Dim myprocess As Process
myprocesses = Process.GetProcesses
Dim i As Integer
For Each myprocess In myprocesses
If myprocess.ProcessName = "explorer" Then
myprocess.Kill()
End If
Next
Timer1.Enabled = True
End Sub


Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Shell("explorer.exe")
End Sub
...全文
2459 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
yanzhao 2003-12-31
  • 打赏
  • 举报
回复
我的解决方法是用个timer控件,100毫秒就try它一下。好笨笨:)

to:redebug(雷老虎) ,谢谢。

to:lihao9806(李昊),在系统里把explorer.exe自动重运行取消掉,怎么取消呢?另外,为什么手工杀死explorer.exe不会重新运行呢?

to:caozq(有匪君子),用屏幕保护在2k和xp里好像不行。欢迎继续“如切如磋”:)
thelostman 2003-12-31
  • 打赏
  • 举报
回复
你还不如用屏幕保护算了
不朽之王 2003-12-31
  • 打赏
  • 举报
回复
up
lihao9806 2003-12-31
  • 打赏
  • 举报
回复
这和你写程序无关,你要在系统里把explorer.exe自动重运行取消掉。(这时系统的默认行为)
redebug 2003-12-30
  • 打赏
  • 举报
回复
隐藏桌面可以这样试试:
桌面也是一个窗口,首先用findwindow找到桌面窗口的句柄DeskTopHwnd,
然后调用
SetWindowPos(DeskTopHwnd, 0, 0, 0, 0, 0, SWP_HIDEWINDOW); //这是隐藏
SetWindowPos(DeskTopHwnd, 0, 0, 0, 0, 0, SWP_SHOWWINDOW); //这是显示

隐藏和显示桌面!
yanzhao 2003-12-30
  • 打赏
  • 举报
回复
不是,我是想隐藏桌面。在任务管理器里手工杀死explorer.exe就可以把桌面藏起来。然后在新任务里执行explorer,又可以打开。可是程序不知为什么就只是关一下,然后自己就开了。
dongbeiren 2003-12-30
  • 打赏
  • 举报
回复
可能是 redebug(雷老虎) 的意思:)
redebug 2003-12-30
  • 打赏
  • 举报
回复
楼上说的没错,你除非是想关闭系统,
另你是不是想控制IE,如果是那就应该是IEXPLORE.exe
LVOLCANO 2003-12-30
  • 打赏
  • 举报
回复
windows的桌面系统好象就是explorer

关闭EXPLORER好象就是要关闭系统

16,719

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧