Quantcast
Channel: Gautam Jain's Blog
Browsing index pages (50 articles)

Load binary file into buffer in Windows (C++/MFC)

Following is the function to load a binary file into a memory buffer in Windows (C++/MFC).     //Do not use this for text files as the following code doesn't handle UTF, UNICODE, BOMLESS etc. BOOL...

View Article


Remove duplicates from string array in Windows (C++/MFC/ATL)

Following code removes duplicates from string array in Windows (C++/MFC/ATL).   void RemoveDuplicatesFromArray(CAtlArray<CString> &arrValue) { CAtlArray<CString> arrNew; INT_PTR i, j,...

View Article


Generate a temporary file path with a temp file name in Windows (C++/MFC)

Following function creates a temporary file path with a specific file extension. Optionally, it also creates the temporary file. Coded in C++/MFC (Windows).   CString GenerateTempFilePath(BOOL...

View Article

Remove invalid characters from a file name in Windows (C++/MFC)

In Windows, a file or folder name cannot contain the following characters \/:*?\”<>| . Sometimes before saving a file, you may want to remove these invalid characters from the file name. Here is...

View Article

Get path with unique file name in Windows (C++/MFC)

Sometimes, when a file with same name already exists, we wish to generate a new unique file name. The following function does this. Coded in C++/MFC. A number is suffixed to the file name. You can...

View Article


Delete multiple files using wildcards in Windows (C++/MFC)

Following code uses SHFileOperation Windows API to delete multiple files using wild card (silently without any confirmation box). It deletes only files. Not folders. Coded in C++/MFC.   BOOL...

View Article

Copy or move files using wildcards to another folder in Windows (C++/MFC)

The following function uses SHFileOperation Windows API to copy multiple files using wildcards to another folder. It has option to delete files from source location too (Whether to copy or to move the...

View Article

Delete a folder even if not empty in Windows (C++/MFC)

Following is the code to delete a directory folder even if it is not empty in Windows. Coded in C++/MFC.     BOOL DeleteFolder(CString strFolder, BOOL bDeleteIfNotEmpty ) { BOOL bRet = FALSE; int...

View Article


Delete oldest file from a folder on Windows in C++/MFC

Following code deletes the oldest file from a folder. We need this when we wish to keep last X copies of a file for backup. So we would just delete the oldest one and create a new backup copy. Coded...

View Article


Get total number of files in a folder in Windows (C++/MFC)

Code to get total number of files in a folder in Windows (C++/MFC).   int GetTotalFiles(CString folderPath) { if (!PathFileExists(folderPath)) return 0;   CFileFind finder; CString findString; CString...

View Article

Programmatically send keystrokes to active current window in Windows

Here is the code to send keys (key strokes) to active current application in Windows using C++/Win API. void SendKey(WORD wVkey) { INPUT inputs[2]; inputs[0].type = inputs[1].type = INPUT_KEYBOARD;...

View Article

Get size (rectangle) of complete virtual screen (all display monitors together)

Here is the code to get the complete virtual screen rectangle that includes all display monitors. Code is in C++/MFC. //gets the coordinates of the complete virtual screen which is includes all the...

View Article

Check if email address is valid in C++/MFC

  Here is the C++/MFC code to check if an email address is valid.   bool IsEmailAddressValid(CString emailAddress) { emailAddress.Trim();   if (emailAddress.IsEmpty()) return false;   int idx; CString...

View Article


Convert array/list to string using a separator in C++ (MFC)

Following is the code to convert array to string using a specific separator. Language used is C++ using MFC (Microsoft Foundation Classes). This function can trim each term in the array and also...

View Article

Setting reminders saves a lot of money and makes life smoother

Today, I am going to highlight on a very simple fact. In today’s age of technology and smart phone, I strongly suggest that you use right apps to make your life smoother. An app that would help you to...

View Article


Looking for Sqlite Net PCL for your Xamarin project?

The phone app for Notezilla is created using Xamarin Forms. I like the way Xamarin Forms has grown. It works pretty well. If you are looking for SQlite .Net PCL library, you might find multiple. But I...

View Article

XLabs Xamarin Forms Labs – Label does not un-strikethrough in Android

If you are trying to use un-strike-through (remove strike through) a text in extended label of XLabs Xamarin-Forms-Labs , you may not see it working. This is a bug. To fix it, I have added to else...

View Article


XLabs Xamarin Forms Labs – Label does not show strikethrough on multi-line in...

If you are trying to use strike through property of XLabs Xamarin-Forms-Labs , you may not see the strike through work on labels having multiline (wrapped text). This is a bug. To fix it, add the...

View Article

Why Google Chromecast is better than Set Top Box (TataSky etc)

Six months back I moved from TataSky to Google Chromecast! What an amazing relief! I find several advantages of using TV via the Internet over normal Set Top Box like TataSky, DishNet, Airtel Digital...

View Article

StackOverflow like alternative Q & A system

In order to build a Question & Answer system like StackOverflow, for my website Conceptworld, I was looking for various alternatives. The reasons behind building a Q&A website for our products...

View Article
Browsing index pages (50 articles)


Latest Images