你可以用GetCommandLine获得整个命令行。 不过AppWizard生成的代码中,InitInstance中包括如下代码: // Parse command line for standard shell commands, DDE, file open CCommandLineInfo cmdInfo; ParseCommandLine(cmdInfo);
// Dispatch commands specified on the command line if (!ProcessShellCommand(cmdInfo)) return FALSE;
不过AppWizard生成的代码中,InitInstance中包括如下代码:
// Parse command line for standard shell commands, DDE, file open
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
// Dispatch commands specified on the command line
if (!ProcessShellCommand(cmdInfo))
return FALSE;
这是MFC程序处理命令行的部分,如果你不希望它们影响你的程序,可以注释掉。
我根本找不到C++语言中 main( )函数中的那样的arg[n]之类的东西.
HANDLE CreateFileMapping(
HANDLE hFile, // handle to file
LPSECURITY_ATTRIBUTES lpAttributes, // security
DWORD flProtect, // protection
DWORD dwMaximumSizeHigh, // high-order DWORD of size
DWORD dwMaximumSizeLow, // low-order DWORD of size
LPCTSTR lpName // object name
);
HANDLE OpenFileMapping(
DWORD dwDesiredAccess, // access mode
BOOL bInheritHandle, // inherit flag
LPCTSTR lpName // object name
);具体用法你可以在msdn上的到帮助
第二个就是命令行啦
是这个意思吗
比如说命令行是 MyProgram 25 30
我在我的MyProgram程序中如何取得 25 和 30 这两个参数?