|
You last visited: Today at 17:12
Advertisement
need help with C# System.Windows.Forms.MessageBox.Show
Discussion on need help with C# System.Windows.Forms.MessageBox.Show within the .NET Languages forum part of the Coders Den category.
11/13/2019, 20:08
|
#1
|
elite*gold: 0
Join Date: May 2014
Posts: 1,335
Received Thanks: 459
|
need help with C# System.Windows.Forms.MessageBox.Show
i want that the message box only 10 secound appear and then close.
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
|
#2
|
elite*gold: 0
Join Date: Apr 2011
Posts: 363
Received Thanks: 167
|
Quote:
Originally Posted by Eule
i want that the message box only 10 secound appear and then close.
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
|
#3
|
elite*gold: 0
Join Date: May 2014
Posts: 1,335
Received Thanks: 459
|
Quote:
Originally Posted by elmarcia
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
|
#4
|
elite*gold: 0
Join Date: Apr 2011
Posts: 11,115
Received Thanks: 2,436
|
C/C++ -> .NET Languages
#moved
|
|
|
11/14/2019, 17:41
|
#5
|
elite*gold: 0
Join Date: Apr 2011
Posts: 363
Received Thanks: 167
|
Quote:
Originally Posted by Eule
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...
|
|
|
 |
Similar Threads
|
GUI/Windows-Forms in C++
04/01/2012 - C/C++ - 8 Replies
Hey Leute,
ich lerne jetzt schon seit gut einem halben Jahr C++ und es klappt auch alles wunderbar und ich habe auch schon die ersten kleinen Spiele(Snake, Tetris) in der Console programmiert. Doch jetzt will ich auf GUI umsteigen, finde aber überhaupt keine guten How To's :(
Kennt ihr ein gutes How to, welches sich mit Windows Forms(Visual Studio), beschäftigt?
|
C# | MessageBox Show?!
03/09/2012 - C/C++ - 7 Replies
Hey,
progge derzeit nen Bot und so..
Jetzt bräucht ich kleine Hilfe!
Ich möchte einen Button erstellen, und wenn amn draufklickt soll sich ein neues Fenster öffnen mit meinen bestimmten Text.
|
Windows Forms and Threads.
09/21/2011 - CO2 Programming - 7 Replies
I know it's not a conquer related question, but since a lot of people here is C# programmers I just thought I would ask here.
Why is it exactly you cannot enter Windows Form Controls from another thread?
Not asking how to do it, but why it's not allowed.
|
All times are GMT +1. The time now is 17:13.
|
|