摘要:
private string MD5Encode(string text) { MD5 md5 = MD5.Create(); byte[] en = md5.ComputeHash(Encoding.Default.GetBytes(text)); StringBuilder sBuilder = new StringBuilder(); for (int i = 0; i < en.Length; i++) { sBuilder.Append(en[i].ToString("x")); } return sBuilder.ToString(); } 阅读全文
摘要:
http://sourceforge.net/projects/com0com/The Null-modem emulator (com0com) is a kernel-mode virtual serial port driver for Windows. You can create an unlimited number of virtual COM port pairs and use any pair to connect one COM port based application to another.com0com是windows内核模式下的虚拟串口驱动程序。可以创建虚拟串口 阅读全文
摘要:
CRect rect; GetDlgItem(IDC_IMG_NOTEPAD)->GetWindowRect(&rect);//获得空间的绝对坐标 ScreenToClient(&rect);//获得相对于主窗体的坐标 rect.OffsetRect(CSize(5,5));//这里要是要移动的相对位置 GetDlgItem(IDC_IMG_NOTEPAD)->MoveWindow(rect);//移动到目标位置 阅读全文
摘要:
//加载NotePad.exe的图标到IDC_IMG_NOTEPAD Cstatic控件上,这段代码显示不出ico图标,原因是什么?? //是type属性设置错了,在资源视图里面,编辑CStatic控件的属性,将它的Type改为icon,即解决。 SHFILEINFO fileInfo; DWORD_PTR dwRet=SHGetFileInfo("C:\\windows\\system32\\notepad.exe",0,&fileInfo,sizeof(SHFILEINFO),SHGFI_ICON); if (dwRet) { ((CStatic*)GetDlg 阅读全文
摘要:
//如果这个对话框通过非模态的方式被创建,由于在PostNcDestroy(对话框销毁会被调用)中使用了delete this;不会发生内存泄漏class CMessageDlg:public CDialog{public: void PostNcDestroy();};void CMessageDlg::PostNcDestroy(){ CDialog::PostNcDestroy(); delete this;} 阅读全文
摘要:
Dr.com限制是如此的严格,以至于colinux连不上网。怎么办的?找到这个解决方案:http://ngc1976.yo2.cn/articles/cooperative-linux%E7%AE%80%E8%A6%81%E6%8C%87%E5%8D%97.html原来可以使用slirp方式解决Dr.com电脑上colinux上网的问题#example.conf中,选择使用下面的一种上网方式:eth0=slirp,,tcp:22:22/tcp:177:177/udp:177:177OK了! 阅读全文
摘要:
fread,对指定长度的文件数据。读取的长度远小于文件的总长度,怎么回事呢?查MSDN,fopen最后一个参数:tOpen in text (translated) mode.In this mode, CTRL+Z is interpreted as an end-of-file character on input.In files opened for reading/writing with "a+", fopen checks for a CTRL+Z at the end of the file and removes it, if possible.This 阅读全文
摘要:
待分析Demo代码:int add(int a,int b){ return a+b;}int main(){ int a=0xaa; int b=0xbb; printf("a+b=%d",add(a,b));} 编译,不优化这里参数0xBB,0xAA压栈 push eax,push ecx说明这里默认的调用约定是__stdcall然后去调用函数int add(int,int)Ollydbg F7执行进add函数调用前两个参数0xBB,0xAA已经入栈这里前两行,ebp即esp,是栈顶。ebp+8 是 0xAAebp+C 是 0xBB做加法后返回,retn自动恢复堆栈平衡 阅读全文
摘要:
wchar_t wstr[100]=L"wstr";char str[100];wcstombs(str,wstr,100);//宽字符转多字节mbstowcs(wstr,str,100);//多字节转宽字符 也可以使用:MultiByteToWideChar和WideCharToMultiByte参考:http://blog.csdn.net/iamoyjj/archive/2011/05/06/6400877.aspx 阅读全文
摘要:
编译和链接选项ml.exe /c /coff /nologo /Folink.exe /SUBSYSTEM:WINDOWS /nologo /OUTHello World Demo Compiled with MASMPlus.386.model flat, stdcalloption casemap :noneinclude windows.incinclude user32.incinclude kernel32.incinclude masm32.incinclude gdi32.incincludelib gdi32.libincludelib user32.libincludelib 阅读全文