Code Library

Free Source Code and Program Tips

Retrieving a class and WMI class

Note: This a part from MSDN, just for self refference. The copyright is handled by Microsoft. The first type of object you can retrieve is a WMI class. When retrieving a WMI class, you actually retrieve a class definition: that is, a listing of the properties, qualifiers, and methods that fully describe the class. However, [...]

We often need to create an Enhanced Meta File(EMF) or Bitmap(bmp) from an existed DC draw code. It’s not very difficult but it’s boring to code again and again. The following is a simple solution, what you need to do is only to implement an IPicDrawer and call DrawEnhMeta or DrawBitmap function.

Setup SCIM in Ubuntu 6.10

After install the ubuntu 6.10 from the live-cd, you may find that the SCIM does not work. All the related package has been installed, but after press Ctrl+Space, the SCIM input has not enabled. The main reason is that the scim daemo is not running.  Following is the solution: create 75scim file under /etc/X11/Xsession.d/ with [...]

The work plan in the next days

Document the ucoFml Parser and release the source. Release an old project, simpMath parser, which can parse math expressions and support + – * / and many math functions, such as sin,cos,tan,cot, etc.  

Code Completion is a very useful feature of programiing, but it often  strikes in VC++ 6.0. If you meet such matter, try the following step: 1. delete *.ncb, *.opt, *.plg and *.clw files from your project directory 2. rebuild your project. And you often need CTRL+W to generate the class wizard infmation again. But the above works [...]

How to change the row height of CListCtrl

When you want to change the height of CListCtrl, you need to use an owner-draw version of CListCtrl and change the font of the control. But when you change the font of the CListCtrl, the control or its parent window does not get a chance to respecify the height of the rows and the effect will not be [...]

Moving selection of CListCtrl

tag: CListCtrl, SetItemState, SetSelectionMark When you try to move the item selection of a CListCtrl object, you should remember to call SetSelectionMark. If not, the program will not work as you think. It will only work once and won’t work any longer. The reason is that even you have called SetItemState and the selection was [...]

How to get a fixed code for serial number

We often look for some fixed serial numbers as an universal id. Usually we can use WMI class to retrieve  some hardware ID as following: Win32_BaseBoard Win32_Processor: ProcessorId Win32_BIOS: SerialNumber, ReleaseDate Win32_MotherboardDevice: InstallDate Win32_DiskDrive We can refer to MSDN WMI C++ Application Examples for some VC++ samples for the usage.But not all of the above WMI [...]

Some useful shortcut of Visual Studio 6

Hide/Show white spaces: Ctrl+Shift+8 Column Selection Alt+Mouse SelectLine Ctrl+F8 LineCut Ctrl+L LineDelete Ctrl+Shift+L

A powerful math function parser(zz)

by Andreas Jdger The inspiration to write this code was to have an easy-to-use parser for functions given as string. You have a string like cos(x)-7*x/(1+x) and you want to compute some values, maybe for displaying the graph of the function. You can write code like this: CFunction* fkt = CFunction::Parse(“cos(x)-7*x/(1+x)”); long double y = [...]