Question:
How can I make my old C programs work with Windows GUI?
2010-11-28 08:46:29 UTC
I've written some Mechanical Engineering programs 10 years ago but now everything is in windows so some don't work from the console. The C++ and C# stuff looks painful for my occasional use. VB looks great for most simply creating the user interface. Can I use VB and pass variable to C all in MSStudio?
Four answers:
husoski
2010-11-28 10:42:09 UTC
Odd. For just using forms-designer user interfaces, there is almost no difference between C# and VB.NET. Either way, you have to dance around with Platform Invoke and shuffling parameters in and out of "unmanaged" code. If you use VB6 forms, though, those are Windows native rather than .NET, so they are closer to your old C than any .NET option. There only forms designer options you have with unmanaged C/C++ is for dialog boxes.



If you already speak C fluently, you have only two things to add to your arsenal to pick up and use C++ effectively: classes and templates...and you don't really need to know that much about templates just to use the templated standard library classes. Lots of working C++ programmers don't either. I mention that because there are a couple of other ways to "go windowed" with your programs using 3rd party toolkits. Qt (pronounced "cute", for some cute reason) comes to mind because it has a free IDE (Qt Creator) for developing cross-platform GUI apps with standard C++ (rather than the "managed" variety that Microsoft requires for .NET apps.)



I see in the Wikipedia entry for Qt, that you can also use it with a number of other languages too. So, maybe I need to take a look at it again...



Qt Home: http://qt.nokia.com/



Other free options include GTK+ and WxWidgets. I don't know of forms-designer tools for these, but I don't know that they don't exist either! GTK+ is written in C, so it may be the most compatible with what you already have.



GTK Home: http://www.gtk.org/



The only thing I know about WxWidgets is that it is one of the "other" GUIs that you can use with Python. (I use tkinter for that, but I don't do a lot of GUI+Python.) It's written in C++ and is self-described as "mature":



WxWidgets Home: http://www.wxwidgets.org/
2010-11-28 08:56:54 UTC
Are these DOS programs? You can use the Windows API with basically any language so all you'd have to do is rewrite the UI portion of the program to use it in C leaving the program logic itself intact. The complexity of this depends on the modularity of your program; if the UI code and the logic code are put together then you may as well rewrite the whole thing for Windows.



C++ is the same as C. The Windows API has no C++ version so you'd be using the C API anyways. C# is totally different however. The advantage of C# is that you can get Microsoft Visual C# Express for free which comes with a GUI designer (called 'form designer' in the C# world) which is very intuitive and integrates very well with the rest of the IDE. For example, if you double-click on a button it will take you to the code for when that button is clicked. Of course it'll take a learning curve but in the end it's worth it. There are GUI designers like this for C and C++ but none are as modern as C# because the C# language itself was designed with this facility in mind while C and C++ are more low-level and both were created before GUIs even existed.



As for Visual Basic, well, you have two options: VB6 which was created in 1998 (obsolete, you may as well get Visual C++ 6 which is from the same year), and the new .NET versions which are basically C# with Basic-style syntax. It uses the same .NET Framework and Visual Studio facilities that C# uses, so most people favor C# when compared to VB.NET because not many programmers like the Basic syntax.



Personally I recommend rewriting your programs for C#. The Windows C API can be a little tedious since it's so old and it has been mended so many times since its introduction in the early 90s.



Good luck!
scarpaci
2016-10-18 11:33:25 UTC
try "window programming for dummies" (don't be offended by skill of the word 'dummies', the e-e book has nicely starter for newbie). additionally, inspect your library first earlier than paying for one your self. keep that funds for extra advance Window programming e-e book.
Gopinath M
2010-11-28 09:21:43 UTC
dont know....



but u can use turboc.exe the older version. in xp... or dos..



install virtualbox or dosbox and ur old C pgms wil run...


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...