如题。
鄙人正在独自写一个文件加密软件,想完成以下动作:右击多个文件,调用一个MFC exe程序加密选中的文件--这些文件的路径、名称通过类似命令行参数的形式获得。
最好给个示例,谢谢!
鄙人正在独自写一个文件加密软件,想完成以下动作:右击多个文件,调用一个MFC exe程序加密选中的文件--这些文件的路径、名称通过类似命令行参数的形式获得。
最好给个示例,谢谢!
解决方案 »
- WPF中,如何获取控件所绑定的资源名称?
- C#如何判断richtextbox中的图片和文字?
- C# winform 怎么实现点击DataGridView 控件单元格更新数据库中数据的问题
- MenuStrip_click事件如何得到单击的是菜单的哪个项和他的name属性
- .net
- api函数定义的问题
- 为什么同时取得同一个窗体的句柄不一样???
- 国内外著名的PDA开发网址.
- C# , GDI+ 能不能画出,一个段落内,含有多种字体呢?
- 想学习做erp.mrp.进销存等软件.但对这些很模糊.请介绍关于这些的电子书(我下载)和思想.
- 关于xml文件存储方法名的问题
- 网页的页面后缀名导致调试时无法打开
path\jiami.exe 文件完全路径1;文件完全路径2;......
控制台应用程序我知道怎么做: main函数可带命令行参数
1.覆写CXXXApp的基类的成员函数void CWinApp::ParseCommandLine(CCommandLineInfo& rCmdInfo)以执行你想要的操作.
例如:
[code]
void CMyProgramApp::ParseCommandLine(CCommandLineInfo& rCmdInfo)
{
LPCTSTR pszParam = __targv[1];
//以消息框形式输出它的第一个命令行参数,第零个参数为应用程序名称本身
MessageBox(NULL,pszParam,"MyProgram.exe",MB_OK);
return;
}
[/code]
2.在InitInstance函数中可以这样写以示对命令行参数的处理:
[code]
BOOL CListApp::InitInstance()
{
AfxEnableControlContainer(); // Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
... ...
}
[/code]
1.覆写CXXXApp的基类的成员函数void CWinApp::ParseCommandLine(CCommandLineInfo& rCmdInfo)以执行你想要的操作.
例如:
void CXXApp::ParseCommandLine(CCommandLineInfo& rCmdInfo)
{
LPCTSTR pszParam = __targv[1];
if(NULL != pszParam)
{
MessageBox(NULL,pszParam,"XX",MB_OK);
}
return;
}2.在InitInstance函数中可以这样写以示对命令行参数的处理:
BOOL CXXApp::InitInstance()
{
AfxEnableControlContainer(); // Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
//以下为添加的代码
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
... ...
}