1.先用Visual Studio 2017打开Yichip YC31xx loader.vcxproj,再用Visual Studio 2022打开。再保侟就有.sln文件了。
易兆微芯片下载工具加开机动画下载
ExtraDownloadFile1Info=.\logo.bin|0|0|10D2000|0
MFC应用兼容CMD
在BOOL CYichipYC31xxloaderDlg::OnInitDialog()
cpp
// 处理命令行参数
int argc = 0;
LPWSTR *argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc);
if (argc == 1)
{
runAppByCmd = false;
}
else
{
runAppByCmd = true;
downloadByCmd(argc, argv);
}
在类头文件里
cpp
/**
* \brief 退出通过命令行启动的程序
* \param int errorCode
* \return
*/
void exitByCmd(int errorCode)
{
theApp.m_responseCode = errorCode;
SendMessage(WM_CLOSE);
}
void downloadByCmd(int argc, LPWSTR *argv)
{
// 三个参数时,第一个为该exe,第二个为串口号,第三个为待下载文件的绝对路径,使用argv[索引]获取参数值。
// 第四个为命令行调试开关,为可选参数。只接受-d/-D。其他参数不能开启命令行调试
// eg:YC31xx Loader.exe com20 [文件]
// 检查debug开关
if (!availableDebuggingParameter(argv))
{
ModifyStyleEx(WS_EX_APPWINDOW, WS_EX_TOOLWINDOW); // 任务书栏不显示
SetWindowPos(&wndBottom, 0, 0, 0, 0, SW_HIDE); // 隐藏ui,但是messageBox照样可以生效
}
if (argc == 4 || argc == 3)
{
if (processInputParamsNotIncludeDebug(argv))
startDownload();
}
else
{
tip("The number of parameters is incorrect", 102);
}
}