Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > .NET Languages
You last visited: Today at 17:12

  • Please register to post and access all features, it's quick, easy and FREE!

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.

Reply
 
Old   #1

 
Eule's Avatar
 
elite*gold: 0
The Black Market: 175/0/1
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..
Eule is offline  
Old 11/14/2019, 01:43   #2
 
elite*gold: 0
Join Date: Apr 2011
Posts: 363
Received Thanks: 167
Quote:
Originally Posted by Eule View Post
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);
elmarcia is offline  
Thanks
1 User
Old 11/14/2019, 09:40   #3

 
Eule's Avatar
 
elite*gold: 0
The Black Market: 175/0/1
Join Date: May 2014
Posts: 1,335
Received Thanks: 459
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?
Eule is offline  
Old 11/14/2019, 10:03   #4


 
False's Avatar
 
elite*gold: 0
The Black Market: 243/0/0
Join Date: Apr 2011
Posts: 11,115
Received Thanks: 2,436
Arrow C/C++ -> .NET Languages

#moved
False is offline  
Old 11/14/2019, 17:41   #5
 
elite*gold: 0
Join Date: Apr 2011
Posts: 363
Received Thanks: 167
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...
elmarcia is offline  
Thanks
1 User
Reply


Similar Threads 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.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.