Writing software for Windows

Aug 25, 2004
11,151
1
81
First off, I know almost nothing about writing apps for Windows.

I want to write a simple application for Windows (single window, single exe file, no installer). I started writing it in Visual Studio 2008, but I realized that anything I write would depend on the .NET framework.

To start off, I wrote the app in C# and set it to work with the .NET 2.0 environment, built it, and got an .exe file. I copied this file over to my Vista laptop and it worked fine. I copied it to a XP machine (which did not have the .NET framework installed) and, as I feared, it did not work.

How does an application like uTorrent (which is a single .exe file) run out of the box without depending on the .NET framework? For that matter, there is a lot of software that's on Sourceforge that runs on Windows, that weren't written in Visual Studio. What development tools do they use?

What alternatives to Visual Studio should I look at? I'd prefer to use something that is free (Visual Studio was a free download from MSDNAA) or cheap, because I plan to give the app and the source away for free to everyone at my college.

Thanks!
 

dighn

Lifer
Aug 12, 2001
22,820
4
81
Not everything written in Visual Studio 2008 is .NET based. You could make an MFC project, which gives you the option to statically link the libraries so they require no extra DLLs, or include the MFC DLLs with your exe (not installation required). You can use the Windows API directly, or you could use other libraries like WTL. Visual Studio is probably the best IDE you can use for Windows development.

Beware though, non-.NET windows development can be a lot more complicated in that it requires quite a bit of background knowledge. MFC is a beast on its own. Is having to install .NET runtimes that big of a deal though? .NET is pretty popular. A lot of people probably already have it installed and even if not they'll probably have to install it eventually anyway.
 

Noobsa44

Member
Jun 7, 2005
65
0
0
Different programming languages use different frameworks such as Java, Perl, VB (classic), Ruby, etc. Each of those languages has it's own editors (for example, Java programmers tend to use eclipse) and require there own framework to be install or included in some fashion. In windows land the two most popular frameworks are .net and java. I should note that you can create an installer that will automatically install the .net framework if it's not installed on a user's system.

Most people who don't wish to depend upon a framework use C or C++ and statically link to the windows libraries. As a simple alternative (for very simple solutions) that I've seen used on occasion is HTA or HTML applications. Those can be written in VB Script or JavaScript and use HTML/IE for rendering. Since IE and VBS/JavaScript are built into everything from Windows 2000 and above, it's very compatible, and not nearly as hard to work with as C/C++.

The last and probably the most popular solution is to set up a web server and just let users use a web browser to ensure it works with all systems. This of course isn't true as not all standards are followed by some browsers, but that is a totally different topic.
 

Markbnj

Elite Member <br>Moderator Emeritus
Moderator
Sep 16, 2005
15,682
14
81
www.markbetz.net
It's only partially accurate to think of .Net as a framework, though, despite Microsoft calling it one. This is how MS evolves the next API to Windows and migrates developers and users to it. They did the same thing with COM. .Net is already native on Vista, even though it is still sitting on COM and Win32. Over time the whole managed guts of it will move right into the OS, but long before that you won't be able to tell the difference anyway.

I think if you're writing for Windows, especially if you're starting now, .Net is the only way to go. They should just go ahead and change the stupid name to something that reflects its true purpose.
 

mcmilljb

Platinum Member
May 17, 2005
2,144
2
81
Originally posted by: George P Burdell
First off, I know almost nothing about writing apps for Windows.

I want to write a simple application for Windows (single window, single exe file, no installer). I started writing it in Visual Studio 2008, but I realized that anything I write would depend on the .NET framework.

To start off, I wrote the app in C# and set it to work with the .NET 2.0 environment, built it, and got an .exe file. I copied this file over to my Vista laptop and it worked fine. I copied it to a XP machine (which did not have the .NET framework installed) and, as I feared, it did not work.

How does an application like uTorrent (which is a single .exe file) run out of the box without depending on the .NET framework? For that matter, there is a lot of software that's on Sourceforge that runs on Windows, that weren't written in Visual Studio. What development tools do they use?

What alternatives to Visual Studio should I look at? I'd prefer to use something that is free (Visual Studio was a free download from MSDNAA) or cheap, because I plan to give the app and the source away for free to everyone at my college.

Thanks!

Just tell everyone who uses your program that they need .NET 2.0 Framework, it's not a big deal really . According to utorrent's website: "µTorrent is programmed in C++ using custom-coded libraries. It is then compressed with UPX to bring the size down by about 50%." The programmer is probably just not using .NET if you didn't need it to work. He is probably just using basic classes built-in to windows. Visual Studio is just a very fancy editor. You could write all the source code in notepad and then compile it yourself.
 

DaveSimmons

Elite Member
Aug 12, 2001
40,730
670
126
The C++ / MFC "dialog-only app" project type is easy to work with if you use ClassWizard to hook functions up to button presses.

If you statically link the MFC & C/C++ libraries this should work for Win2K, XP, server 2003 & Vista. I don't think VS2008 apps still work with 98/ME but I haven't verified this.
 
Aug 25, 2004
11,151
1
81
Thanks a lot for all the input. I decided to go with C#:

1. Vista has the .NET framework 2.0 installed by default, so the .exe works without problem.
2. I've already completed a working prototype with Visual Studio and C#.
3. As mcmilljb suggested, I can ask XP users to download the .NET framework.
4. I looked at MFC, but at my current level, it is beyond me.
 

Net

Golden Member
Aug 30, 2003
1,592
3
81
Before you make that decision.

Did you get .Net from the Microsoft Software Alliance from your college? We can download all kinds of applications for free too.

You can download Visual Studio 6. This doesn't use the .NET framework.

Visual Studio 6 has Visual basic 6 etc... The visual basic programs you make will be a stand alone application.

I would use Visual Studio 6 unless you need a feature from .NET (such the windows media player component.) All the applications I make with .NET will automatically download and install the framework for you if you don't have it. It was like this out of the box.
 
Aug 25, 2004
11,151
1
81
Originally posted by: net
Did you get .Net from the Microsoft Software Alliance from your college? We can download all kinds of applications for free too.

You can download Visual Studio 6. This doesn't use the .NET framework.

I checked MSDNAA and the earliest version they have is VS .NET 2003
 

hans007

Lifer
Feb 1, 2000
20,212
18
81
Originally posted by: George P Burdell
Thanks a lot for all the input. I decided to go with C#:

1. Vista has the .NET framework 2.0 installed by default, so the .exe works without problem.
2. I've already completed a working prototype with Visual Studio and C#.
3. As mcmilljb suggested, I can ask XP users to download the .NET framework.
4. I looked at MFC, but at my current level, it is beyond me.




the make them download the .net framework is why i dont use C# or .net at work. A lot of people use XP still or 2K.

If i could make them let me do that it would be a great reason for me to play with C# more.

Mfc dialog wizard for C++ is probably pretty easy, though I think the UI editor for visual C# and basic is supposed to be easier. Not sure if its any different with c++ 2008 , I have only used 2005.

That said, another advantage to using C++ is that if you are writing really tight code it is probably faster, and more portable as if you use win32 functions you can probably find an equivalent for say Unix especially if you have no windows.
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
That said, another advantage to using C++ is that if you are writing really tight code it is probably faster, and more portable as if you use win32 functions you can probably find an equivalent for say Unix especially if you have no windows.

Now that's funny, I don't believe I've ever seen someone use the word portable to describe win32.
 

Markbnj

Elite Member <br>Moderator Emeritus
Moderator
Sep 16, 2005
15,682
14
81
www.markbetz.net
Originally posted by: Nothinman
That said, another advantage to using C++ is that if you are writing really tight code it is probably faster, and more portable as if you use win32 functions you can probably find an equivalent for say Unix especially if you have no windows.

Now that's funny, I don't believe I've ever seen someone use the word portable to describe win32.

If you regard the various versions of Windows as "distros" then Win32 is about as portable as you would expect it to be.
 

clamum

Lifer
Feb 13, 2003
26,256
406
126
You can also add the .NET 2.0 framework into your installer program so it installs it automatically.