弹出MessageBox并延迟一段时间后自动关闭的一种方法(仅供参考)

   从网上看到MessageBox会导致阻塞,要想延时后自动关闭只能发送Enter或者向指定窗口发送关闭消息。这些方法都比较麻烦,有一种更为简便的方法,思路是:在Form1里生成一个新的窗口Form2,Form2窗口不显示,使用MessageBox.Show()指定所有者是Form2,Form1的定时器延时一段时间后关闭Form2,这样一来关闭Form2的同时,MessageBox也被关闭了。

    需要注意的是,Form2应该是Form1类的一个成员,这样定时器里才能调用Form2.close()用以关闭Form2代码如下:

    Form1里有个按钮,Form2是一个空窗体。

  public partial class Form1 : Form
    {

     Form2 Form2;
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            timer1.Enabled = true;
            Form2 = new Form2();
            MessageBox.Show(Form2, "你好", "提示");           
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            Form2.Close();
        }
   
    }

展开阅读全文

apache开启一段时间后,自动关闭

05-12

我用的服务器是腾讯云windows2012 server,环境装的是护卫神apache大师。问题描述:启动apache后,好长一段时间网站都访问正常,等第二天再访问网站,发现apache服务自己关闭了,求大神指教什么原因?急!rn[b]apache的/logs/error.log里的信息如下[/b]:rn[Thu May 11 20:25:45 2017] [error] [client 176.195.233.118] File does not exist: D:/wwwroot/thzc_dc1OYM/html/lltx/ffl/2015/0623/templets, referer: http://www.thzc.net/html/lltx/ffl/2015/0623/55.htmlrn[Thu May 11 20:25:45 2017] [error] [client 176.195.233.118] File does not exist: D:/wwwroot/thzc_dc1OYM/enjoy, referer: http://www.thzc.net/html/lltx/ffl/2015/0623/55.htmlrn[Thu May 11 20:26:36 2017] [error] [client 203.208.60.200] File does not exist: D:/wwwroot/thzc_dc1OYM/plusrn[Thu May 11 20:26:36 2017] [error] [client 203.208.60.200] File does not exist: D:/wwwroot/thzc_dc1OYM/enjoyrnQt: Untested Windows version 6.2 detected!rnhttpd.exe: Could not reliably determine the server's fully qualified domain name, using 10.141.168.164 for ServerNamern[Fri May 12 09:03:51 2017] [warn] pid file D:/HwsApacheMaster/Apache/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?rn[Fri May 12 09:03:51 2017] [notice] Apache/2.2.22 (Win32) mod_fcgid/2.3.6 mod_jk/1.2.33 configured -- resuming normal operationsrn[Fri May 12 09:03:51 2017] [notice] Server built: Jan 28 2012 11:16:39rn[Fri May 12 09:03:51 2017] [notice] Parent: Created child process 440rnQt: Untested Windows version 6.2 detected!rnhttpd.exe: Could not reliably determine the server's fully qualified domain name, using 10.141.168.164 for ServerNamernQt: Untested Windows version 6.2 detected!rnhttpd.exe: Could not reliably determine the server's fully qualified domain name, using 10.141.168.164 for ServerNamern[Fri May 12 09:03:52 2017] [notice] Child 440: Child process is runningrn[Fri May 12 09:03:52 2017] [notice] Child 440: Acquired the start mutex.rn[Fri May 12 09:03:52 2017] [notice] Child 440: Starting 64 worker threads.rn[Fri May 12 09:03:52 2017] [notice] Child 440: Starting thread to listen on port 999.rn[Fri May 12 09:03:52 2017] [notice] Child 440: Starting thread to listen on port 81.rn[Fri May 12 09:03:52 2017] [notice] Child 440: Starting thread to listen on port 80.rn[Fri May 12 09:05:35 2017] [error] [client 220.181.108.169] File does not exist: D:/wwwroot/tiaoshi_V3fq66/2rn[Fri May 12 09:05:35 2017] [error] [client 220.181.108.169] File does not exist: D:/wwwroot/tiaoshi_V3fq66/404.htmlrn[Fri May 12 09:08:11 2017] [error] [client 101.226.68.215] File does not exist: D:/wwwroot/thzc_dc1OYM/datarn[Fri May 12 09:08:11 2017] [error] [client 101.226.68.215] File does not exist: D:/wwwroot/thzc_dc1OYM/enjoyrn[Fri May 12 09:08:12 2017] [error] [client 101.226.68.215] File does not exist: D:/wwwroot/thzc_dc1OYM/trustrn[Fri May 12 09:08:12 2017] [error] [client 101.226.68.215] File does not exist: D:/wwwroot/thzc_dc1OYM/enjoyrn[Fri May 12 09:11:09 2017] [error] [client 203.208.60.198] File does not exist: D:/wwwroot/thzc_dc1OYM/plusrn[Fri May 12 09:11:09 2017] [error] [client 203.208.60.198] File does not exist: D:/wwwroot/thzc_dc1OYM/enjoyrn[Fri May 12 09:13:58 2017] [error] [client 203.208.60.198] File does not exist: D:/wwwroot/thzc_dc1OYM/shtmlrn[Fri May 12 09:13:58 2017] [error] [client 203.208.60.198] File does not exist: D:/wwwroot/thzc_dc1OYM/enjoy 论坛

tomcat运行一段时间自动关闭

01-24

#rn# An unexpected error has been detected by Java Runtime Environment:rn#rn# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x7c94a379, pid=3868, tid=5592rn#rn# Java VM: Java HotSpot(TM) Client VM (1.6.0-beta2-b86 mixed mode, sharing)rn# Problematic frame:rn# C [ntdll.dll+0x1a379]rn#rn# If you would like to submit a bug report, please visit:rn# http://java.sun.com/webapps/bugreport/crash.jsprn#rnrn--------------- T H R E A D ---------------rnrnCurrent thread (0x02b69800): JavaThread "http-80-Processor25" daemon [_thread_in_native, id=5592]rnrnsiginfo: ExceptionCode=0xc0000005, writing address 0x00000008rnrnRegisters:rnEAX=0x00000000, EBX=0x00000000, ECX=0x00000008, EDX=0x00000004rnESP=0x03cef028, EBP=0x03cef034, ESI=0x00000008, EDI=0x00000000rnEIP=0x7c94a379, EFLAGS=0x00010297rnrnTop of Stack: (sp=0x03cef028)rn0x03cef028: 00000000 00000000 00000008 03cef050rn0x03cef038: 4b785322 00000004 03f203fc 4b7527afrn0x03cef048: 03f203fc 03f203d8 03cef088 4b7587a1rn0x03cef058: 03f203fc 4b780000 02b698e4 26f3a2e8rn0x03cef068: 03cefb68 00000000 03cef05c 03ceec54rn0x03cef078: 03cefb68 4b785e35 4b758770 ffffffffrn0x03cef088: 03cef0a0 4b758748 03f203d8 03cef0c0rn0x03cef098: 02f2b888 02b698e4 03cef0b8 6d3e11cb rnrnInstructions: (pc=0x7c94a379)rn0x7c94a369: 56 8d 72 04 57 89 75 fc b8 00 00 00 00 8b 4d fcrn0x7c94a379: f0 0f b3 01 0f 92 c0 84 c0 0f 84 0e 0d 01 00 64 rnrnrnStack: [0x03ca0000,0x03cf0000), sp=0x03cef028, free space=316krnNative frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)rnC [ntdll.dll+0x1a379]rnC [ODBC32.dll+0x35322]rnC [ODBC32.dll+0x87a1]rnC [ODBC32.dll+0x8748]rnC [JdbcOdbc.dll+0x11cb]rnj sun.jdbc.odbc.JdbcOdbc.allocConnect(J[B)J+0rnj sun.jdbc.odbc.JdbcOdbc.SQLAllocConnect(J)J+30rnj sun.jdbc.odbc.JdbcOdbcDriver.allocConnection(J)J+6rnj sun.jdbc.odbc.JdbcOdbcConnection.initialize(Ljava/lang/String;Ljava/util/Properties;I)V+37rnj sun.jdbc.odbc.JdbcOdbcDriver.connect(Ljava/lang/String;Ljava/util/Properties;)Ljava/sql/Connection;+129rnJ java.sql.DriverManager.getConnection(Ljava/lang/String;Ljava/util/Properties;Ljava/lang/ClassLoader;)Ljava/sql/Connection;rnj java.sql.DriverManager.getConnection(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/sql/Connection;+41rnj com.sms.dy.sql.MyDataBaseManager.open()V+44rnj com.sms.dy.util.OASms.sendSms()V+43rnj org.apache.jsp.userManage.send_jsp._jspService(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V+353rnj org.apache.jasper.runtime.HttpJspBase.service(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V+3rnj javax.servlet.http.HttpServlet.service(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;)V+30rnj org.apache.jasper.servlet.JspServletWrapper.service(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;Z)V+203rnj org.apache.jasper.servlet.JspServlet.serviceJspFile(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;Ljava/lang/String;Ljava/lang/Throwable;Z)V+186rnj org.apache.jasper.servlet.JspServlet.service(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V+435rnj javax.servlet.http.HttpServlet.service(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;)V+30rnj org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;)V+362rnj org.apache.catalina.core.ApplicationFilterChain.doFilter(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;)V+101rnj org.apache.catalina.core.StandardWrapperValve.invoke(Lorg/apache/catalina/connector/Request;Lorg/apache/catalina/connector/Response;)V+699rnj org.apache.catalina.core.StandardContextValve.invoke(Lorg/apache/catalina/connector/Request;Lorg/apache/catalina/connector/Response;)V+269rnj org.apache.catalina.core.StandardHostValve.invoke(Lorg/apache/catalina/connector/Request;Lorg/apache/catalina/connector/Response;)V+64rnj org.apache.catalina.valves.ErrorReportValve.invoke(Lorg/apache/catalina/connector/Request;Lorg/apache/catalina/connector/Response;)V+6rnj org.apache.catalina.core.StandardEngineValve.invoke(Lorg/apache/catalina/connector/Request;Lorg/apache/catalina/connector/Response;)V+42rnj org.apache.catalina.connector.CoyoteAdapter.service(Lorg/apache/coyote/Request;Lorg/apache/coyote/Response;)V+154rnj org.apache.coyote.http11.Http11Processor.process(Ljava/io/InputStream;Ljava/io/OutputStream;)V+611rnj org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Lorg/apache/tomcat/util/net/TcpConnection;[Ljava/lang/Object;)V+113rnj org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(Ljava/net/Socket;Lorg/apache/tomcat/util/net/TcpConnection;[Ljava/lang/Object;)V+45rnj org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt([Ljava/lang/Object;)V+102rnj org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run()V+167rnj java.lang.Thread.run()V+11rnv ~StubRoutines::call_stubrnrnJava frames: (J=compiled Java code, j=interpreted, Vv=VM code)rnj sun.jdbc.odbc.JdbcOdbc.allocConnect(J[B)J+0rnj sun.jdbc.odbc.JdbcOdbc.SQLAllocConnect(J)J+30rnj sun.jdbc.odbc.JdbcOdbcDriver.allocConnection(J)J+6rnj sun.jdbc.odbc.JdbcOdbcConnection.initialize(Ljava/lang/String;Ljava/util/Properties;I)V+37rnj sun.jdbc.odbc.JdbcOdbcDriver.connect(Ljava/lang/String;Ljava/util/Properties;)Ljava/sql/Connection;+129rnJ java.sql.DriverManager.getConnection(Ljava/lang/String;Ljava/util/Properties;Ljava/lang/ClassLoader;)Ljava/sql/Connection;rnj java.sql.DriverManager.getConnection(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/sql/Connection;+41rnj com.sms.dy.sql.MyDataBaseManager.open()V+44rnj com.sms.dy.util.OASms.sendSms()V+43rnj org.apache.jsp.userManage.send_jsp._jspService(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V+353rnj org.apache.jasper.runtime.HttpJspBase.service(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V+3rnj javax.servlet.http.HttpServlet.service(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;)V+30rnj org.apache.jasper.servlet.JspServletWrapper.service(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;Z)V+203rnj org.apache.jasper.servlet.JspServlet.serviceJspFile(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;Ljava/lang/String;Ljava/lang/Throwable;Z)V+186rnj org.apache.jasper.servlet.JspServlet.service(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V+435rnj javax.servlet.http.HttpServlet.service(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;)V+30rnj org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;)V+362rnj org.apache.catalina.core.ApplicationFilterChain.doFilter(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;)V+101rnj org.apache.catalina.core.StandardWrapperValve.invoke(Lorg/apache/catalina/connector/Request;Lorg/apache/catalina/connector/Response;)V+699rnj org.apache.catalina.core.StandardContextValve.invoke(Lorg/apache/catalina/connector/Request;Lorg/apache/catalina/connector/Response;)V+269rnj org.apache.catalina.core.StandardHostValve.invoke(Lorg/apache/catalina/connector/Request;Lorg/apache/catalina/connector/Response;)V+64rnj org.apache.catalina.valves.ErrorReportValve.invoke(Lorg/apache/catalina/connector/Request;Lorg/apache/catalina/connector/Response;)V+6rnj org.apache.catalina.core.StandardEngineValve.invoke(Lorg/apache/catalina/connector/Request;Lorg/apache/catalina/connector/Response;)V+42rnj org.apache.catalina.connector.CoyoteAdapter.service(Lorg/apache/coyote/Request;Lorg/apache/coyote/Response;)V+154rnj org.apache.coyote.http11.Http11Processor.process(Ljava/io/InputStream;Ljava/io/OutputStream;)V+611rnj org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Lorg/apache/tomcat/util/net/TcpConnection;[Ljava/lang/Object;)V+113rnj org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(Ljava/net/Socket;Lorg/apache/tomcat/util/net/TcpConnection;[Ljava/lang/Object;)V+45rnj org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt([Ljava/lang/Object;)V+102rnj org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run()V+167rnj java.lang.Thread.run()V+11rnv ~StubRoutines::call_stubrn 论坛

没有更多推荐了,返回首页