When we added something such as database Connection String in App.config file in .Net 2.0, we need to use the following 2 ways to get Connection String: 1: ConfigurationSettings.AppSettings["WinTerminalDBConnString"]; But if you use this, your compiler will says “This method is obsolete, it has been replaced by ConfigurationManager.AppSettings”; So you have to use the 2nd [Read More ...]
The regular way to display image in a Windows Form is using PictureBox. Here is a sample : First put a PictureBox control and ImageList control in Form1: private void Form1_Load(object sender, EventArgs e) { Rectangle cloneRect = new Rectangle(Properties.Resources.tray_icons.Width / 5 * 3 + 1, 0, Properties.Resources.tray_icons.Width / 5, Properties.Resources.tray_icons.Height); System.Drawing.Imaging.PixelFormat format = Properties.Resources.tray_icons.PixelFormat; [Read More ...]
1: Check if Bit is set //Check if a bit is set bool IsBitSet(Int32 aInt, int pos) { return (aInt & (1 << pos)) != 0; } 2: Set Bit to 0: static int SetZeroBit(int value, int position) { return value & ~(1 << position); } 3: Set Bit to 1: static [Read More ...]
How do you give the code to Find something from a List ? Here I provided 3 ways which I have tested to confirm all of them worked: Assume I have a list which get some data items from somewhere: List<CPoint> tempPointList = GetCPointsBy(pointType, trunkAddr, sensorAddr, pName); Now I want to search something by some [Read More ...]
In C++ projects, to share data, multiple processes can use memory-mapped files that the system paging file stores. First process create memory file and other process open this memory file. CreateFileMapping Function OpenFileMapping Function The name of the file mapping object to be opened has the following rules (from MSDN): Terminal Services: The name [Read More ...]
When you create a MFC library project using Visual Studio 2010, you will see the following screen to ask you choose a DLL type, so you might be confused by the following 2 options: 1: Regular DLL using shared MFC DLL2: Regular DLL with MFC statically linked So which one you should select ? First [Read More ...]