本文介绍了关闭申请/寻找解决方案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个运行时间较长的应用程序,该应用程序每隔一段时间(每月一次)死于没有恩典的经历;)几个月来一直试图抓住它.我有一个计划运行的任务,它将重新启动它,但是应用程序正在等待用户输入到Windows 对话框,询问您是否要搜索解决方案等...
I have a long running application that every once in awhile, once a month, dies without grace ;) Been trying to catch it for months. I have a task that is scheduled to run that will restart it, BUT the app is waiting for user input to the windows dialog that asks if you want to search for a solution etc...
有没有办法禁用该对话框?
Is there a way to disable that dialog?
使用Application.DoEvents()的人不知道它做什么,而知道它做什么的人则从不使用它." -MSDN用户JohnWein Multics-领先于时代的操作系统.
"Those who use Application.DoEvents() have no idea what it does and those who know what it does never use it." - MSDN User JohnWein Multics - An OS ahead of its time.
推荐答案
也许对话框中有标题,您可以将计时器与FindWindow和SendMessage一起使用来终止对话框.
Perhaps if the dialog has a title you could use a timer coupled with FindWindow and SendMessage to kill the dialog.
Imports System.Runtime.InteropServices
Public Class Form1
<DllImport("user32.dll")>
Public Shared Function FindWindow(
ByVal sClassName As String,
ByVal sAppName As String) As IntPtr
End Function
<DllImport("user32.dll")>
Public Shared Function SendMessage(
ByVal hWnd As IntPtr,
ByVal Msg As UInteger,
ByVal wParam As Integer,
ByVal lParam As Integer) As Integer
End Function
Private killerTimer As Timer
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
killerTimer = New Timer()
killerTimer.Interval = 100
AddHandler killerTimer.Tick,
Sub()
' look for a dialog with a title of Hello
Dim w As IntPtr = FindWindow(Nothing, "Hello")
If w <> IntPtr.Zero Then
SendMessage(w, &H112, &HF060, 0)
End If
End Sub
killerTimer.Start()
End Sub
End Class
这篇关于关闭申请/寻找解决方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!