Re: How to suppress All the UIs in MFC application
Uday wrote:
Hi,
I have one Wizard application ( using CPropertySheet and
CPropertyPage ) ready with me which gets some inputs from user
through UI.Now I want the application to take input from command line
and run it, so how do I suppress all the UIs in my application (
including Messageboxes ).
There's no systematic way to "suppress" the UI - you have to write code to
make your program work both ways.
One approach:
- Refactor your program into a GUI (a .exe) and the actual business logic
(guts) of the program (a .dll)
- Write a new console application (.exe) that parses information from the
command line and passes it to the same guts (.dll)
If you take that approach, you can take advantage of a quirk of the command
shell:
- Name your GUI shell MyProgram.exe
- Name your command line shell MyProgram.com
- Make the console application run the GUI application if no command line
parameters were specified.
Create shortcuts, etc, for the GUI so they reference MyProgram.exe, as a
user would expect. But when a user runs MyProgram from the command line,
the windows shell will find MyProgram.com before it finds MyProgram.exe, so
the command-line user gets the command-line experience while the GUI user
get the GUI experience.
-cd