Wrox Programmer Forums
|
C++ Programming General discussions for the C++ language. For questions specific to Microsoft's Visual C++ variant, see the Visual C++ forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C++ Programming section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old July 10th, 2005, 03:02 PM
Registered User
 
Join Date: Jul 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default C Help!

Ok, I'm trying to write a tool for my company. I graduated from college a few years back, and unfortunately the job market for programmers in Oregon was almost nil, so I started getting some tech support jobs.

Well I'm currently working for a good company as tech support and I'm trying to show my programming skills by creating some tools I can submit and hopefully start edging over into the dev teams.

Anyway, sorry for the life story here.

I developed this quick and easy tool that was modifying registry entries in c# because of some functionality they took out of the software but was still pretty vital for our program. Unfortunately because of the .net framework requirements they aren't accepting the tool.

So I'm re-writting the tool in c++, and I'm going back over one of my old GUI programs I made in college (a very simple chess game), and I'm noticing that winmain is using the following items

HINSTANCE hInstance
HINSTANCE hPrevInstance,
PSTR lpszCmdParam,
int nCmdShow

not that the object names are a big deal, these are obviously the items required to do the message pump in c based windows, but one of the requirements my tools team wants is a command line arguments to not load the GUI interface

so if I call program.exe /?

it will return information without loading the GUI.

Now here is the conundrum. My programs that are command line driven all have the int argc's and char* argv[] of course this is directly the number of commands and their text portions.


So the problem I see here is that since I'm trying to make a GUI and a command line program (so it can be ran silently on servers remotely) I was under the impression you couldn't overload main, so I'm just wondering if there is a way I can create something that can do both of those?

Any ideas, suggestions would be greatly appreciated


Reply With Quote
  #2 (permalink)  
Old July 12th, 2005, 08:49 AM
Registered User
 
Join Date: Jul 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

ok.. I think I found some information

I guess with gui programming with c/c++ you have some sort of function that gets the command line arguments.

Anyone know what that function is or any references to usage?
Reply With Quote
  #3 (permalink)  
Old July 12th, 2005, 11:29 PM
Authorized User
 
Join Date: Jul 2005
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

In my uderstanding, what you need here is a good Object Oriented design, where you can pass paramaters both form the command line and the GUI program to the business logic processing.

If you could abstract the logic that does the main job, it would be all about parameter passing.

John Dirk
Programming Consulant
http://www.programminghelp4u.com - Programming (Assignment/Project) Help
Reply With Quote









Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.