Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Parameters argc,argv

Status
Not open for further replies.

adasilva

Programmer
Joined
Aug 16, 2000
Messages
5
Location
DE
Dear Colleagues,
If someone knows how can I use a similar parameter as argc, argv in Visual C++ 4.2, please tell me.
Regards
 
void main( char* argv[], int argc){
printf("arg0: %s\r\n", argv[0]);
}

If that is not what you mean, be more specific.

-pete
 
Ok Thanks Dear Pete,
But in VC++ I believe that we can't use as you show:
void main( char* argv[], int argc){
printf("arg0: %s\r\n", argv[0]);
}

But the program works only with the standard WinMain:
int WINAPI WinMain( HINSTANCE hInstance, // Instance
HINSTANCE hPrevInstance, // Previous Instance
LPSTR lpCmdLine, // Command Line Parameters
int nCmdShow) // Window Show State

And it always doesn't give me the parameters argv and argc, as I need.
Kind regards,
Adasilva


 
I`m using this:

CString strNomeSenha;
strNomeSenha = AfxGetApp()->m_lpCmdLine; //Obtem arg. da linha de comando (N=nome/S=senha)
if ( strNomeSenha.GetLength() != 0 )
{
if ( strNomeSenha.Left(2) == "N=" )
{
m_socket->m_strNome = strNomeSenha.Mid(2,8);
m_socket->m_strSenha = strNomeSenha.Right(8);
m_socket->m_bDontShowLogin = TRUE;
}
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top