
Programming
文章平均质量分 62
sooner01
work hard, play hard
展开
-
The basic way to support both ASCII and Unicode:
By useing #include , you can support both ASCII and Unicode in your program. The tchar.h header file, defined both way to conduct two kinds of character. Use the macro “_UNICODE” to control if use Uni原创 2008-07-06 17:12:00 · 469 阅读 · 0 评论 -
Simple Thread Pool
As is mentioned in my pervious article Thread Management Class, I shall introduce a simple thread pool implemented by the CThread class. For more information about class IRunnable and CThread, please原创 2008-12-30 23:00:00 · 1241 阅读 · 0 评论 -
Excel 笔记
*Four basic rules for design a Excel table:1. Every column is assigned with a title. 2. Store the data by lines, avoid empty lines.3. Avoid combine the grad.4. separate the原创 2008-12-30 23:07:00 · 855 阅读 · 0 评论 -
Some common windows system DLL
-- DLL notes 1 of Windows via C/C++>1. windows system DLLsThe three most important DLLs in windows:Kernel32.dll, contains functions for managing memory, processes, and threads;User32.原创 2008-11-28 15:47:00 · 635 阅读 · 0 评论 -
DLL file mapping
-- DLL notes 2 of Windows via C/C++> Let’s begin this topic with a question about exporting variables in DLL: Assume one process import a variable from a DLL, and change the value, then原创 2008-11-28 15:49:00 · 615 阅读 · 0 评论 -
Function name mangling in DLLs
-- DLL notes 3 of Windows via C/C++> Normally, C++ compilers mangle function and variable names. And there are some ways to change the way compilers mangling: extern "C"Using extern "C" tells the co原创 2008-11-28 15:51:00 · 677 阅读 · 0 评论 -
Avoid using blocking function in main thread
Here the blocking function stands for any functions that cause the current thread enter the wait state, such as Sleep(),WaitForMultipleObject() and so on.The reason to avoid using blocking function原创 2009-04-13 10:08:00 · 812 阅读 · 0 评论 -
数字电视常用表总结
1, 一些定义ES:由编码器输出,可以是编码过的视频数据流,音频数据流,或其他编码数据流。ES流经过PES打包器之后,被转换成PES包。PES包由包头和payload组成。 PSI:MPEG-2中定义了PSI(Program Specific Information)信息,其作用是从一个携带多个节目的某一个TS流中正确找到特定的节目。 PSI表:PSI表包括节目关联表(PAT)原创 2009-04-21 17:56:00 · 2732 阅读 · 0 评论 -
The order of head .h file
Normal 0 7.8 磅 0 2 false false false MicrosoftInternetExplorer4 <!-- /*原创 2009-05-25 17:27:00 · 680 阅读 · 0 评论 -
CWinThread in MFC
Normal 0 7.8 磅 0 2 false false false MicrosoftInternetExplorer4 <!-- /*原创 2009-05-31 20:19:00 · 1644 阅读 · 0 评论 -
Compile Open SSL in win NT/CE with VS2005
Well, with the commercial use of 3G,more and more application will flourish in the mobile platform. And most of theimplement is associated with security such as payment, E-bank, DRM and so on. So原创 2009-06-22 16:06:00 · 10493 阅读 · 4 评论 -
calling the OPENSSL libs in windows mobile
1. Steps to new a application a) New a smart device project b) Add additional include directory: ../celib; ../celib/openssl; ../celib/include; The last path is where the wcecompa原创 2009-07-02 17:51:00 · 2688 阅读 · 0 评论 -
C51笔记(1)—基本概念
1. 存储类型a) Data, 直接寻址的内部RAM地址,RAM低128 byte,一个周期内寻址b) bData,data区的16字节按位寻址区c) iData,间接寻址的内部RAM地址,RAM高128 byted) pData,外部存储的256个字节。e) xData,外部存储区,需要使用原创 2010-01-18 17:02:00 · 1217 阅读 · 0 评论 -
C51笔记(2)--Keil C 程序优化
1. 采用短变量。如bData,unsigned char。2. 无符号变量。51不支持符号运算。3. 避免使用浮点指针。浮点运算时要禁止中断。4. 局部变量代替全局变量。编译器分配局部变量在内部存储,全局变量在外部存储。5. 为变量分配内部存储区。6. 使用特定指针。7.原创 2010-01-18 17:18:00 · 1183 阅读 · 0 评论 -
Creating Dialup Connections with RAS APIs
Normal 0 7.8 磅 0 2 false false false MicrosoftInternetExplorer4 <object class原创 2010-03-03 11:05:00 · 1599 阅读 · 0 评论 -
Error shooting of Driver building with VC + DDK + DS
1. _MSC_VER too lowWell,the DDK version is too high, switch to VS 03. MS VC++ 9.0 _MSC_VER = 1500MS VC++ 8.0 _MSC_VER = 1400MS VC++ 7.1 _MSC_VER = 1310MS VC++ 7.0 _MSC原创 2010-03-08 10:18:00 · 983 阅读 · 0 评论 -
Debugging information for... cannot be found or does not match
Normal 0 false false false EN-US ZH-CN X-NONE原创 2010-04-27 13:35:00 · 2935 阅读 · 0 评论 -
Memory Leak Detection in Visual Studio
1. OverviewMemory leak—the failure to properly deallocate memory that was previously allocated.The Visual Studio debugger and C run-time (CRT) libraries provide effective means for detecting a原创 2008-12-29 21:49:00 · 3738 阅读 · 0 评论 -
Thread management class
Well, multi thread is a useful mechanism in many scenarios. But the thread is not easy to control. Here I will discuss a thread management class which provides a connection between thread function and原创 2008-12-29 21:20:00 · 1127 阅读 · 0 评论 -
ASCII and Unicode transfer
We can use the windows API WideCharToMultiByte()transfer to each other. The code is as fellows:#ifdef _UNICODE char pstrService[HOSTNAME_SIZE]; WideCharToMultiByte(CP_AC原创 2008-07-27 23:55:00 · 535 阅读 · 0 评论 -
confirm if a file exists
Before opening a file, it’s better to confirm if it exists. WIN32_FIND_DATA fd; HANDLE hFile = ::FindFirstFile( fName, &fd ); if ( hFile == INVALID_HANDLE_VALUE )原创 2008-07-30 22:23:00 · 566 阅读 · 0 评论 -
test if a string is a number
int _istdigit(TCHAR): to test if a string is a number. int _ttoi(TCHAR*): is the same as atoi, change a string into a int. if ( _istdigit( strServiceName[0] ) ) { nPortNumb原创 2008-07-30 22:32:00 · 537 阅读 · 0 评论 -
Use windows message to change text in CEdit with timeout control
When using socket class, usually you have to send your data received from remote peer to upper CDialog class, the basic ways are: 1, pass the windows handle (this or m_hWnd)to socket class ob原创 2008-07-30 22:34:00 · 506 阅读 · 0 评论 -
Fix bugs
It’s common to meet troubles when do a programming work, my program crashed, a bug is detected, or my code isn’t robust enough…When confronting a problems, how to deal with it? First of all, quiet原创 2008-08-20 16:25:00 · 1290 阅读 · 0 评论 -
Prevent Enter and Esc close dialog program
Well there are also many way, such as Override the OnOK() and OnCancel().The easier and more powerful way is to Overrides the function PreTranslateMessage() in the dialog class.BOOL CSer原创 2008-08-20 16:58:00 · 514 阅读 · 0 评论 -
Get the command parameters in Win app and Console app
Usually one exe command is followed by some parameters, such as c:/dir /a; our application can process those parameters, both in win app and console app.Indicate that all paremeters are Separated by原创 2008-08-20 17:34:00 · 515 阅读 · 0 评论 -
Memory leak control with hash table
It’s not an easy job, careful design and consideration is needed to make memory allocation and free robust and efficiency. Here just go through the way Open SSL conducting memory leak. Here just give原创 2008-08-26 17:29:00 · 697 阅读 · 0 评论 -
How to configuratie the Windows Mobile DLL debug environment
I believe that the Smart mobile phone will unify the mass media such as telecom, internet, TV, radio and publication. Actually now the latest sell phone is more powerful than my first PC. So I am very原创 2008-08-28 16:32:00 · 1162 阅读 · 2 评论 -
Difference between release and debug build when initial a struct
Today meet such a bug, when initial a struct with a redundant bytes, using struct a = {0}; the release build and debug build acts differently! In the debug build, the redundant bytes are filled with原创 2008-07-07 22:29:00 · 446 阅读 · 0 评论 -
CSP review
CSP review:Well, other team need my assistant, while I haven’t tough the CSP for about two years, now do some revisions. Setup debugging environment:1, register the CSP into system. regsvr3原创 2008-09-27 14:00:00 · 1806 阅读 · 1 评论 -
Singleton class
From the name we can see that a singleton class is a kind of class that only has one class object. Why we need to use this pattern? Sometimes we can use it instead of the global variables. Here i原创 2008-10-14 18:02:00 · 777 阅读 · 0 评论 -
Speed control in network
Under some circumstances you need to control the speed of sending or receiving data in network. The speed of network is always measured by kbps, which means how many bits to send within one second.原创 2008-10-27 17:27:00 · 621 阅读 · 0 评论 -
5 kinds of timers
1. Standard Win32 TimersThe classical timer, just call on and kill timer to use. And by the nIDEvent you may use different timer at the same time, and use the same OnTimer callback function. It’原创 2008-10-31 20:35:00 · 1011 阅读 · 0 评论 -
Synchronization
Well, in the really world, there are so many things you have to wait for, my wages up, my promotion, my princess…and those things never send me a signal. Wait for single object seems to be disparate a原创 2008-10-31 22:24:00 · 740 阅读 · 0 评论 -
volatile - Multithreaded Programmer's Best Friend
Andrei Alexandrescu The volatile keyword was devised to prevent compiler optimizations that might render code incorrect in the presence of certain asynchronous events. For example, if you decla转载 2008-10-31 22:29:00 · 859 阅读 · 0 评论 -
Debug a built binary file with VS and *.pdb file
<br /> Visual Studio 05 can be used as a powerful debug tool, and you may debug a binary file (exe or dll) as long as you have its corresponding *.pdb file and source code. You do not even have to create a VS project or solution.<br /> Here is the steps:原创 2010-05-31 18:36:00 · 880 阅读 · 0 评论