Code Library

Free Source Code and Program Tips

Intermittent work in UI thread

Pedro Ferreira I’m trying to create a UI thread to do constant background work, but I’m having some design problems. The thread needs to fetch records from a database. do some processing on each record and, when there are no more records, sleep for 1 minute before check the database again. The process will be [...]

Intermittent work in UI thread

Pedro Ferreira said: I’m trying to create a UI thread to do constant background work, but I’m having some design problems. The thread needs to fetch records from a database. do some processing on each record and, when there are no more records, sleep for 1 minute before check the database again. The process will [...]

How to read the sectors of physical drive under win32? The API ReadFile is most useful function, and with it, you can read the physical sectors directly. Here is a sample function, BOOL ReadSectors(…) BOOL ReadSectors( BYTE bDrive, //drive index DWORD dwStartSector, //start sector WORD wSectors, //sectors number LPBYTE lpSectBuff) {  if (bDrive == 0) [...]

How to get a fixed code for serial number(2)

I have post an article about “How to get a fixed code for serial number” at http://www.ucosoft.com/archives/51.html. In that article, I suggest you try WMI class to retrieve  some hardware ID. But there is some limitation of this method. The WMI redist package is not always available on user’s system, for example, Windows NT4 and Windows [...]