visual studio 2010 visual c++ problem to read command line args (macros)

2022-02-27T11:56:47.067+00:00

Hallo,

I have created a visual c++ app in visual studio 2010. I tried to pass some command line args which I set up in Project->Properties->Debugging, in particular some paths that required for the program to work ($(TargetPath) and $(ProjectDir)). See relevant code of the main class:

int main(array<System::String ^> ^args) //args is the array with the several paths I want to pass.
{
//MessageBox::Show(/args[0]/"1", "0.1", MessageBoxButtons::OK, MessageBoxIcon::Information);
// Enabling Windows XP visual effects before any controls are created
Application::EnableVisualStyles();

Application::SetCompatibleTextRenderingDefault(false);

// Create the main window and run it
Application::Run(gcnew Form1(args));
return 0;

}

When I run my app through visual studio the command line args are working properly and are passed into the software.
But when I install my software (through a set up I have created with visual studio) and trying to launch it, it seems that the command line args cannot be read properly, in particular whatever I have set in the command arguments textbox of the Project->Properties_>Debugging, I always take the $(TargetPath) and olny that. As a result the software fails to launch as it requires the other path too.

Developer technologies | Small BASIC
{count} votes

1 answer

Sort by: Most helpful
  1. WhTurner 1,611 Reputation points
    2022-02-27T12:36:13.957+00:00

    The tag "small-basix" is for Technical questions about Microsoft Small Basic, the only text-based language and IDE built for students to learn to code

    Please look for a more fittimg tag as your question in not about Small Basic e.g. the tag "C++"

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.