C Board  

Go Back   C Board > General Programming Boards > C# Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 07-04-2005, 04:16 PM   #1
Registered User
 
Join Date: Aug 2004
Posts: 731
making a window

I want to make a window (not just selecting a windows form either) from code.

The peices of code I got so far are this:

my using statements
Code:
using System;
using System.Drawing;
using System.Windows.Forms;
starting code or somthing
Code:
namespace FormTest
{
public class FeaturedForm : Form
and ending code I belive
Code:
static void Main()
{
Application.Run(new FeaturedForm());
}
I also saw you can add STAThread before static void main()

so with that how do I make a window apear?
Rune Hunter is offline   Reply With Quote
Old 07-05-2005, 10:46 AM   #2
Registered User
 
Join Date: Aug 2004
Posts: 731
Ok I have made a window but now I got the black console window behind the window. How do I get rid of or make it so the console window doen't apear.
Rune Hunter is offline   Reply With Quote
Old 07-05-2005, 12:54 PM   #3
the hat of redundancy hat
 
nvoigt's Avatar
 
Join Date: Aug 2001
Location: Hannover, Germany
Posts: 2,769
There should be a compiler switch for CONSOLE or WINDOWS subsystem. If you select windows, no console window will appear.
__________________
hth
-nv

She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

When in doubt, read the FAQ.
Then ask a smart question.
nvoigt is offline   Reply With Quote
Old 07-05-2005, 07:00 PM   #4
Registered User
 
Join Date: Aug 2004
Posts: 731
alright well than the problem is, I am using code DOM. I want the program be able to make a windows program and that is the hard part.
Rune Hunter is offline   Reply With Quote
Old 07-05-2005, 08:58 PM   #5
Banned
 
nickname_changed's Avatar
 
Join Date: Feb 2003
Location: Australia
Posts: 986
When you call the compiler in the CSharpCodeDomProvider (I think) you pass in a number of options - one is whether or not to create an exe, one is whether to create a console or Win32 program.
nickname_changed is offline   Reply With Quote
Old 07-05-2005, 09:03 PM   #6
Banned
 
nickname_changed's Avatar
 
Join Date: Feb 2003
Location: Australia
Posts: 986
Code:
	// Create an instance of the CSharpCodeProvider class.
	Microsoft.CSharp.CSharpCodeProvider provider = new CSharpCodeProvider();
	// Call the CodeDomProvider.CreateCompiler() method to obtain an ICodeCompiler from the provider.
	System.CodeDom.Compiler.ICodeCompiler compiler = provider.CreateCompiler();

    CompilerParameters cp = new CompilerParameters(referenceAssemblies,
                                                   exeFile, false);
    // Generate an executable rather than a DLL file.
    cp.GenerateExecutable = true;            

    cp.CompilerOptions += "/target=winexe";

    // Invoke compilation.
    CompilerResults cr = compiler.CompileAssemblyFromFile(cp, sourceFile);
I believe that is what is needed - /target=winexe is a parameter to the 'csc' C# compiler that says to make a Windows file.
nickname_changed is offline   Reply With Quote
Old 07-06-2005, 08:27 AM   #7
Registered User
 
Join Date: Aug 2004
Posts: 731
You were close, it is

/t:winexe

Found that after I knew what I was looking for.

Thank you!
Rune Hunter is offline   Reply With Quote
Old 07-06-2005, 05:31 PM   #8
Banned
 
nickname_changed's Avatar
 
Join Date: Feb 2003
Location: Australia
Posts: 986
Ahh sorry my mistake, I used the .NET 2.0 CSC, where it's /target:winexe or /t:winexe. Glad to help
nickname_changed is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
C or C++ AcerN30 Game Programming 41 05-30-2008 06:57 PM
Just starting Windows Programming, School me! Shamino Windows Programming 17 02-22-2008 08:14 AM
6 measly errors beene Game Programming 11 11-14-2006 11:06 AM
Fixed window size The Brain Windows Programming 5 02-23-2006 03:07 PM
Why only 32x32? (OpenGL) [Please help] Queatrix Game Programming 2 01-23-2006 02:39 PM


All times are GMT -6. The time now is 01:22 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22