Click here to Skip to main content
15,890,741 members
Home / Discussions / C#
   

C#

 
AnswerRe: Dézipe file with c# Pin
Mbah Dhaim20-Mar-09 11:15
Mbah Dhaim20-Mar-09 11:15 
GeneralRe: Dézipe file with c# Pin
abbd21-Mar-09 0:08
abbd21-Mar-09 0:08 
AnswerRe: Dézipe file with c# Pin
Ravadre20-Mar-09 12:01
Ravadre20-Mar-09 12:01 
QuestionShow a console window for 10sec in C# console application Pin
abbd20-Mar-09 11:00
abbd20-Mar-09 11:00 
AnswerRe: Show a console window for 10sec in C# console application Pin
Mbah Dhaim20-Mar-09 11:14
Mbah Dhaim20-Mar-09 11:14 
GeneralRe: Show a console window for 10sec in C# console application Pin
abbd20-Mar-09 11:49
abbd20-Mar-09 11:49 
GeneralRe: Show a console window for 10sec in C# console application Pin
Mbah Dhaim20-Mar-09 12:55
Mbah Dhaim20-Mar-09 12:55 
AnswerRe: Show a console window for 10sec in C# console application Pin
Ravadre20-Mar-09 16:40
Ravadre20-Mar-09 16:40 
You want to show windows for 10 secs and then close it, but still have running app? You could try doing it by building application as WindowApp, allocating and freeing console using PInvoke (search for AllocConsole).

I was bored, so I've cooked up sth like this:


public class Program
{
        [DllImport("kernel32.dll")]
        static extern int AllocConsole();

        [DllImport("kernel32.dll")]
	static extern int FreeConsole();

	[DllImport("kernel32.dll")]
	static extern IntPtr GetStdHandle(int nStdHandle);

	public static void Main()
	{
		AllocConsole();

		IntPtr outp = GetStdHandle(-11);

		SafeFileHandle safeOut = new SafeFileHandle(outp, true);

		Stream str = new FileStream(safeOut, FileAccess.Write);
		TextWriter con = new StreamWriter(str);

		con.Write("ff");
		con.Flush();

		Thread.Sleep(10000);
		safeOut.Close();

                //Console dissapears now.
		FreeConsole();

		//Rest of app
		Thread.Sleep(10000);
	}


As you can see, obtaining TextWriter is a bit more tricky, but after doing that, it's as simple as using Console.Write.
QuestionVerify if a processes exist Pin
abbd20-Mar-09 9:59
abbd20-Mar-09 9:59 
QuestionHow do I cast a LPARAM? Pin
bbranded20-Mar-09 8:41
bbranded20-Mar-09 8:41 
QuestionRe: How do I cast a LPARAM? Pin
led mike20-Mar-09 8:53
led mike20-Mar-09 8:53 
AnswerRe: How do I cast a LPARAM? [modified] Pin
bbranded20-Mar-09 8:56
bbranded20-Mar-09 8:56 
GeneralRe: How do I cast a LPARAM? Pin
Dan Neely20-Mar-09 9:24
Dan Neely20-Mar-09 9:24 
GeneralRe: How do I cast a LPARAM? Pin
led mike20-Mar-09 11:04
led mike20-Mar-09 11:04 
AnswerRe: How do I cast a LPARAM? Pin
Eslam Afifi20-Mar-09 8:59
Eslam Afifi20-Mar-09 8:59 
QuestionIntegrate MS Project into .net Application Pin
kcadella20-Mar-09 7:12
kcadella20-Mar-09 7:12 
AnswerRe: Integrate MS Project into .net Application Pin
led mike20-Mar-09 8:48
led mike20-Mar-09 8:48 
GeneralRe: Integrate MS Project into .net Application Pin
kcadella20-Mar-09 10:12
kcadella20-Mar-09 10:12 
GeneralRe: Integrate MS Project into .net Application Pin
kcadella23-Mar-09 14:57
kcadella23-Mar-09 14:57 
QuestionSound Recording in C# Pin
Emre Gürbüz20-Mar-09 5:41
Emre Gürbüz20-Mar-09 5:41 
AnswerRe: Sound Recording in C# Pin
led mike20-Mar-09 8:45
led mike20-Mar-09 8:45 
GeneralRe: Sound Recording in C# Pin
Emre Gürbüz20-Mar-09 8:55
Emre Gürbüz20-Mar-09 8:55 
GeneralRe: Sound Recording in C# Pin
Dan Neely20-Mar-09 9:28
Dan Neely20-Mar-09 9:28 
GeneralRe: Sound Recording in C# Pin
led mike20-Mar-09 10:53
led mike20-Mar-09 10:53 
GeneralRe: Sound Recording in C# Pin
led mike20-Mar-09 10:52
led mike20-Mar-09 10:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.