Does anyone know how to have a windows program accept command line options?

For example a terminal program just needs a parameter in the main function to accept command line parameters, how can I do the same for a windows main functions, since parameters are already there?

From the Win32 API reference (as supplied by Microsoft):

int WINAPI WinMain(

    HINSTANCE hInstance,	// handle to current instance
    HINSTANCE hPrevInstance,	// handle to previous instance
    LPSTR lpCmdLine,	// pointer to command line
    int nCmdShow 	// show state of window
   );

lpCmdLine

Points to a null-terminated string specifying the command line for the application.

You're not getting it as a nice array of commandline arguments but you are getting it.

Full helpfile is available here: http://www.borland.com/devsupport/borlandcpp/patches/BC52HLP1.ZIP (it's a Microsoft file supplied by Borland including complete search index).

thanks a million!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.