need help with C# System.Windows.Forms.MessageBox.Show

11/13/2019 20:08 Eule#1
i want that the message box only 10 secound appear and then close.

[Only registered and activated users can see links. Click Here To Register...]


edit :

public class Program
{
public static void Main()
{
System.Windows.Forms.MessageBox.Show("test");
System.Threading.Thread.Sleep(1000);
System.Windows.Forms.SendKeys.SendWait("{Enter}");
}
}


funktioniert leider nicht..
11/14/2019 01:43 elmarcia#2
Quote:
Originally Posted by Eule View Post
i want that the message box only 10 secound appear and then close.

[Only registered and activated users can see links. Click Here To Register...]


edit :

public class Program
{
public static void Main()
{
System.Windows.Forms.MessageBox.Show("test");
System.Threading.Thread.Sleep(1000);
System.Windows.Forms.SendKeys.SendWait("{Enter}");
}
}


funktioniert leider nicht..
Just use MessageBoxTimeout API from windows...
Code:
[DllImport("user32.dll", SetLastError=true)]
static extern int MessageBoxTimeout(IntPtr hwnd, String text, String title, uint type, Int16 wLanguageId, Int32 milliseconds);
11/14/2019 09:40 Eule#3
Quote:
Originally Posted by elmarcia View Post
Just use MessageBoxTimeout API from windows...
Code:
[DllImport("user32.dll", SetLastError=true)]
static extern int MessageBoxTimeout(IntPtr hwnd, String text, String title, uint type, Int16 wLanguageId, Int32 milliseconds);
iam retarded in coding, can you add the code intro my code correctly and add the 10000 millisecounds?
11/14/2019 10:03 False#4
#moved
11/14/2019 17:41 elmarcia#5
Quote:
Originally Posted by Eule View Post
iam retarded in coding, can you add the code intro my code correctly and add the 10000 millisecounds?
Code:
using System.Runtime.InteropServices;
public class Program
{
 [DllImport("user32.dll", SetLastError = true)]
        static extern int MessageBoxTimeout(IntPtr hwnd, String text, String title, uint type, Int16 wLanguageId, Int32 milliseconds);
     
public static void Main()
{
/*
System.Windows.Forms.MessageBox.Show("test");
System.Threading.Thread.Sleep(1000);
System.Windows.Forms.SendKeys.SendWait("{Enter}");
*/
//this code replaces the code above
//1 sec timeout
int timeout = 1000;
MessageBoxTimeout(new IntPtr(0),"some text","some title",0,0,timeout);
}
}
Try to learn to code, then find new ways of doing what u want...