| Hui 的个人资料逆风沉沦日志列表 | 帮助 |
|
2007/1/8 test怎么由dll文件生成对应的lib文件我有一个DLL及对应的头文件,如何生成VC所要的LIB文件。
1. dumpibn /exports Your.dll > Your.def
edit Your.def,Let it become standard def file ( like: EXPORTS: abc def ) lib /def:Your.def /out:Your.lib 2. 有了头文件,说明你已经知道导出函数。 可以这样:使用楼上兄弟提到的工具查到对应函数导出函数写一个DEF文件: LIBRARY youdll.dll EXPORTS Func1@0 @2 然后 lib /MACHINE:IX86 /DEF:yourLIB.DEF 高效拆分字符串inline int stringSplit1(const char* lpszToSplit,char delemit, const char* lpszStartArray[],int nSizeArray[],int nArraySize) { if(!lpszToSplit) return 0; int nPart = 0;
int nSize = 0; bool bNew = true; for(;*lpszToSplit;lpszToSplit++)
{ if(bNew) { nPart++; if(nPart > nArraySize) break; bNew = false; lpszStartArray[nPart-1] = lpszToSplit; nSize = 0; } if(*lpszToSplit==delemit) { bNew =true; nSizeArray[nPart-1] = nSize; } else { nSize++; } } if(!bNew)
nSizeArray[nPart-1] = nSize; return nPart > nArraySize ? -1 : nPart ; } 写了一个分割字符串的函数void stringSplit(const std::string& strToSplit,const std::string& strDelimit, std::vector<std::string>& vecStringOutput)
{ vecStringOutput.clear(); std::string::size_type begin,end;
begin = strToSplit.find_first_not_of(strDelimit); while(begin!=std::string::npos) { end = strToSplit.find_first_of(strDelimit,begin); vecStringOutput.push_back(strToSplit.substr(begin,end-begin)); begin = strToSplit.find_first_not_of(strDelimit,end); } } void stringSplit(const std::string& strToSplit,char delimit, std::vector<std::string>& vecStringOutput)
{ vecStringOutput.clear(); std::string::size_type begin=0,end=0,length=strToSplit.length(); while(begin<length && end!=std::string::npos) { end = strToSplit.find(delimit,begin); vecStringOutput.push_back(strToSplit.substr(begin,end-begin)); begin = end + 1; } } ifstream, ofstream 有时打开带中文路径的文件会失败似乎跟文件系统是ntfs还是fat有关, 解决的办法如下:
1. 使用c函数
setlocale(LC_ALL,"Chinese-simplified");
2. 使用stl
std::locale::global(std::locale(""));
CHyperLink动态创建时存在问题CHyperLink动态创建时存在问题 void CHyperLink::PreSubclassWindow() // Check that the window text isn't empty. // Get the current window font // Create the tooltip m_ToolTip.AddTool(this, m_strURL, rect, TOOLTIP_ID); CStatic::PreSubclassWindow(); 通常我们动态创建该类都是这样写的: 很少有人会在调用Create之前先调用SetURL, 这样 ASSERT(!m_strURL.IsEmpty())这句会断言失败, 为了避免这种情况, 必须记得在Create之前先调用SetURL, 给m_strURL赋上值, 或者将这里改为: 另一个严重的问题是m_ToolTip.Create(this)会引起崩溃, 解决的方法是将以下几句 CHyperLink类见如下链接: |
|
|