文章目录
- 小工具 - 用Astyle的DLL封装一个对目录进行代码格式化的工具
- 概述
- 笔记
- 效果
- 编译AStyle的DLL
- 初次使用接口的小疑惑
- 测试程序 - 头文件
- 测试程序 - 实现文件
- 测试程序 - RC
- 备注
- END
小工具 - 用Astyle的DLL封装一个对目录进行代码格式化的工具
概述
上一个实验(vs2019 - astyle-extension 扩展插件的编译与使用)用Astyle的vs插件,在VS中,已经可以很方便的对实现文件或者选定的代码进行格式化。
正好想对自己手头要完工的工程进行入库前的全部格式化。
如果在VS中,手工逐个对文件进行格式化,那就蠢的连自己都看不过去。
以前做代码格式化,都是用AStyle.exe对单个文件做格式化。控制的粒度不够细,如果出了错误,也不知道啥错误。
想按照VS插件那样,用AStyle的dll封装一下,做个应用给自己用,实现对目录中实现文件的格式化。
用了2天,搞定。
遍历目录中的(.h, .cpp), 自动进行格式化。如果报错,就断言。
笔记
效果
编译AStyle的DLL
最好Debug/Release都编译了,可以和自己APP的Debug/Release版对上。
头文件只有2个
初次使用接口的小疑惑
psz_rc = AStyleMain(pSourceIn, pszOption, my_fpError, my_fpAlloc);
AStyleMain的参数1为pSourceIn 看起来像是要送入的源文件。
将pSourceIn赋值为源文件全路径名称(e.g. “d:\my_tmp\test.cpp”)
执行的没错,但是用BC4比较格式化完的文件与备份,发现没任何变化…
去查看AStyle自带的测试工程,才发现,原来pSourceIn是要格式化的文件内容…
测试程序 - 头文件
// myAstyleAppDlg.h: 头文件
//#pragma once#include <string>// CmyAstyleAppDlg 对话框
class CmyAstyleAppDlg : public CDialogEx {// --------------------------------------------------------------------------------// my code begin// --------------------------------------------------------------------------------public:typedef bool (CmyAstyleAppDlg::*PFN_CB_FindFile)(CString csFilePathName);private:bool code_format_dir(const TCHAR* pszDirPathName, const char* pszOption);bool code_format_file(const TCHAR* pszWFilePathName, const char* pszOption);std::string my_W2A(std::wstring strW);size_t getFileSize(const TCHAR* pszFilePathName);bool ReadFileToBuffer(const TCHAR* pszFilePathName, uint8_t*& pBuf, int& lenBuf);bool WriteBufferToFile(const TCHAR* pszFilePathName, const uint8_t* pBuf, int lenBuf);bool findDir(CString csDirPathName, PFN_CB_FindFile pfn);bool CB_FindFile_code_format(CString csFilePathName);bool isObjFile(const TCHAR* pObjPostFix);bool addTip(CString csMsg);CString BrowserDir(CString DirToBrowser);int m_iProcessOk;// --------------------------------------------------------------------------------// my code end// --------------------------------------------------------------------------------// 构造public:CmyAstyleAppDlg(CWnd* pParent = nullptr); // 标准构造函数// 对话框数据#ifdef AFX_DESIGN_TIMEenum { IDD = IDD_MYASTYLEAPP_DIALOG };#endifprotected:virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持// 实现protected:HICON m_hIcon;// 生成的消息映射函数virtual BOOL OnInitDialog();afx_msg void OnSysCommand(UINT nID, LPARAM lParam);afx_msg void OnPaint();afx_msg HCURSOR OnQueryDragIcon();DECLARE_MESSAGE_MAP()public:afx_msg void OnBnClickedOk();afx_msg void OnBnClickedCancel();afx_msg void OnBnClickedButtonAstyleDir();afx_msg void OnBnClickedButtonSeclectDir();CString m_csDir;CString m_csAstyleOption;CString m_csTip;CEdit m_ctrlTip;
};
测试程序 - 实现文件
// myAstyleAppDlg.cpp: 实现文件
//#include "pch.h"
#include "framework.h"
#include "myAstyleApp.h"
#include "myAstyleAppDlg.h"
#include "afxdialogex.h"
#include "CLsFileDialog.h"#include "astyle_main.h"
#if defined(_DEBUG)#pragma comment(lib, "AStyle31d.lib")
#elif defined(NDEBUG)#pragma comment(lib, "AStyle31.lib")
#else#error "error, please modify code!"
#endif#ifdef _DEBUG#define new DEBUG_NEW
#endif// 用于应用程序“关于”菜单项的 CAboutDlg 对话框class CAboutDlg : public CDialogEx {public:CAboutDlg();// 对话框数据#ifdef AFX_DESIGN_TIMEenum { IDD = IDD_ABOUTBOX };#endifprotected:virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持// 实现protected:DECLARE_MESSAGE_MAP()
};CAboutDlg::CAboutDlg() : CDialogEx(IDD_ABOUTBOX) {
}void CAboutDlg::DoDataExchange(CDataExchange* pDX) {CDialogEx::DoDataExchange(pDX);
}BEGIN_MESSAGE_MAP(CAboutDlg, CDialogEx)
END_MESSAGE_MAP()// CmyAstyleAppDlg 对话框CmyAstyleAppDlg::CmyAstyleAppDlg(CWnd* pParent /*=nullptr*/): CDialogEx(IDD_MYASTYLEAPP_DIALOG, pParent), m_csDir(_T("")), m_csTip(_T("")), m_csAstyleOption(TEXT("")) {m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}void CmyAstyleAppDlg::DoDataExchange(CDataExchange* pDX) {CDialogEx::DoDataExchange(pDX);DDX_Text(pDX, IDC_EDIT_DIR, m_csDir);DDX_Text(pDX, IDC_EDIT_ASTYLE_OPTION, m_csAstyleOption);DDX_Text(pDX, IDC_EDIT_TIP, m_csTip);DDX_Control(pDX, IDC_EDIT_TIP, m_ctrlTip);
}BEGIN_MESSAGE_MAP(CmyAstyleAppDlg, CDialogEx)ON_WM_SYSCOMMAND()ON_WM_PAINT()ON_WM_QUERYDRAGICON()ON_BN_CLICKED(IDOK, &CmyAstyleAppDlg::OnBnClickedOk)ON_BN_CLICKED(IDCANCEL, &CmyAstyleAppDlg::OnBnClickedCancel)ON_BN_CLICKED(IDC_BUTTON_ASTYLE_DIR, &CmyAstyleAppDlg::OnBnClickedButtonAstyleDir)ON_BN_CLICKED(IDC_BUTTON_SECLECT_DIR, &CmyAstyleAppDlg::OnBnClickedButtonSeclectDir)
END_MESSAGE_MAP()// CmyAstyleAppDlg 消息处理程序BOOL CmyAstyleAppDlg::OnInitDialog() {CDialogEx::OnInitDialog();// 将“关于...”菜单项添加到系统菜单中。// IDM_ABOUTBOX 必须在系统命令范围内。ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);ASSERT(IDM_ABOUTBOX < 0xF000);CMenu* pSysMenu = GetSystemMenu(FALSE);if (pSysMenu != nullptr) {BOOL bNameValid;CString strAboutMenu;bNameValid = strAboutMenu.LoadString(IDS_ABOUTBOX);ASSERT(bNameValid);if (!strAboutMenu.IsEmpty()) {pSysMenu->AppendMenu(MF_SEPARATOR);pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);}}// 设置此对话框的图标。 当应用程序主窗口不是对话框时,框架将自动// 执行此操作SetIcon(m_hIcon, TRUE); // 设置大图标SetIcon(m_hIcon, FALSE); // 设置小图标// TODO: 在此添加额外的初始化代码m_ctrlTip.SetLimitText(32 * 1024 * 1024); // 默认是32K, 太小了.m_csAstyleOption.Empty();m_csAstyleOption += TEXT("--mode=c");m_csAstyleOption += TEXT(" --style=google");m_csAstyleOption += TEXT(" --indent=spaces=4");m_csAstyleOption += TEXT(" --attach-namespaces");m_csAstyleOption += TEXT(" --attach-classes");m_csAstyleOption += TEXT(" --attach-inlines");m_csAstyleOption += TEXT(" --attach-extern-c");m_csAstyleOption += TEXT(" --attach-closing-while");m_csAstyleOption += TEXT(" --indent-classes");m_csAstyleOption += TEXT(" --indent-switches");m_csAstyleOption += TEXT(" --indent-cases");m_csAstyleOption += TEXT(" --indent-namespaces");m_csAstyleOption += TEXT(" --indent-after-parens");m_csAstyleOption += TEXT(" --indent-continuation=1");m_csAstyleOption += TEXT(" --indent-labels");m_csAstyleOption += TEXT(" --indent-preproc-block");m_csAstyleOption += TEXT(" --indent-preproc-define");m_csAstyleOption += TEXT(" --indent-preproc-cond");m_csAstyleOption += TEXT(" --indent-col1-comments");m_csAstyleOption += TEXT(" --min-conditional-indent=1");m_csAstyleOption += TEXT(" --max-continuation-indent=120");m_csAstyleOption += TEXT(" --break-blocks");m_csAstyleOption += TEXT(" --pad-oper");m_csAstyleOption += TEXT(" --pad-comma");m_csAstyleOption += TEXT(" --pad-header");m_csAstyleOption += TEXT(" --delete-empty-lines");m_csAstyleOption += TEXT(" --align-pointer=type");m_csAstyleOption += TEXT(" --align-reference=type");m_csAstyleOption += TEXT(" --break-one-line-headers");m_csAstyleOption += TEXT(" --add-braces");m_csAstyleOption += TEXT(" --close-templates");m_csAstyleOption += TEXT(" --max-code-length=120");UpdateData(FALSE);return TRUE; // 除非将焦点设置到控件,否则返回 TRUE
}bool CmyAstyleAppDlg::addTip(CString csMsg) {int len = 0;int len_limit = 0;len = m_ctrlTip.GetWindowTextLength();len_limit = m_ctrlTip.GetLimitText();// 清除溢出内容时, 保留后一半的内容, 使内容可读连续性好些if ((len + csMsg.GetLength() + 1024) >= (int)len_limit) {m_ctrlTip.SetSel(0, len / 2); // 选中所有m_ctrlTip.ReplaceSel(_T(""));len = m_ctrlTip.GetWindowTextLength();}m_ctrlTip.SetSel(len, len); // 将插入光标放在最后m_ctrlTip.ReplaceSel(csMsg);UpdateData(TRUE);return true;
}void CmyAstyleAppDlg::OnSysCommand(UINT nID, LPARAM lParam) {if ((nID & 0xFFF0) == IDM_ABOUTBOX) {CAboutDlg dlgAbout;dlgAbout.DoModal();} else {CDialogEx::OnSysCommand(nID, lParam);}
}// 如果向对话框添加最小化按钮,则需要下面的代码
// 来绘制该图标。 对于使用文档/视图模型的 MFC 应用程序,
// 这将由框架自动完成。void CmyAstyleAppDlg::OnPaint() {if (IsIconic()) {CPaintDC dc(this); // 用于绘制的设备上下文SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);// 使图标在工作区矩形中居中int cxIcon = GetSystemMetrics(SM_CXICON);int cyIcon = GetSystemMetrics(SM_CYICON);CRect rect;GetClientRect(&rect);int x = (rect.Width() - cxIcon + 1) / 2;int y = (rect.Height() - cyIcon + 1) / 2;// 绘制图标dc.DrawIcon(x, y, m_hIcon);} else {CDialogEx::OnPaint();}
}//当用户拖动最小化窗口时系统调用此函数取得光标
//显示。
HCURSOR CmyAstyleAppDlg::OnQueryDragIcon() {return static_cast<HCURSOR>(m_hIcon);
}void CmyAstyleAppDlg::OnBnClickedOk() {// TODO: 在此添加控件通知处理程序代码CDialogEx::OnOK();
}void CmyAstyleAppDlg::OnBnClickedCancel() {// TODO: 在此添加控件通知处理程序代码CDialogEx::OnCancel();
}int iErrCnt = 0;
void STDCALL my_fpError(int errorNumber, const char* errorMessage) {iErrCnt++;if (NULL != errorMessage) {assert(false);}
}std::vector<char*> g_vec_pt;char* STDCALL my_fpAlloc(unsigned long memoryNeeded) {char* pszBuf = new char[memoryNeeded];g_vec_pt.push_back(pszBuf);return pszBuf;
}bool CmyAstyleAppDlg::code_format_file(const TCHAR* pszWFilePathName, const char* pszOption) {bool b_rc = false;char* psz_rc = NULL;char* pSourceIn = NULL;int iLenSource = 0;char* pMemBuf = NULL;size_t st_file = 0;size_t st_tmp = 0;uint8_t* pBuf = NULL;int lenBuf = 0;do {if ((NULL == pszWFilePathName) || (NULL == pszOption)) {break;}st_file = getFileSize(pszWFilePathName);if (st_file <= 0) {break;}// read file all into pSourceInif (!ReadFileToBuffer(pszWFilePathName, pBuf, lenBuf)) {break;}pSourceIn = (char*)pBuf;psz_rc = AStyleMain(pSourceIn, pszOption, my_fpError, my_fpAlloc);if (!psz_rc) {break;}// write psz_rc to filest_tmp = strlen(psz_rc);if (!WriteBufferToFile(pszWFilePathName, (const uint8_t*)psz_rc, st_tmp)) {break;}b_rc = true;} while (false);if (NULL != pBuf) {delete[] pBuf;pBuf = NULL;}while (g_vec_pt.size() > 0) {pMemBuf = g_vec_pt.back();if (NULL != pMemBuf) {delete[] pMemBuf;pMemBuf = NULL;}g_vec_pt.pop_back();}return b_rc;
}void CmyAstyleAppDlg::OnBnClickedButtonAstyleDir() {bool b_rc = false;CString csTmp;do {UpdateData(TRUE);if (m_csDir.IsEmpty()) {addTip(TEXT("请先选择要格式化的顶层目录, 再对目录进行格式化代码\r\n"));break;}if (m_csAstyleOption.IsEmpty()) {addTip(TEXT("请添加格式化选项, 然后再对目录进行格式化代码\r\n"));break;}m_iProcessOk = 0;b_rc = findDir(m_csDir, &CmyAstyleAppDlg::CB_FindFile_code_format);assert(b_rc);csTmp.Format(TEXT("process ok cnt = %d\r\n"), m_iProcessOk);addTip(csTmp);} while (false);
}bool CmyAstyleAppDlg::isObjFile(const TCHAR* pObjPostFix) {bool b_rc = false;int i_rc = 0;const TCHAR** ppCur = NULL;CString csCur;const TCHAR* pszObj[] = {TEXT(".h"),TEXT(".c"),TEXT(".cpp"),NULL};assert(NULL != pObjPostFix);csCur = pObjPostFix;ppCur = pszObj;do {if ((NULL == ppCur) || (NULL == *ppCur)) {break;}i_rc = csCur.CompareNoCase(*ppCur);if (0 == i_rc) {b_rc = true;break;}ppCur++;} while (true);return b_rc;
}std::string CmyAstyleAppDlg::my_W2A(std::wstring strW) {USES_CONVERSION;std::string str_rc = W2A(strW.c_str());return str_rc;
}bool CmyAstyleAppDlg::CB_FindFile_code_format(CString csFilePathName) {bool bProcessOk = false;bool b_rc = false;int iPos = -1;int len = 0;CString csTmp;const TCHAR* pFilePathNameIn = csFilePathName;do {len = csFilePathName.GetLength();assert(len > 0);iPos = csFilePathName.ReverseFind(TEXT('.'));if (iPos > 0) {csTmp = csFilePathName.Right(len - iPos); // .hif (isObjFile(csTmp)) {b_rc = code_format_file(pFilePathNameIn, my_W2A(m_csAstyleOption.GetString()).data());assert(b_rc);csTmp.Format(TEXT("%s = %s\r\n"), (b_rc ? TEXT("ok") : TEXT("err")), pFilePathNameIn);addTip(csTmp);m_iProcessOk++;}}bProcessOk = true;} while (false);return bProcessOk;
}bool CmyAstyleAppDlg::findDir(CString csDirPathName, PFN_CB_FindFile pfn) {bool b_rc = false;CString str;CFileFind finder;// build a string with wildcardsCString strWildcard(csDirPathName);strWildcard += _T("\\*.*");// start working for filesBOOL bWorking = finder.FindFile(strWildcard);while (bWorking) {bWorking = finder.FindNextFile();// skip . and .. files; otherwise, we'd// recur infinitely!if (finder.IsDots()) {continue;}// if it's a directory, recursively search itif (finder.IsDirectory()) {str = finder.GetFilePath();// TRACE(_T("%s\n"), (LPCTSTR)str);findDir(str, pfn);}// 是文件if (NULL != pfn) {str = finder.GetFilePath();b_rc = (this->*pfn)(str);if (!b_rc) {break;}}}finder.Close();return b_rc;
}void CmyAstyleAppDlg::OnBnClickedButtonSeclectDir() {m_csDir = BrowserDir(TEXT("C:\\"));UpdateData(FALSE);
}CString CmyAstyleAppDlg::BrowserDir(CString DirToBrowser) {CString csPathName = _T("");BROWSEINFO bi = { 0 };TCHAR tszPath[MAX_PATH] = TEXT("\0");memset(&bi, 0, sizeof(bi));bi.lpszTitle = TEXT("请选择要进行代码格式化的顶层文件夹");LPITEMIDLIST pidl = SHBrowseForFolder(&bi);if (pidl != NULL) {if (SHGetPathFromIDList(pidl, tszPath) == TRUE) {csPathName = tszPath;}CoTaskMemFree(pidl);}return csPathName;
}bool CmyAstyleAppDlg::WriteBufferToFile(const TCHAR* pszFilePathName, const uint8_t* pBuf, int lenBuf) {bool b_rc = false;FILE* fp = NULL;size_t WriteCnt = 0;do {if ((NULL == pszFilePathName) || (NULL == pBuf) || (lenBuf <= 0)) {break;}fp = _tfopen(pszFilePathName, TEXT("w+b"));if (NULL == fp) {break;}WriteCnt = (int)fwrite(pBuf, sizeof(char), lenBuf, fp);if (WriteCnt != lenBuf) {break;}b_rc = true;} while (false);if (NULL != fp) {fclose(fp);fp = NULL;}return b_rc;
}size_t CmyAstyleAppDlg::getFileSize(const TCHAR* pszFilePathName) {// 这是一个存储文件(夹)信息的结构体,其中有文件大小和创建时间、访问时间、修改时间等struct _stat64 statbuf;size_t filesize = 0;do {assert(NULL != pszFilePathName);// 提供文件名字符串,获得文件属性结构体_tstat64(pszFilePathName, &statbuf);// 获取文件大小filesize = statbuf.st_size;} while (false);return filesize;
}bool CmyAstyleAppDlg::ReadFileToBuffer(const TCHAR* pszFilePathName, uint8_t*& pBuf, int& lenBuf) {bool b_rc = false;FILE* fp = NULL;size_t OptCnt = 0;int fileSize = 0;do {if (NULL == pszFilePathName) {break;}fileSize = (int)getFileSize(pszFilePathName);if (fileSize <= 0) {break;}lenBuf = fileSize;pBuf = new uint8_t[lenBuf + 1];pBuf[lenBuf] = 0x00;fp = _tfopen(pszFilePathName, TEXT("r+b"));if (NULL == fp) {break;}OptCnt = (int)fread(pBuf, sizeof(char), lenBuf, fp);if (OptCnt != lenBuf) {break;}b_rc = true;} while (false);if (NULL != fp) {fclose(fp);fp = NULL;}return b_rc;
}
测试程序 - RC
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"#define APSTUDIO_READONLY_SYMBOLS
/
//
// Generated from the TEXTINCLUDE 2 resource.
//
#ifndef APSTUDIO_INVOKED
#include "targetver.h"
#endif
#include "afxres.h"
#include "verrsrc.h"/
#undef APSTUDIO_READONLY_SYMBOLS/
// 中文(简体,中国) resources#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS)
LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED#ifdef APSTUDIO_INVOKED
/
//
// TEXTINCLUDE
//1 TEXTINCLUDE
BEGIN"resource.h\0"
END2 TEXTINCLUDE
BEGIN"#ifndef APSTUDIO_INVOKED\r\n""#include ""targetver.h""\r\n""#endif\r\n""#include ""afxres.h""\r\n""#include ""verrsrc.h""\r\n""\0"
END3 TEXTINCLUDE
BEGIN"#define _AFX_NO_SPLITTER_RESOURCES\r\n""#define _AFX_NO_OLE_RESOURCES\r\n""#define _AFX_NO_TRACKER_RESOURCES\r\n""#define _AFX_NO_PROPERTY_RESOURCES\r\n""\r\n""#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS)\r\n""LANGUAGE 4, 2\r\n""#include ""res\\myAstyleApp.rc2"" // 非 Microsoft Visual C++ 编辑的资源\r\n""#include ""l.CHS\\afxres.rc"" // 标准组件\r\n""#if !defined(_AFXDLL)\r\n""#include ""l.CHS\\afxribbon.rc"" // MFC 功能区和控制条资源\r\n""#endif\r\n""#endif\r\n""\0"
END#endif // APSTUDIO_INVOKED/
//
// Icon
//// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDR_MAINFRAME ICON "res\\myAstyleApp.ico"/
//
// Dialog
//IDD_ABOUTBOX DIALOGEX 0, 0, 170, 62
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "关于 myAstyleApp"
FONT 9, "MS Shell Dlg", 0, 0, 0x1
BEGINICON IDR_MAINFRAME,IDC_STATIC,14,14,21,20LTEXT "myAstyleApp,版本 1.0",IDC_STATIC,42,14,114,8,SS_NOPREFIXLTEXT "版权所有 (C) 2024",IDC_STATIC,42,26,114,8DEFPUSHBUTTON "确定",IDOK,113,41,50,14,WS_GROUP
ENDIDD_MYASTYLEAPP_DIALOG DIALOGEX 0, 0, 320, 200
STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
EXSTYLE WS_EX_APPWINDOW
FONT 9, "MS Shell Dlg", 0, 0, 0x1
BEGINDEFPUSHBUTTON "确定",IDOK,209,179,50,14PUSHBUTTON "取消",IDCANCEL,263,179,50,14GROUPBOX "需要格式化代码的顶层目录",IDC_STATIC,7,7,306,34EDITTEXT IDC_EDIT_DIR,7,24,293,14,ES_AUTOHSCROLLPUSHBUTTON "...",IDC_BUTTON_SECLECT_DIR,301,24,12,14PUSHBUTTON "对目录进行代码格式化",IDC_BUTTON_ASTYLE_DIR,239,75,74,14EDITTEXT IDC_EDIT_TIP,7,90,306,86,ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_READONLY | ES_WANTRETURN | WS_VSCROLL | WS_HSCROLLGROUPBOX "格式化选项",IDC_STATIC,7,42,306,31EDITTEXT IDC_EDIT_ASTYLE_OPTION,7,55,306,14,ES_AUTOHSCROLL
END/
//
// Version
//VS_VERSION_INFO VERSIONINFOFILEVERSION 1,0,0,1PRODUCTVERSION 1,0,0,1FILEFLAGSMASK 0x3fL
#ifdef _DEBUGFILEFLAGS 0x1L
#elseFILEFLAGS 0x0L
#endifFILEOS 0x40004LFILETYPE 0x1LFILESUBTYPE 0x0L
BEGINBLOCK "StringFileInfo"BEGINBLOCK "080404B0"BEGINVALUE "CompanyName", "TODO: <公司名>"VALUE "FileDescription", "myAstyleApp"VALUE "FileVersion", "1.0.0.1"VALUE "InternalName", "myAstyleApp.exe"VALUE "LegalCopyright", "TODO: (C) <公司名>。 保留所有权利。"VALUE "OriginalFilename", "myAstyleApp.exe"VALUE "ProductName", "TODO: <产品名>"VALUE "ProductVersion", "1.0.0.1"ENDENDBLOCK "VarFileInfo"BEGINVALUE "Translation", 0x804, 1200END
END/
//
// DESIGNINFO
//#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
BEGINIDD_ABOUTBOX, DIALOGBEGINLEFTMARGIN, 7RIGHTMARGIN, 163TOPMARGIN, 7BOTTOMMARGIN, 55ENDIDD_MYASTYLEAPP_DIALOG, DIALOGBEGINLEFTMARGIN, 7RIGHTMARGIN, 313TOPMARGIN, 7BOTTOMMARGIN, 193END
END
#endif // APSTUDIO_INVOKED/
//
// AFX_DIALOG_LAYOUT
//IDD_MYASTYLEAPP_DIALOG AFX_DIALOG_LAYOUT
BEGIN0
END/
//
// String Table
//STRINGTABLE
BEGINIDS_ABOUTBOX "关于 myAstyleApp(&A)..."
END#endif // 中文(简体,中国) resources
/#ifndef APSTUDIO_INVOKED
/
//
// Generated from the TEXTINCLUDE 3 resource.
//
#define _AFX_NO_SPLITTER_RESOURCES
#define _AFX_NO_OLE_RESOURCES
#define _AFX_NO_TRACKER_RESOURCES
#define _AFX_NO_PROPERTY_RESOURCES#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS)
LANGUAGE 4, 2
#include "res\myAstyleApp.rc2" // 非 Microsoft Visual C++ 编辑的资源
#include "l.CHS\afxres.rc" // 标准组件
#if !defined(_AFXDLL)
#include "l.CHS\afxribbon.rc" // MFC 功能区和控制条资源
#endif
#endif/
#endif // not APSTUDIO_INVOKED
备注
自己会写2句程序确实方便,有些小功能,如果现成软件中没有(或者下载不到有这种功能的软件),那就自己写一下。费不了多长时间,管用。