Monday, January 08, 2007

Command Line Arguments -- C++ / VS2005

http://msdn2.microsoft.com/en-us/library/system.environment.getcommandlineargs.aspx
public:
static array^ GetCommandLineArgs ()

VS2005

TCHAR fn[MAX_PATH];
BOOL CDumpApp::InitInstance()
{
...
CDumpDlg dlg;
m_pMainWnd = &dlg;
{
// LPTSTR theApp.m_lpCmdLine;
_tcscpy(fn,theApp.m_lpCmdLine); //LPTSTR to TCHAR *//

}

INT_PTR nResponse = dlg.DoModal();
...

比較好是放在 xxDlg.cpp
TCHAR fn[MAX_PATH];

BOOL CDumpDlg::OnInitDialog()
{
_tcscpy(fn,theApp.m_lpCmdLine); //LPTSTR to TCHAR *//
ShowFileName();
...

No comments: