• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Best approach for a simple, light GUI to run existing command line utils

manko

Golden Member
I have a group of a few old small ANSI C unix command line utilities that I have compiled with MinGW to work on Windows. (I didn't write them.)

I want to create a small, self-contained Win32 GUI .exe to run these utilities without requiring the user to download other runtimes or the .NET framework. The group of files is around 400KB uncompressed and I'd like the GUI to end up around 500-1000KB.

The GUI has to let a user select or drag and drop a file, set a handful of options, then run the .exe with the user selected parameters in a command line window.


I'm most familiar with VC# Express, but I'm not sure if I can make something small and completely self-contained with it, so I started looking into other possibilities.

Can I make a light, self-contained .exe with VC++ 2008 Express that doesn't require anything other than a standard Windows XP system?

I looked into wxDevC++ which seemed like it might be a good choice, but in practice I ran into errors and also wxWidgets errors and the wxDevC++ project doesn't seem to be updated or widely used, so I decided to try something else.

I thought I would go old-school and dug out Delphi 7 and it actually seems to be working fairly well. I'm part way through the project, but as I look up certain issues it seems that the old Delphi is so out-of-date I wondered if there might be a way to do something as small and simple in VC++ Express without requiring any additional files outside of the program folder.

This is mainly a learning exercise, though the GUI will be useful for me and others. I don't mind trying new things or different approaches. Even if I decide to finishing the program in Delphi, I also might try to rewrite it in VC++ or something else depending on your suggestions, just to see how it goes and compare the results.

Any thoughts or suggestions?
 
Yeah. If you use the old-school MFC library for creating your gui (Visual C++ 6 or higher), then you won't need anything other than a standard Windows XP installation. MFC is archaic and a pain to use, but it will definitely be self contained and small.
 
The issue is that you will have to know the command line parameters for each application or expect the user to know them.

I have not heard of a way to drill inside an application to find out what the options are.

Some application will provide a list of options when requested (internl help) but that is application dependant.
 
He has the source code to these programs, so it can't be too hard to figure out how it's parsing the argv. The GUI could easily encapsulate this process from the user... which is what I think he's going for.
 
VC++ unmanaged with MFC and the "dialog-based app" project type is a lot like VB6 -- drag and drop buttons / controls onto a form then use ClassWizard to attach meesage handler functions to the buttons.

You can statically-link the MFC library and C++ runtime so you have a single EXE file to copy onto a system, no install needed.

I don't know if this can be done in Express though.
 
Originally posted by: slugg
He has the source code to these programs, so it can't be too hard to figure out how it's parsing the argv. The GUI could easily encapsulate this process from the user... which is what I think he's going for.

Overlook the issue that he has the source😱

 
Thanks for the replies.

Originally posted by: DaveSimmons
VC++ unmanaged with MFC and the "dialog-based app" project type is a lot like VB6 -- drag and drop buttons / controls onto a form then use ClassWizard to attach meesage handler functions to the buttons.

You can statically-link the MFC library and C++ runtime so you have a single EXE file to copy onto a system, no install needed.

I don't know if this can be done in Express though.
That sounds like something I might try. Does anyone know if Express will do that?

In VS C# Express when I publish an application, I get two files:

program.application
setup.exe

Then you run setup.exe and it connects to the internet to check if you have the .NET requirement.

Then it puts a Shortcut in your Programs menu, which points to the program.application file.

The setup also creates a program/Application Folder with

program.application
program.exe.deploy
program.exe.manifest

When you click the shortcut it connects to the internet again, then if it's happy it runs the program.

Also, there is no uninstaller. You have to go to Add Remove Programs to properly uninstall it.


All I want is an small and simple .exe to click and run. For this GUI I don't want all the extra baggage of the other files, setup, connecting to internet or checking and downloading runtimes.


Originally posted by: Common Courtesy
The issue is that you will have to know the command line parameters for each application or expect the user to know them.
I have all the parameters. This GUI will let you browse for your file, then have pulldowns and radio boxes or buttons for the various options, then spit out the string in one line to the commandline. (Currently using CreateProcess in Delphi). Then the command line program processes the file and creates a new one.

This is just a very basic GUI for people who can't bother typing commands. That's one of the reasons I don't want to require a framework for such a small simple thing.
 
Well, I'm looking into getting VC++ 2008 Express to run WTL, ATL and/or MFC. Most of the guides I've found are for VS 2005 and involve installing the Microsoft Platform SDK, then copying around files and changing paths and include files. But some negative comments about these methods say that some of the libraries are still missing depending on what you're doing. Also the ATL is supposed to be and older 3.0 version.

What I'm going to try first is a guide I found for the new "Windows SDK for Windows Server 2008 and .NET Framework 3.5" which supposedly replaces the old Microsoft Platform SDK, but I'm not sure it will include and enable all the old MFC/ATL functionality. I'm thinking it might work with WTL 8.0, but that still requires some changes, since it was made for VS 8 instead of VS 9.


I'll see how far I get. So far, it seems to be an incredible hassle. I suppose MS really just wants everyone to have .NET or else they want to make you jump through a lot of hoops to write plain old Win32 programs. If I can get it to work, I'll still find it amazing what needs to be done to get something working the same (for the end user) as the old Delphi I'm using.


In my searches, I turned up more recommendations for wxWidgets, so I may take another look at that if I run into a brick wall with WTL.


I also found a very basic framework, Win32++ which seems like it might fit my basic needs for this program. It's described as a very simple and light alternative to MFC and WTL. I may also give it a try.


An interesting bit of trivia, Dev-C++ was apparently written in Delphi 6.


Update: Well, I installed the latest Windows SDK and it turns out not to have ATL, so it won't let me use WTL yet. Next, I'm going to try the older ATL files from the Platform SDK.

While I've been waiting for all these downloads and installs, I've been reading up and it seems like it I may be able to make statically linked program file with the .dlls included.

I also found the Inno Setup installer maker which might also get around having to install a full .NET runtime.


I just don't want to end up with a 20-30MB install for a GUI to send a few commands out to <100KB console applications.
 
VCExpress will not run MFC, and I believe it also won't support ATL. You would end up coding in the IDE, but compiling with the SDK.
 
Originally posted by: SunnyD
VCExpress will not run MFC, and I believe it also won't support ATL. You would end up coding in the IDE, but compiling with the SDK.
Thanks, I'm slowly realizing that. I think it might be able to support some of the old ATL 3.0 from the 2003 Server Platform SDK, which would let me try WTL.

However, I'm getting the feeling that I'm going down the wrong path.

I think that VS Express will not allow me to make a simple, light, self-contained .exe, at least not easily.

What I had in mind was putting together a quick GUI and simple code with VS, then spitting out a tiny .exe like the old Delphi, but I don't think that's what Microsoft had in mind with Express (and definitely not with .NET).

I'm going to try doing a static linked Win32 app in VC++ and see if I can get it to run without requiring a full .NET install.

Anyway, it continues to be a good learning experience.
 
Originally posted by: SunnyD
VCExpress will not run MFC, and I believe it also won't support ATL. You would end up coding in the IDE, but compiling with the SDK.

Wow... that is seriously lame. I may have to learn .NET eventually.
 
Originally posted by: DaveSimmons

or get the full Visual Studio instead of Express 🙂

Hmm, making a free GUI for a handful of free 50KB unix utils...I'll think about it. In the meantime, I'm taking donations.

I'm still working on it though, right now I'm trying to get wxWidgets to work, but running into problems with the initial build, installation and configuration.

In all my searches though, I've come across hints from MS developers that they actually may put some MFC functionality into the next version of Express. I'll have to wait until 2010 for that though.


Update: I have wxWidgets working now (no thanks to the main wiki guide). So, now I can finally move on to bigger and better things.
 
two things you can do. If I understand you right.

1. Put all your .exe's in one folder. then make a simple gui with visual basic 6 that calls the exe's in the current directory when you click on button x, y, etc...
2. Use NSIS to install your .exe's and the gui .exe you make into the program folder then have the gui call the .exe's from their path.

I only suggest visual basic 6 because it is incredibly easy and it will make stand alone .exe's. And of course there are many alternatives to the visual basic 6 idea.
 
Hmm, making a free GUI for a handful of free 50KB unix utils...I'll think about it. In the meantime, I'm taking donations.

Ah, I assumed these were for use at work. For us a tool that saves a day's work has already paid for itself.
 
Originally posted by: DaveSimmons
For us a tool that saves a day's work has already paid for itself.
I absolutely agree for any situations involving income. This is more of a learning exercise.

Anyway, I'm now over the initial hump and getting familiar with wxWidgets. I still not sure I have the right settings for making it self-contained (since I have all the runtime on my system), but I have some useful links and I'll test it on a system without .NET or any special runtimes when I get to that point.

So far, a minimal test program compiled for release is weighing in just over 1MB. That may go up another meg or two when I start adding more components.

For comparison, the Delphi 7 version which is further along weights in at 400KB

For a simple, quick and light self-contained GUI like this, Delphi definitely seems like it has the edge, in size and time spent. I also found the open source, cross platform Lazarus Project, which is very similar to the old Delphi, but is still being updated today.

I'm also new to Delphi, but I really wanted to look into a range of alternatives that might fit the bill.

For a bigger, more involved project with more advanced requirements, I would probably use C# Forms or WPF and wouldn't worry about the .NET requirement, but .NET just seems like overkill for a tiny GUI app.

Originally posted by: net
two things you can do. If I understand you right.

1. Put all your .exe's in one folder. then make a simple gui with visual basic 6 that calls the exe's in the current directory when you click on button x, y, etc...
2. Use NSIS to install your .exe's and the gui .exe you make into the program folder then have the gui call the .exe's from their path.

I only suggest visual basic 6 because it is incredibly easy and it will make stand alone .exe's. And of course there are many alternatives to the visual basic 6 idea.
Thanks for the suggestion. I don't have VB6, but that's the equivalent of what I was doing with Delphi.

It's just fun to learn new things and see how much more painful it is to get VC++ Express to do the same thing for free.


As I've been looking into my options, I've thought about attempting some a basic OpenGL display, so in that case, being able to do it in VC++ will give me the option for try some more advanced features later.






 
It's just fun to learn new things and see how much more painful it is to get VC++ Express to do the same thing for free.

Once you get it working using VC++ please post the code here. I would be very interested myself. thanks in advance! 🙂
 
Originally posted by: net
Once you get it working using VC++ please post the code here. I would be very interested myself. thanks in advance! 🙂

Well, I'm sure my code is not display quality. Anyway, the tricky thing was just figuring out what was needed and setting it up.

VC++ Express
Microsoft SDK
wxWidgets
wxFormBuilder

I'm just following the samples that are included with wxWidgets. The functional code will not be much more than the equivalent of a batch file or the most basic console program you can imagine (select a file, input a few settings, output a string).

 
Back
Top