Coming from making Windows-only programs in C#, what steps are there for developing for Linux AND Windows? - windows

I want to start making a little window-based program that runs on both Linux and Windows flawlessly.
It must have a GUI. What are the things I should be reading about? I'm completely in the dark regarding this.
Thank you.

If you want to leverage your C#/.NET knowledge (IronPython,...), you should go with Mono. Its IDE is called MonoDevelop and works in Linux, Mac and Windows. You can keep using WinForms or switch to Gtk#, which is a nice wrapper around gtk+.
Also, make sure you read the application portability guidelines which covers different strategies and common pitfalls.
Enjoy!

You could try Java and run the same compiled bytecode in both places. Or try C++ with Qt or wxWidgets. With C++ though you will have to compile for each platform. Another possibility is Tcl/Tk

As a C# developer, I'd suggest Java with the Swing toolkit. NetBeans helps you get started easily, like Visual Studio.
Download, install, create a new prject, and there you have it; a form in front of you to drop controls and hook up to the code just like in VS + C#, except it's cross-platform (write once, run anywhere). And the language is very similar to C# (which was actually inspired by it). There are also countless books to help you get started with Java and GUI development in it too.
If you don't like Java for some reason, and you're willing to learn/use C++ (with extensions), have a go at Qt, and the Qt SDK, which includes a form designer as well, with a really nice IDE GUI. If you know C++, Qt should be a breeze. It's also cross-platform (write once, compile anywhere).
Good luck.

If you want to utilize your C# knowledge, you might want to have a look at Mono. But there are many, many other alternatives too.

Related

MS Windows Programming advice for Mac/Unix developer

I have a few years of experience writing Unix command line tools (no GUI experience) in python, C and C++, and only recently crossed into the GUI world (Cocoa and IOS only). I've learned quite a bit of objective-C and am getting to understand how cocoa MVC works. However, one of the apps I am developing needs a Windows version and I was wondering what a good place to start would be given that I have absolutely no Windows development experience.
I was thinking about using Visual C++ 2010 Express as my development platform (because it's free and because I don't need to learn C++). My application is relatively simple, it will have only two windows and spend most of the time running in the background. It will however need to communicate with the OS (load dll's etc) and an online server (HTTP methods) and I'm not sure whether Visual C++ Express edition gives me access to the required API's. Would a Windows Forms application suffice? Am I going about this the wrong way? Do I need to learn C#? Any advice will be appreciated.
If you are already happy with proper c++, visual Studio C++ express should suit you fine. Given that you are not making a complicated GUI, you don't even need to dip into the managed code - C++ express allows you to create proper c++ console and GUI apps. You also don't need to install the platform SDK - it is part of VS C++ express.
Not being managed C++, you will be able to share source files between your various projects. managed c++, despite the c++ in the name, really is a different enough language that it will be annoying to work with if you simultaneously have to deal with iso C++.
--
Note: The native windows API is a C api, not a C++ framework. So it does not provide a rich set of classes in a coherent framework to deal with. On the other hand, while, large, it is actually quite simple to work with.
Also: Given that you are already familiar with Mac development, there is a LGPL (iirc) package called CFLite that builds on windows and that implements the C api that underlays the Objective-C Cocoa API.
If you use its abstratcions you can share a greater part of code between windows and Mac (and other platforms).
Other C++ IDE's you might want to consider:
Code::Blocks
QT Creator
both of which can be configured to use the MINGW port of GCC to windows.
you'll be better off with c++ than c# if you need more "low-level" stuff. Loading dlls (that is, libs) is simple (pragma comment lib...), as is pure HTTP transfer and communication.
So, VC++ with windows form will suffice, and it is "very c++".
You have access to all global APIs, and loading specific apis like http requires only two lines: one to include wininet header, and other lib (libs are actually "references" to dlls).
If you go the C++ Express way then you need to install Windows SDK separately, and set it up for Visual Studio to use it. And you can't use MFC.
I would however, suggest C#, because it feels like putting little toy bricks together. Easier to debug and maintain. Problem with C# is that it has so many library functions that you can not possibly know if what you want is already made to a function. But that's why we are here :-) If you feel that something you want to do should already exist then ask a question about it. One notable feature that C# lacks is zip archives (it has something similar, but not quite). For zips you can use public libraries, like SharpZipLib or DotNetZip.
If I were you, I wouldn't jump into a whole new API so quickly. Have you considered using Python on Windows? Most of the Python packages I've seen are also available for Windows, so you'll feel at home. And if you need some GUI, you can opt for wxPython, pyGTK or something similar.
For Windows specific things, you can always use ctypes. Especially if they're as simple as loading a DLL.
have you considered approaching Adobe AIR? it allows you to deploy on Mac, Linux, Windows, iOS, etc. communicating with and launching native processes has been possible since 2.0 and the the latest 2.5 SDK can target Android OS and TVs. with your experience you should be able to pick up ActionScript3 / MXML in no time.
additionally, there are a handful of free IDEs you can use with the Flex and AIR SDKs. or, if you're a student or low-income developer, you can get a free copy of Flash Builder 4 from Adobe: http://www.adobe.com/devnet-archive/flex/free/
edit: i believe deploying AIR applications on iPhone requires Flash Professional CS5, which includes the packager for iPhone options. at the same time, i've read that AIR and other cross-compilers for iOS are painfully slow, so it's perhaps best to develop natively in Objective-C for iOS.

Need some pointers/hints in writing a Windows Application

I want to create applications in windows that has complete portability (within windows OSes of course). I have tried using one application written in Visual C++ but I had a real tough time in making it run in other windows OS (like it required .net framework libraries to be installed). This put me on the back foot because I had to copy a set of DLLs from one machine to another and most of the time something works some does not.
And I am TOTAL amateur in writing windows based applications since my technological forte is mostly Java. Where to kick off? (like which tools/IDEs to begin with since I am seriously into writing my own utilities/tools).
I am open to clarification should you guys feel my question is vague/blunt.
Thanks.
Visual C++ should be easily able to do what you want. It sounds like you created a C++/.NET project, which will generate a dependency on the .net libraries. You need to choose a different project type when the wizard starts up.
If you have a paid version of Visual C++, you might try clicking on "MFC Application". A lot of people are down on MFC these days, but it's still a quick way to get a C++ Windows app off the ground. Make sure you choose the option to statically link the MFC libraries, or you'll have another dependency.
MFC isn't included in the free version of Visual C++, so you'll need to go old-school and work directly with the Windows API or find another package such as QT or Wx to link with.
You can use .NET, and if you stay in 2.0, use standard components, it should work fine. You may need to make a few changes to work anywhere, buy very possible.
http://www.mono-project.com/Main_Page
You could either use Visual Studio or the free IDE. Sharp develope or Mono Develope.
If you really want it to work on every version of windows your best bet may be to go the route of full cross-compatibility. Grab the Boost, QT, and possibly ACE libraries and stay away from making OS calls directly. There's a free version of Visual Studio which is probably what you want for an IDE for personal development, if you're doing commercial stuff then get the full version.
Why not use Java. The JVM is on more systems then .NET and now your app will work on any OS not just windows. Plus java is easier for a beginner then C/C++ and less chance that your program will cause BSODs.

Programming language for GUI compilable to native binary

I need to write an app that reads a config file with info on the menu bars it needs to create.
Normally, I'd just use java, but I need the application to have the least run-time dependencies possible, this includes not forcing the user to download anything, even JRE, let alone something like NET Framework.
So I need something that can compile to an EXE (windows only for now), and that will allow me to CODE the GUI, so I can dynamically create it from my config.
BTW: something like C++ is a bit too low level, all I need is to create menus, and display HTMLs in a panel.
How about wxPython together with py2exe?
There is a nice tutorial on how to do it here.
If Java's too high-level and C++ too low-level, there ins't much in-between. Maybe Delphi?
I wouldn't totally write off using Java and/or Python for a few reasons.
1) py2exe can compile your Python code to an exe.
2) GCJ can compile your Java code to an exe.
Delphi is best chose for you. Because Delphi compile source code into native x86.
Unless you have serious reasons to avoid interpreted languages, I would suggest you better look into ways of packaging or compiling interpreted scripts because doing this will likely reduce your learning and development time.
I would write a simple GUI in Tcl/Tk, and then package it as a Starpack.
ActiveState provides a distribution (ActiveTCL) and a decent editor (Komodo Edit), and it is fairly easy to get simple GUIs going with Tk. Check out TkDocs for some hand holding.
Once you're done, you can package your code, a Tcl runtime, a database, and a virtual filesystem, all into a single executable that you can easily distribute.
Earwicker is right. You can use HTA:
http://www.interclasse.com/scripts/htanotepad.php
But if you know C++, then creating this type of an application is actually very easy with Visual C++. Use MFC, and statically link everything. You can draw the menu in the resource editor, and attach events to the menu items. I wouldn't use HTML if I were you. Just use regular Windows controls. But if you're really set on using HTML, you can embed a Browser control in the formview.
Have you considered D ? It has a syntax that is like a mixture of Java, C++ and Python with the ability to make native windows apps. The tutorials on dprogramming.com are great to get up and going with the language. For quick GUIs you'd be interested in The D Forms Library and the Entice Designer.
Here are some short video tutorials to get up and running with Entice.
Alternatively, have you tried Qt & Qt Creator? It takes a lot of the hair pulling out of C++ Programming and it's also cross-platform.
You say:
all I need is to create menus, and
display HTMLs in a panel.
A lot like a Web browser, then. If it's going to run on Windows, then the user has IE. Why not use IE to do all the work for you?
You can make something a lot like an .exe with IE, called an .hta:
http://msdn.microsoft.com/en-us/library/ms536496(VS.85).aspx

Create a small 'window-form' application that runs anywhere

I work in the embedded world, using mainly C and no GUI at all (because there is no display screen).
Moving over to the non-embedded world, in which I have nearly no experience, what is the best programming environment (langauge/IDE/etc) for me to build a simple window-form application that will run on all the common platforms: windows/linux/mac-os ?
I do not want to build a web-app.
I have my eye on Python and one of it's widget libraries, QT or WxWidgets. Is that a good option ?
I like GTK+ personally but that or any of the ones you mentioned should be OK. I don't know which is the best in terms of least RAM usage.
Both wx and QT have embedded/universal versions where the widgets are drawn directly.
They can both be called from python,but if you have a very small system python or py2exe might not be available.
Unless you want to embed HtmlWindow I'd go with wxWindows... works everywhere without problems so far for me.
I have both worked with PyQt and wxPython extensively.
PyQt is better designed and comes with very good UI designer so that you can quickly assemble your UI
wxPython has a very good demo and it can do pretty much anything which PyQT can do, I would anyday prefer PyQt but it may bot be free for commercial purpose but wxPython is free and is decent cross platform library.
Qt is a good choice to start with. In my opinion it has a best (easy to use, simple & informative) API Documentation. Package also includes many examples - from very basic to complex. And, yep, it`s truly crossplatform.
Check Qt Licensing page, the library is free only for GPL projects.
I`m using QDevelop as text editor, but there are many other alternatives - Eclipse, KDevelop, Code:Blocks, VS plugin & etc.
Why not use swing and java? It is quite cross platform, and looks reasonable for form apps. If you squint a bit and ignore the java, its quite pleasant - or alternatively, use one of them dynamic languages on the JVM (Groovy is my recommended one).
What kind of application is it going to be? Have you considered a web-based application instead? Web-based apps can be super flexible in that sense - you can run them on any platform that has a modern browser.
By far the simplest choice for creating native cross-platform applications is REALbasic. Give it a try and you'll have a working app for Mac OS X, Windows and Linux in minutes. No run-times or other stuff to worry about.
I think you should try Html Application.It is something like web page it contain DHTML,java script,ActiveX but it is execute like .exe .
Edit:
Sorry for advice you html application.I just know it can run on windows only.

Good resources for writing console style applications for Windows?

For certain programs nothing beats the command line. Unfortunately, I have never seen good documentation or examples on how to write console applications that go beyond "Hello World". I'm interested in making console apps like Vim or Emacs. Well not exactly like Vim or Emacs but one that takes over the entire command prompt while it is in use and then after you exit it leaves no trace behind. I know that on Unix there is the curses library but for Windows? ...
PDCurses works on Win32.
I found List of Console Functions on msdn, PDCurses, and The Console Module.
You can certainly write that kind of application with Delphi, which has reasonable commandline support. People often overlook that Delphi can build any kind of Windows executable, not just GUI apps.
I don't know off-hand if the free 'Turbo' edition of Delphi has anything cobbled into it to PREVENT you from using it to build console apps - I would have thought it would be fine for this kind of thing.
There is a small but good tutorial on using C++ for the Windows console at www.benryves.com/tutorials/?t=winconsole&c=all going as far as coding a simple painting program.
You could also try Free Pascal. It is a free ((L)GPL) Object Pascal compiler which is compatible with the Delphi-compiler. It has an console-based IDE, which proves that you can make very good console-applications with it, and which you can use as an example.
If you want to use a graphical IDE to build your console-application, you can download the Lazarus IDE.
As a bonus your application will run on Windows (32/64 bit), Linux, Mac OS X, FreeBSD, Solaris etc...
In Windows or DOS, I used the conio library from Borland. It's very old but fine enough for a beginner like me.
As Robsoft says Delphi would be a good start. There is Turbo Delphi (Pascal based) or Turbo C++ both free editions.
web site here.
http://www.turboexplorer.com/
Check out some of the mono libs. They have a great one to parse command line arguments but can't remember the namespace.
Miguel just posted some terminal code as well.
For ncurses-like library/framework on Windows, I'll highly suggest to get your hand dirty with PDCurses.
If you trying/using C#, there's Curses-Sharp.
This is the best tool for it I've ever seen!!
1) Create any application using VB6 IDE
2) Convert it to Console Application, using THIS!

Resources