Code Library

Free Source Code and Program Tips

Android View Add Listener Tips Sample

In the development for the control to add Listener is a very common work, the easiest way to add Listener can be: 1 findViewById (R.id.myButton). setOnClickListener (new View.OnClickListener () (public void onClick (View v) (/ / Do stuff))); Add a Listener using the above method has a drawback is that if control is too large, [...]

Add a Listener Tips Android View Sample

In the development for the control to add Listener is a very common work, the easiest way to add Listener can be: 1 findViewById (R.id.myButton). setOnClickListener (new View.OnClickListener () (public void onClick (View v) (/ / Do stuff))); Add a Listener using the above method has a drawback is that if control is too large, [...]

30 Great Tips of CListCtrl Program(2)

30 Great Tips of CListCtrl Program(1) 8. Get Item Infomation TCHAR szBuf[1024];LVITEM lvi;lvi.iItem = nItemIndex;lvi.iSubItem = 0;lvi.mask = LVIF_TEXT;lvi.pszText = szBuf;lvi.cchTextMax = 1024;m_list.GetItem(&lvi); More infomation: Q173242: Use Masks to Set/Get Item States in CListCtrl 9. Get the header titile of CListCtrl LVCOLUMN lvcol;char  str[256];int   nColNum;CString  strColumnName[MAX_COL];nColNum = 0;lvcol.mask = LVCF_TEXT;lvcol.pszText = str;lvcol.cchTextMax = 256;while(m_list.GetColumn(nColNum, &lvcol)){    [...]

30 Great Tips of CListCtrl Program(1)

Without a special note,the listctrl has the default view style of report. 1. CListCtrl style        LVS_ICON: for each item displayed great icon        LVS_SMALLICON: for each item displayed on the icon        LVS_LIST: a show with a small icon on the item        LVS_REPORT: Show item details        You can inspect the Windows Explorer, [...]

In the post “How to change the row height of CListCtrl“, it gives 2 solution example how to change row height or CListCtrl. Hower, it is not the simplest way. The simplest way to change the row height in a CListCtrl is: Display an icon with the desired height. All other ways that I know [...]

After you modified your reource.h, you may got this error: fatal error RC1004: unexpected end of file found. It’s a bug of the resource compiler. The solution is adding a blank line or two to the end of the file  and build again.

When you develop some admin utility, which will need the administrator privilege to configures some H/W connected ove LAN, etc. And you will found that the application is running propertyly in XP just by a double click of the mouse, where as in VISTA if you run it as Administrator then only running. So, how [...]

How to Get the Primary Domain name

In gina, the system will list the domain name of the current system. How to get the primary domain name in your program? From the released the Windows2000 and NT source code, you can get the code of gina. It locate on \win2k\private\windows\gina\winlogon\usrpro.c. Here is the code:

MessageBox support Ctrl+C to copy content

It’s a good trick. From windows 2000, when a MessageBox popped out, you can use Ctrl+C to copy the content of the MessageBox window to the clipboard. It is a very interesting trick, and it is very usrful to share the information easily. The condition is only that the MessageBox window was created by MessageBoxA/MessageBoxW [...]

How to enable “profile” in Visual C++ 6.0

From MSDN: The profiler is an analysis tool that you can use to examine the run-time behavior of your programs. By using profiler information, you can determine which sections of your code are working efficiently. The profiler can produce information showing areas of code that are not being executed or that are taking a long [...]