Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Everything / Languages / C++

C++

C++

Great Reads

by TUKET BO
In this tutorial, we will learn how to embed Python in a C++ application. In particular, we are going to see an example in which we will be able to interact with a GUI (made with GTK+).
by Aydin Homay
In this article, I tried to show a real benchmark based on presser test method, for a Big Data collection deals on C++, C#, and VB.NET.
by Marat Bedretdinov
Shell interfaces in use. IShellFolder, IEnumIDList, etc.
by Nicolas Bonamy
Simulate the Class Wizard in VS.NET 2003

Latest Articles

by TUKET BO
In this tutorial, we will learn how to embed Python in a C++ application. In particular, we are going to see an example in which we will be able to interact with a GUI (made with GTK+).
by Aydin Homay
In this article, I tried to show a real benchmark based on presser test method, for a Big Data collection deals on C++, C#, and VB.NET.
by Marat Bedretdinov
Shell interfaces in use. IShellFolder, IEnumIDList, etc.
by Nicolas Bonamy
Simulate the Class Wizard in VS.NET 2003

All Articles

Sort by Score

C++ 

by TUKET BO
In this tutorial, we will learn how to embed Python in a C++ application. In particular, we are going to see an example in which we will be able to interact with a GUI (made with GTK+).
by Cpp For All
finally like clause in C++
by PrafullaVedante
Avoid using "if" with no code block parenthesis
by Andrew Rissing
Always review all changes before submitting them. Especially, if using a global find and replace.
by paladin_t
Whatever, I agree with you, it would be worse in C / C++ code using macros.Suppose you got a multiline macro like this:#define some_macro \ do_something_1(); \ do_something_2();And using this macro without parenthesis:if(...) some_macro;orfor(...) ...
by The Zetta
Sometimes, Visual c++ users see a pretty confusing error message when they compile or build their projects. the error message says :fatal error C1083: Cannot open precompiled header file: 'filename.pch': No such file or directorymy solution was :In VS, go to Project->Options, set the...
by Ajay Vijayvargiya
Wouldn't be easier if you just pass a simple function to your favourite thread creation function? Read on!
by federico.strati
I always use a somewhat different approach, here is a class"consumer" that has embedded the thread call in a member function,the member function runs a virtual call, hence the derived classesmay implement functionality as well as passing arguments asmember data of the class. Maybe you're...
by Laurie Stearn
Code attached to a 2003 article updated for Visual Studio 2017.
by GPUToaster™
A simple way to detect bitness of an OS Programatically. (C# and C++ examples given)
by Reinhard Ostermeier
In .NET 4.0, you can also use the new System.Environment.Is64BitOperatingSystem and System.Environment.Is64BitProcess
by Aescleal
In C++ you can use the size of a pointer to work out what sort of process you're running in:bool is_64_bit(){ return sizeof(void *) == 8;}This has got the advantage of being portable and you don't have to call any OS functions.You can do something similar in C - just return...
by a_pess
To check 64Bit Operating system in VB.NET,Public Shared Function is64BitOPeratinSystem() As Boolean Return (Marshal.SizeOf(IntPtr.Zero) = 8)End Function
by The_Mega_ZZTer
Version check is wrong. It happens to work correctly only because no minor versions of Windows 5 were released after 5.1 (AFAIK... are Windows Server 2003 and Embedded XP and Media Center XP still 5.1?). A theoretical version 5.2 would fail the check. I submit the following...
by Nitin K. Kawale
3D Vector Graphics class.
by Rimon Orni
Code injection cave for 64 bit processes
by Indivara
A very simple class that allows you to easily lock blocks of code from multi-threaded access.
by PJ Arends
Trace your function calls to the Output window.
by Software_Developer
set the variable count_down_time_in_secs in seconds for desired count down time.The Code is self explanatory.1 minute = 60 secs5 minutes = 60x5 secs30 minutes =60x30 secs1 hour = 60x60 secs#include #include int main (){ unsigned int...
by Anshul R
You can simply use the sleep() function in dos.h in a loop and print it!
by Gregory Morse
A full-featured Z80/8085 assembler in C++
by JohnX2015
This is a cross-platform general C++ engine, including a general runtime and a reflection engine.
by honey the codewitch
Initializing the ESP LCD Panel API is a chore. Here's some boilerplate code to make it easier.
by Tim ONeil
INI-style properties for C++ Embedded/Applications on Linux
by SpaceSoft
A little class to help you avoid memory leaks
by Aescleal
Combining a smart pointer with a collection we can get all the functionality that the original author wrote a custom class for, and a bit more:typedef std::vector> garbage_collector;Er, that's it. So how would you use this? Say you wanted to use character arrays as...
by Michael Bergman
Using Windows Communication Foundation to build a simple web server
by paladin_t
A Mimetic C# Style Multicast Event Implementation with C++
by Yesy
Provide a multiple-async-waiting operation management pattern for Android
by Mukit, Ataul
Using the filesystem as a repository for a circular buffer for achieving persistence of data
by Mathew_wwx
This tip will introduce a library written in C++ that wraps up a 2d polygon triangulation algorithm with time complexity of O(N*logN), the algorithm works on both self-intersected and non self-intersected polygons.
by cocaf
How to show progress in a Boost test application.
by Software_Developer
A simple program to calculate quadratic equation with.Input MUST have the format:AX2 + BX + C = 0EXAMPLE: input the equation 2X2 + 4X -30 = 0 as:A= 2 B= 4 C= -30The answers for AX2 + BX + C = 0 should be 3 and -5.x1=3x2=-5 bool solver(float...
by ReymonARG
#include #include #include "Raiz_Cuadratica.h"int main(){ // float xx = 1; float x = 1; float i = -12; RaizCuadratica *lala = new RaizCuadratica( xx, x, i ); RaizCuadratica::sRaiz raiz = lala->GetRaiz(); printf( "x1 = %f || x2 = %f\n\n",...
by Anshul R
Simple and prints imaginary roots too!float a,b,c,x1,x2,d,dsq;printf("ax^2 + bx + c = 0");printf("\nEnter a,b,c separated by commas : \n");scanf("%f,%f,%f",&a,&b,&c);d = b*b-(4*a*c);if(d>=0){dsq=sqrt(d);x1 = (-b+dsq)/(2*a);x2 = (-b-(dsq))/(2*a);printf("\nRoot 1 : %f\nRoot 2...
by federico.strati
The correct way to solve quadratic equations is none of the above. For the correct algorithm as applied in the following function, seenumerical recipes in C and the Wolfram site at http://mathworld.wolfram.com/QuadraticEquation.html#include bool quadratic(double a, double b,...
by YvesDaoust
// Real solutions of the quadratic equation A x^2 + B x + C = 0// Returns two roots (possibly identical) in increasing order, or nonebool Quadratic(double A, double B, double C, double R[2]){ if (A == 0) { // Linear, impossible or degenerate, cannot find two roots ...
by Michael Waters
I am reposting this because I accidentally deleted my first post.The solution is presented as a pair of complex roots, unless a == 0, in which case the equation is linear and returns a single complex(real) root.If a == 0 and b == 0, the function fails.Given a complex type, replace...
by Alain Rist
I prefer this :) #include #include #include #include static const double bad_double = std::numeric_limits::quiet_NaN();class QuadSolver{ static bool IsZero(double val) { return (val == 0) || (fabs(val) <...
by Mohibur Rashid
Title says it all.
by Jason Stern2
This is a simple Windows example using the Chromium embedded framework 3.
by Rick York
This is a simple worker thread class that allows when to use a member function as the thread function.
by Marco Bertschi
Sktech for a generic queue which can handle tasks, process them and report the result
by Nippey
This is a TCHAR alternative for "A Small Class to Read INI File"
by paladin_t
A String & Number Compatible ID Class in Native C++
by CodeRichardWong
Especially useful in some situations. Sometime may be confused inside, is it?(id4) assigned double's result is diff.If you add this:id1 = id4;The answer is...better to prepare one more conversion.have a Try~
by HateCoding
A tiny custom list control
by Southmountain
glaux.h header file & glaux.lib can be replaced by freeglut.h & freeglut.lib
by Southmountain
Some quick configurations to get MFC support for console application
by osy
Proper implementation of a signal handler
by Mukit, Ataul
A simple implementation of alpha blending technique displaying the basic mechanism behind it
by Mukit, Ataul
SledgeHammer didn't help, so I had to do it myself... here it is again - a super fast improved algorithm compared to the previous one and with no setpixel and getpixel :)void AlphaBlend(CDC* pDC, int xDest, int yDest, int nDestWidth, int nDestHeight, CDC* pSrcDC, int xSrc, int ySrc, BYTE...
by Greg Utas
Replacing its erase() function
by Ritesh_Singh
C++ code to connect/access DB2 database using DB2 call level interface(CLI)
by Amit Deshmukh 1010
Accessing class object present in exe from explicitly loaded DLL using Inheritance and virtual function.
by Alexey Shtykov
Activate a particular document window in MDI application via MFC/C++
by Gregory Morse
Activating WRL audio interfaces in native C++
by hjgode
The following is a nice? sample for an automation task. This batch will be executed every time a device connects to your PC via ActiveSync. You will need the itsutils.As you can read, the batch (script) first tries to check, if it has already been run on the device. This is done by looking...
by Francis Xavier Pulikotil
Enable passing an argument by reference, to a function which expects an argument of a different type.
by Priyanka Sabharwal81
Adapter Design Pattern in C++
by Lantert
Add Excel style filter function to Chris Maunder's CGridCtrl
by Arthur Caputo
Tutorial on setting a false transparency onto your button's edges.
by Ashish Ranjan Mishra
How to add sub menus dynamically, adding event for them and also retrieving the menu name on click event of individual sub menu
by jit_knit
Adding Map support in Dashboard for executive reports
by Greg Utas
A function may only return from its last line!
by Vedat Ozan Oner
A library for 5-button analog keypad
by Martin Vorbrodt
Advanced thread pool
by Rob Kraft
A method is idempotent when the same input(s) always return the same output.  This method is idempotent: This method is not idempotent: When adding methods to classes, many developers spend little time deciding if the method should be idempotent.  Making use of the properties in the class causes the
by WebMaster
Some simple examples of how to apply affine transformations in computer graphics.
by Arthur V. Ratz
This tip/trick introduces the basic ideas on how to avoid memory mismatched allocation/deallocation issues detected by Intel® Inspector XE for Visual Studio 2015
by Abed AlSayed
AlSayed ColorBar is a TrackBar best for professional color picker, like the one used in Adobe Photoshop.
by Ștefan-Mihai MOGA
How to download files from an HTTP server.
by Jigar_Patel
Amazon S3 lib for uploading file in C++ using VS2010
by Basil_2
A few uncommon code sample
by User 40411
Try this one://Can we print all integers from 1 to 30??/int x = 0;while (x < 30){ _tprintf(_T("X = %d\n"), ++x);}
by davrossi
This is an alternative to LoadString for accessing string resources.
by BernardIE5317
On certain occasions, Visual Studio does not indent as intended so here is an awk program which does the trick.
by Stephane Capo
C++ optimization for map using string key among others
by cruppstahl
Describes algorithms for integer compression, introduces a few libraries and shows how to use them
by Alexander Golde
Analyzing Syslog files can be easy...
by Martin Vorbrodt
AoS vs SoA performance
by Bruno van Dooren
Symantec can cause valid applications to crash and be gone without a trace
by Marco Bertschi
A short guide on how you can style and customize the appearance of you QML controls in a CSS-like way
by Bartlomiej Filipek
How to apply the strategy pattern to a problem while designing a class hierarchy. What are the pros and cons of this approach?
by Steffen Ploetz
Step-by-step instructions and source code snippets for inserting a bitmap (or a section of it) into an icon image.
by webmaster442
Some useful Arduino tips & tricks
by Joren Heit
Easy, compile-time manager of EEPROM variables
by Joren Heit
Easy, compile-time manager of EEPROM variables
by jean Davy
std::string source = "Hello World";std::wstring result( source.begin(), source.end() );One coding line less !
by blytle
also since _bstr_t's have operator (char *) and operator (wchar_t *) if you have included comutil.h, you can use it to do your conversion.char * source = "this is my source" ;_bstr_t converter_temp(source) ;wstring target ;target = wstring(converter_temp) ;... and the other way...
by Philippe Mori
inline std::wstring AsciiToUnicode(std::string text){ // Could do some DEBUG check here to ensure it is really ASCII. // Also, if in the future, it is found, it is not the case, // it would much easier to update code. // Same as jean Davy here... return...
by Sohail Fareedi
Page Framework Initialization - Page.Init
by Martin Vorbrodt
Atomic blocking queue
by Daniel Ramnath
C++ (CygWin GCC) and OpenSSL code to Attack upon AES-CTR encryption
by Ihab ramadan
Demo illustrates how to make augmented reality program using irrlicht and newton
by Ajay Vijayvargiya
Visual Studio 2010, for Visual C++ projects/code, now supports auto complete feature for #include statement too!Just type in #include directive followed by " or <, it will list all possible header files. It will also show the full-path of the file (selected in listbox), on the right side of...
by Steffen Ploetz
Automatically Disappearing Dialog
by ed welch
Automatically stepping over STL
by Roi Azulay
An automation solution using Arduino
by Member 10912276
How to control game elements based on predefined conditions
by Grigory Avdyushin
Short description how to create a sexy badge for windows 7 taskbar
by Martin Vorbrodt
Base64 encoding
by pasztorpisti
Avoid accidental virtual method calls in C++ constructors/destructors, Java constructors and be careful with them in C#!
by Roger65
A project to place a Dialog Box on the Taskbar
by Martin Vorbrodt
Better blocking queue
by Martin Vorbrodt
Better timer class
by Zebedee Mason
Or why not both? This shows how.
by Laurie Stearn
Dialogex with Listbox to manipulate long paths in Windows
by Martin Vorbrodt
Bit fields and race conditions
by JJMatthews
How To Place your common bitmaps inside your source files
by honey the codewitch
Easily shift bits in memory of arbitrary length, declare integer sizes programmatically, endian conversion, and more
by Martin Vorbrodt
Blocking queue
by Martin Vorbrodt
From Wikipedia: A Bloom filter is a space-efficient probabilistic data structure, conceived by Burton Howard Bloom in 1970, that is used to test whether an element is a member of a set.
by jean Davy
#include must not be in precompiled header
by Norbert Schneider
How to develop using C++/Boost on the Mac using XCode
by FranciskaR
Benchmarking Boundary Trace Algorithm against some FloodFill algorithms since they used a stack or recursion
by Daniel Ramnath
Breaking Vigenère cipher with C++, believed to be unbreakable for two centuries.
by Daniel Ramnath
Breaking weak RSA with C++ & GMPXX library
by Soumya Ranjan Das
#include<iostr...
by amsainju
This tip shows you how to compile crypto++ for 64-bit environment.
by c chee
Showing how to pass a Fortran function into C and using a compatible C-Struct as argument.
by Emiliarge
Both MS Access formats (mdb and new - accdb), MSSQL 2008 R2, MSSQL CE, SQLite, MySQL
by Emiliarge
Read and write data to Access databases without limitations caused by the use of the SQL.
by marcus obrien
When trying to move into C# from C++, a little explanation of how functions can be overridden, and some of the pitfalls you may encounter.
by Daniel Petrovic
In this tip, I want to represent a quick lightweight possibility (one of many) for parsing command line arguments on the fly using C++17.
by CalicoSkies
How to use istream_iterator and the copy algorithm to populate an STL collection from a text file with very little code
by InActive
How to use the .NET DateTime class in C++ to generate a basic calendar via a console program
by zdanman
Fully Customizable ProgressBar Control with Percentage shown that changes color as progress covers it
by Caner Korkmaz
C++ -> Drawing Rectangles to Console
by Jose David Pujo
Smaller code:void DrawRect(int x, int y, int width, int height, int curPosX=0, int curPosY=0){ setxy(x, y); cout << char(201); cout.width(width); cout.fill (char(205)); cout << char(187); setxy(x,height+y); cout << char(200); cout.width(width); cout.fill...
by BrainlessLabs.com
In this tip series, we will create a small C++ game engine.
by Jonathan Weber
An incomplete C++ class for Arduino
by saephoed
An ad hoc solution to mark and track code points in C++
by ben-oved
The copy constructor is a special kind of constructor which creates a new object which is a copy of an existing one, and does it efficiently.The copy constructor receives an object of its own class as an argument, and allows to create a new object which is copy of another without building it...
by Grant Curell
A basic copiable count sort implementation.
by ls6777
Task monitor for multi-threaded embedded systems
by Dan Quist
A lightweight synchronous event framework for C++
by cth027
A small utility class to ease C++ stream input with predefined and controlled format
by Ritesh_Singh
A function which returns date in different formats base on the input given
by Ullas_Krishnan
How create a Splash Screen in C++ Program (TurboC) in DOS Mode..
by Claudio Farassino
A small and simple C++ GroupBy with the same syntax and use of DotNet GroupBy
by gintack
C++ header file to plot data in the form of x, y, z arrays and list as potential lines and graphs
by saephoed
Helpers to declare and define multicast event sources and sinks in C++
by vikrantc1355
C++ Numeric Limits and Template Specialization
by Daniel Ramnath
C++ OpenSSL 3.1 Attack AES-CBC using Padding Oracle Attack, and Timing Attack
by Daniel Ramnath
Reverse proxy developed using BOOST 1.75 asynchronous ASIO calls
by Lars P.Wadefalk
I have sometimes wondered if the 'with' statement would work in C/C++, just like in pascal. Meaning that it would in it's nearest scope automatically recognize class/struct members for the ones mentioned with a . or maybe -> operator.Maybe something like:TestClass* tc;float...
by elitehussar
Minor edits to improve wording
by MilesAhead
A good exercise to aid in always using delete [] where appropriate is to code your own autoarray_ptr following the pattern of c++ auto_ptr. The destructor calls delete [] when the instance goes out of scope. Saves writing a lot of messy delete [] code in "if chains" and switch blocks....
by Sauro Viti
The C++ comes with a rich standard library: the STL (Standard Template Library).So, why we should re-invent the wheel while we already have it done, safe and written to be light-weighed and performant?It's too much better to use the vector Class (Standard C++ Library)[^]:#include...
by BWake
It is a bad idea to treat built-in types differently than programmer defined classes. If you delete a dynamically allocated array of a built-in type without the brackets the memory buffer may go away just fine. This is not guaranteed. The VS2008 runtime throws an exception. There is a...
by Shao Voon Wong
Make your class non-copyable without Boost
by Shao Voon Wong
Do not use memcpy directly to copy array
by bvinothraj
C++ Wrapper for Pipe-based IPC in Windows
by Evan Zhao
ffpython is a C++ lib, which is to simplify tasks that embed Python and extend Python.
by Jon McKee
How to do it and why it works
by arussell
Unlock a file that is in use by another process
by CalicoSkies
C++: Converting an MFC CString to a std::string
by jean Davy
As you use CString, you have access to the CW2A ATL macro, assuming that you work with _UNICODE defined, here it is:CString theCStr;...std::string STDStr( CW2A( theCStr.GetString() ) );which will convert to "system encoding on the user's machine" (thanks Nemanja[^] comment !), if you...
by oleg63
CString m_Name;CT2CA pszName(m_Name);std::string m_NameStd(pszName);Works for me everywhere... :)
by steveb
In UNICODE:CString str = L"Test";std::wstring ws(str);std::string s;s.assign(ws.begin(), ws.end());
by Kaqkk79
How about this (assuming your project is set to Unicode)?CString strMyString=L"Test string";std::string strMyStdAnsiStr = CStringA(strMyString);
by geoyar
I am using CString str(_T("Test"));typedef std::basic_string string_t;string_t resStr(str);It works because the CSting has a cast to LPTCSTR.
by stonexin
LPSTR WideChar2MBCS( const CString& strCS ){ const UINT wLen = strCS.GetLength() + 1; UINT aLen = WideCharToMultiByte(CP_ACP,0,strCS,wLen,NULL,0,NULL,NULL); LPSTR lpa = new char[aLen]; WideCharToMultiByte(CP_ACP,0,strCS,wLen,lpa,aLen,NULL,NULL); return...
by Shao Voon Wong
A helper class to ease writing Copy-On-Write class
by Shao Voon Wong
This tip presents a custom RTTI class which is 10x faster than dynamic_cast
by Shao Voon Wong
InsertionSort outperforms QuickSort on almost In-Order Array
by Shao Voon Wong
C++: Prefer Curiously Recurring Template Pattern (CRTP) to Template Pattern
by Shao Voon Wong
Data width must stay unchanged for cross-platform interoperability
by Andreas Gieriet
HTML page with all syntax/grammar productions of C++98/C++11
by Stanski Adam
C++11: C# like properties
by Shao Voon Wong
C++11 std::div() Benchmark
by Shao Voon Wong
C++11's std::conditional tip with an endian swap example
by Shao Voon Wong
Heterogeneous lookup with char* and string_view without temporary string instantiation in ordered and unordered containers
by Shao Voon Wong
Benchmark of Singular Min/Max and Iterator Versions
by Gareth Richards
An implementation of the Neural Network backpropagation learning algorithm in C++ using the BLAS proposal in P1673.
by Shao Voon Wong
Never test for NaN by comparing it with NaN literal
by honey the codewitch
std::chrono doesn't work on the Teensy? Oh no! Here's how to fix it.
by trident99
CalcStar is an expandable, fast C++ function evaluator that gives the user the same computational power as a scientific calculator.
by David Wincelberg
Displays a date/time difference as calendar days or 24-hour days and can show hours or minutes for the first 24 hours
by CathalMF
Describes with an example of how you can call C#.NET methods from unmanaged C++ code.
by phillipvoyle
Yes! Using a hand coded reflection class. Sample code provided.
by Abdallah Al-Dalleh
How to handle post data coming inside an HTTP POST request
by Taehoon Kim 1004
Capture program using GDI
by Evgeny Pereguda
Simple lib for capturing video from web-camera by using Media Foundation
by Ghosuwa Wogomon
An in-depth explanation of correct bracket placement and why...
by Sriranganatha
Discussion on which casting to use - static, dynamic or reinterpret
by Christian Koberg
How to use CAsyncSocket in a console application? Is it possible at all?
by techcap
Caution when using "yield return"
by Eddie Nambulus
CheckBox as an item in CComboBox
by _Flaviu
A class designed to connect to a database through ODBC and perform basic operations such as inserts, updates, and deletes
by Ștefan-Mihai MOGA
How to center window in WIN32
by Charles Kludge
void CenterWnd(HWND wnd){ RECT r,r1; GetWindowRect(wnd,&r); GetWindowRect(GetDesktopWindow(),&r1); MoveWindow(wnd,((r1.right-r1.left)-(r.right-r.left))/2, ((r1.bottom-r1.top)-(r.bottom-r.top))/2, (r.right-r.left), (r.bottom-r.top),0);}
by Nick Kulikovsky
There is ATL CWindow method CenterWindow:void CenterWnd(HWND hWnd){ CWindow wnd; wnd.Attach(hWnd); wnd.CenterWindow(NULL); wnd.Detach();}
by Roger65
CFileDialog in a Console Application
by Binu MD
Change GUI control position with dialog re-size
by Binu MD
Change the default ICON of MFC applications
by Sayyed Mostafa Hashemi
How to set/change the master volume.
by milkboy31415
This code transforms rotations and vectors between reference frames such as Unreal, 3d Studio Max, etc.
by matt_taws
Isn't it more easy to just do:return nStatus == NERR_Success
by Tejashwi Kalp Taru
Ever wanted to change the Windows Aero color without restarting the DWM?
by IssaharNoam
Simple and customizable Chat Conversation control, with DataTable datasource, inspired by SMS application balloons in OnePlus One Android smartphone.
by PJ Arends
I have seen many different ways to check if the computer has an active internet connection. The best one, IMO, is to check for the presence of the default route in the IP forwarding table that is maintained by windows. This can be checked by using GetIPForwardTable function found in the...
by Charles Oppermann
How to check Windows 7 version in Visual C++
by Doc Lobster
Be sure that your array has the right size - without using size_of!
by pasztorpisti
You can find out if a DLL exports some symbols/functions without calling LoadLibrary() on it
by Sayyed Mostafa Hashemi
Code for checking the avilabiltiy of Internet connection.
by Enes Yıldız
I have prepared a project for my lecture. In this project I decide two string value is same or not as checsum algorithm... I used 2 language to explain the codes.
by Farhad Reza
Chess piece movement project using C++ and GDI+
by Martin Vorbrodt
A post about several topics dealing with classes and what happens under the hood when we use member functions, inheritance, and virtual functions
by hofingerandi
Workaround for a bug in the CMFCEditBrowseCtrl that causes heavy flickering (starting with Windows 7)
by _Ravikant Tiwari_
This program will demonstrate the process of injecting code into already running processes. Here we have choosen to inject into Explorer
by _Ravikant Tiwari_
Code Injection - A Generic Approach for 32bit and 64bit Versions
by Alain Rist
There are circumstances, such as report or log entry, where we need to collect data from an object of some other (related or not) class. The C++ language only requires that we instruct the compiler how we intend to do it. This is simply achieved by defining a constructor of recipient_class...
by rbrunton
Using Windows hooks to capture mouse action.
by Chandra Shekhar Joshi
If you are migrating your COM application to Visual Studio 2012 then this could be helpful for you.
by ferdo
How to compile MFC sources with VS 2019 (for ARM64 too)
by David A. Gray
While you can often get away with ignoring compiler warnings, failing to at least scan them can bite hard!
by Alexander Lednev
This method uses "constexpr"
by pi19404
This article describes the method to cross compile C/C++ library for Android OS
by Karl Tarbet
Complex math library for C# and VB.NET
by Foothill
Complier Error: RC1004
by Dominique Gilleman
How to handle (load/save) only a part of an aggregate domain model with composition
by Sumon1524
Observu monitors your websites from multiple locations and combines it with measurements collected on your servers. Here this article will show how to send data to Observu.
by Christian Koberg
Console output, general applicable to all executables on a Windows system
by aaverian
A very simple console progress bar.
by Rahul Warhekar from Pune, MH
This post explains all the uses of const keyword
by Paulo Márcio
CRC32 using user-defined literal.
by #realJSOP
How to fix this ANNOYING problem
by PJ Arends
A small command line utility to convert a binary file to hex encoded text file
by Mukit, Ataul
This tip shows you how to convert the dimension values in the .rc file of a dialog into pixels
by _Flaviu
A simple way to convert an office document to PDF
by Pranit Kothari
If you have chosen Win32 console based application while using New Project Wizard, and later you realize you need to add MFC support, here is a trick.
by Doc Lobster
String conversion using the C++ Standard Library only
by Arman S.
Shows how to convert between different image formats by using GDI+
by SaahilPriya
The sample demonstrates how to count the number of OLE Automation Objects running at a particular time.
by CPallini
A simple algorithm for counting occurrences of symbols in files
by Mukit, Ataul
This tip is about creating a cursor from an icon
by Mukit, Ataul
This tip shows how to create a service
by stevenong_2006
This project is intended for one to create an automated build environment to build the Boost libraries set to be used with VC++ in Visual Studio 2013.
by Mukit, Ataul
Create a bitmap from an array of pixels
by SuperFun21
A general function using MFC that runs a command using CreateProcess(), waits for it to terminate, and returns its ExitCode.
by Florin Gherghel
How to create a BOTTOMMOST window (Win32 and .NET).
by IpsitaMishra
In this tip, we will learn how to create a partial view and use that view in the parent view.
by Volirvag Yexela
This tip suggests the way of launching a process with Medium IL from the process with High IL.
by vblover Programmer
Create a resource-only DLL
by Mukit, Ataul
This article shows the use of mutex's with explanations (Copied from MSDN - may prove convenient for some)
by Gregory Morse
How to create and use the parallel task library ported for native C++ WRL
by Philipp Sch
How to use an IStream-Interface with FFmpeg
by Mukit, Ataul
This tip shows you how to create a delegate from a C++ function pointer
by Javad Taheri (drjackool)
Creating Simple PNG Decoder/Encoder
by TyrWang
Use CResizeWnd as an add-on to any dialog
by Arkadiusz@inquiry
CRichEditCtrl does not take the return
by araud
Did you ever want to know where most of the memory is consumed? Whether it leaks or just gets allocated too much. This home brew memory tracker is yet another bicycle that you will be able to tune for your needs.
by Tomaž Štih
Simple trick to implement csharpish properties in modern C++
by _Flaviu
A memory CTreeCtrl like object, but resident in memory only
by Kerem Kat
Compile and run CUDA 3.2 projects from VS2010 in 9 easy steps
by Alex Culea
Shows how to create a window that behaves like a context menu
by Gregory Morse
Custom Media Sink for use with Media Foundation Topologies and WinRT/WRL MediaCapture
by Javad Taheri (drjackool)
Show or hide, reorder, save and restore list view column headers
by VISWESWARAN1998
CyberGod KSGMPRH is an open source antivirus which is designed to work under Windows operating system. It comes with a DOS Engine helping developers to customize the anti-virus engine as they please.
by Apprieu (Apprieu)
by IgorRadionyuk
Automatic mapping some key to the fabric function, and its usage
by Vivek Goyal
Debugging Java JNI and C++ code in COM based application
by Member 7961821
Life debug plug-in of non debugable host
by User 2623109
Make this ndk-gdb finally work with threads
by Yochai Timmer
Debugging C++ projects in release. Finding the lost object information
by Junaij
Timing code using debugger
by LaRoy Tymes
Here is a fun program that not only shows how to get precise timings by using the time stamp counter, it also shows how to call main recursively. This is a C program. C++ will not allow calls to main.#include "stdio.h"#include "Windows.h" // Required for Sleep#define CPUID __asm __emit...
by Mukit, Ataul
This not so useful tip tells you how to declare a reference for a two dimensional array without needing to use typecasting.
by kooyou
The second form is wrong. A two dimensional pointer does not equal to a two dimensional array. But you can use an one dimensional pointer to reference the two dimensional array.int arr[1][20];int *pTwoDem=(int*)arr;Now you can use *(pTwoDem+10) to replace arr[0][10].
by Stian Andre Olsen
EncodeText is a small program that can decode and encode text files using any of the codecs supported by Qt
by Shiva Varshovi_
DFS algorithm to print the element of a Binary Search Tree in order in which just by traversing with a DFS algorithm is possible
by Parthasarathy Srinivasan
Mutliple observables / subjects with multiple observers in C++
by Sam@112
Real-time push notifications for network connected distributed system
by pasztorpisti
An advice to make your DLL interface more attractive and easier-to-maintain even in cross-platform projects
by Evgeny Pereguda
Simple article about using of Desktop Duplication API for capture desktop screen WITH image of cursor
by Mahdi Nejadsahebi
With this algorithm, we can detect amount and knoll of an arc
by DangBao
How to detect and recognize faces using OpenCV (step by step instructions for beginners)
by Mahdi Nejadsahebi
Detect knoll of an arc.
by Derell Licht
Find logon time on Windows 10
by hasan bozkurt
Determining all bootable partitions using PInvoke
by RioWing
Why does it have to be this complicated to call a constructor
by slaon77
Setting APM level for SATA hard drive
by Shao Voon Wong
How to disable MFC SDI/MDI Submenu
by mbue
switch ... case statement for strings
by Niklas L
This tip show how to display all entries from a C++ vtable in the VS debugger.
by Jose A Pascoa
Part 1 - Using DMath from C#
by M Sheik Uduman Ali
Don’t use elephant for your garden work
by Jibesh
Simple Drag and Drop functionality in a dialog.
by Biruk Abebe
How to completely take control of drawing a custom application window including the captionbar, menubar, toolbar, borders and statusbar in MFC Single document interface (SDI) applications using the MfcSkinSDI class.
by Orjan Westin
Simplifying the use of dynamically sized C structs
by Paul Heil
An easy intro to kernel API hooking in Windows Mobile / CE
by BernardIE5317
A simple struct is presented which permits the automatic display to the console of function entry and all exits
by Ahmed Elkafrawy
An easy way to simulate keyboard press & release keys to another application
by Mircea Neacsu
Source code organization suggestion
by Emiliarge
Simple WebBrowser (IE) class in Pure C++
by Arman S.
Shows how one can use IStream for in-memory operations
by honey the codewitch
Detect when your SD card gets removed and recover gracefully, even without a card change pin.
by skydirve
An article about encapsulating a memcache.
by serup
Makes message handling between applications easier, by encoding/decoding to/from one data block.
by CPallini
C++ implementation of 2x2 Hill cipher
by Martin Vorbrodt
How to convert an enum to a string value
by Martin Vorbrodt
How to convert enum to string
by imagiro
Ever had to enumerate the supported media files under Windows for example for the filter-string for GetOpenFileName?Here is a simple solution (using ATL for the registry access):void EnumSupportedMediaFileTypes(){ CRegKey key; CString s; DWORD dwLen; DWORD dw =...
by honey the codewitch
A rundown of some common tricks and pitfalls when working with SD readers for IoT gadgets
by Mircea Neacsu
How to efficiently evaluate a polynomial in C++
by Martin Vorbrodt
Event objects
by Slavisa
Events and Delegates in Standard C++ implemented using Macro functions
by dragonfly lee
How to exchange date time between C# and C++
by Shvetsov Evgeniy
Using C++ templates? Wish your template algorithm will be versatile and ready to work with the classes, which do not fully support the required interface? Want more functional programming with C++? Get it now!
by Ozan Müyesseroğlu
If you want to export strings in C++ to VB.NET, build your function like this:BSTR __stdcall expfun(void){ char* cp_test = "Hi World!"; CString cs_test; cs_test.AppendFormat(L"%s", cp_test); return cs_test.AllocSysString();}and in VB.NET:Imports...
by Ion_tichy
Xsd2Struct is a software for the creation and run-time processing of an external description data structure.
by Andrey Grodzovsky
External functions call tracer for executable linked shared libraries
by Kyudos
Extracting A Particular Icon From an .ICO Resource
by fernandoc1
This article describes how to extract RAW image information from Thermal Flir JPEG images
by Manish K. Agarwal
Simple Factory class with Open Closed principle.
by Alexey Shtykov
How to become a fancy guy who uses C++ time library instead of old and famous time.h
by Octopod
An easy way to trap all the memory leaks of your application.
by Lakamraju Raghuram
For Visual Studio IDE we can detect leaks by using CRT debugger functions#define _CRTDBG_MAP_ALLOC#include #include void main(){ // ...... // ...... _CrtDumpMemoryLeaks();}This will dump leaks if any to the Output window. Check this link :...
by LORY Flavien
Fast detection of big barcode 39
by Ștefan-Mihai MOGA
A quick solution to transform binary data to plain text
by itsdkg
This tip explains the usage of arrays for creating Fast binary search trees.
by Mukit, Ataul
This tip shows a very fast algorithm (with some constraints enforced for it to work) to EnsureVisible a row in CGridCtrl by Chris Maunder
by YvesDaoust
Yet another home-made implementation of the floor function
by Asif Bahrainwala
FFT using DX11 compute shader
by Martin Vorbrodt
Fast semaphore
by Nick Kopp
How to both simplify CUDA applications and improve PCI-Express performance.
by Johnson Augustine
Faster image matching or comparison in large set of categorized images or training set in machine learning
by Hadrich Mohamed
This article shows you how to fetch the name of your Windows Phone 8 using some C++/CX code.
by RajaManikandan_R
by GPUToaster™
Hi,VB 6.0 is dead. And if you want to use them in your VS 2008/2010 Environment then you cannot use(The same is also mentioned in Dranger's Tutorials.)if(frameFinished) { img_convert((AVPicture *)pFrameRGB, PIX_FMT_RGB24, (AVPicture*)pFrame, pCodecCtx->pix_fmt,...
by Shao Voon Wong
Benchmark of recursive and iterative Fibonacci number generation
by joseph.arul83@gmail.com
Non Recursive and Recursive implementation of Fibonaci series in C++. Emphasis is on the complexity involved in the different implementations.
by ostream
A stupid change :) int FibonacciR::Fibonacci(const int &n){ if(n<=1) return n; return Fibonacci(n-1) + Fibonacci(n-2); } :laugh:
by Aescleal
If you can, the quickest way to calculate the Fibonacci numbers is to do it at compile time. This is a case of "My recursive method is quicker than yours...":templateclass fibonacci_number{ public: static const T value = fibonacci_number<T, n -...
by mef526
Finding a substring is trivial, but is it a word?
by Not Active
Plagiarized from http://msdn.microsoft.com/en-us/library/ms724429(VS.85).aspx[^]
by Ștefan-Mihai MOGA
How to find a substring in a text, forward and backward, with Case Sensitive and Match Whole Word options.
by Roger65
Find file or use wildcard i.e. dlg*.h, or *.*
by Shao Voon Wong
Fixing Inconsistent Stroke Width of Chinese Characters
by Rick York
Something to help compile samples from the VS2010 feature pack
by Southmountain
How to install and register .OCX components for legacy application
by Artem Moroz
A story on how memory leak can appear from seeminghly nowhere
by Shao Voon Wong
Performance of Floating Point and Integer Arithmetic has closed gap in modern CPU
by liaoy747
Microsoft don't have a nice interface that used to select a specify folder.
by Keith Barrett
Since Visual Studio 2005, native C++ has had a ‘for each’ loop construct, like C# or Java. Unfortunately it is restricted to collections from the STL library, such as vector. However, it does mean you can write very neat code to iterate through such a collection:vector...
by Member 16179004
Capture Enter key in edit control with no dialog box and no subclass.
by Ajay Vijayvargiya
Need to Format/sprintf a string before displaying a messagebox? Here is solution!
by Aescleal
printf is so 1980s. If you don't want to dig out your shoulder pads and big hair why not go for a more modern C++ approach?Instead of a function try a stream buffer:class message_box_stream_buf : public std::basic_streambuf{ public: message_box_stream_buf( const...
by Juan AG
Create a dll wich uses MFC statically linked and allow you to call normal methods, static methods and global variables, quick an easy
by Alexey Shtykov
A few words about function templates
by Naveen
Function to get the local system administrator name
by Martin Vorbrodt
Function try-catch blocks
by Søren Gullach
Fuzzy lib that have a GUI and uses Lagrange for member curve generating
by m_sylvain
This tip shows how to build an FxEngine plugin to stream video data from a webcam
by Arun Maiya
How to setup GCC cross compiler in Windows to generate Linux binaries
by cdp_anhui_china
A special debugger to detect and locate GDI leaks, with source code.
by David O'Neil
I needed an 'Update' solution for a project, and modified Geert van Horrik's 'Updater' to do so. This is the solution in Visual Studio Community Edition
by Southmountain
Gems for typedef and namespace in C
by Shvetsov Evgeniy
How to generate a random sequence of chars with the specified parameters (e.g., length, char sets, char count per set, etc.)
by Apprieu (Apprieu)
How to generate a serial key with Crypto API MFC
by Ștefan-Mihai MOGA
How to get temporary files with any extension.
by Zhuyun Dai
To generate a TLB file for an IDL file in build
by BernardIE5317
Method utilizing variadic arguments and macros
by Vlad Neculai Vizitiu
How to generate breakpoints
by NATKIT7
One example of the need to have a set of nested loops in is combinotronics where you are trying to generate all possible combinations. If we want to have a variable number of elements generated then we need to look at having dynamically nested loops.
by c-smile
The way to add generators with yield to C++
by Loay Al Lusi
Genetic Algorithm is used to search for maximum/minimum value of a given function using the concept of chromes and genes.
by Steffen Ploetz
Box, cylinder, cone and sphere construction for OpenGL with texture and light effects
by Ansas Bogdan
This shows you how to cast a Pointer to a Memberfunction to any Pointer Type you whish.
by MaxMax14
Keep the items highlighted when focus is on another control
by Shvetsov Evgeniy
Type tricks (above described and other)
by Thomas B Dignan
Getting the text of Win32 Error codes for 99% of cases.
by Orjan Westin
Simple function to get the text message corresponding to a system error.
by Mr Nukealizer
Ideal for finding LoadLibrary() in 32 bit programs from a 64 bit program but it works for any function in any DLL and supports forwarded functions and ordinals.
by Member 11246861
Within LAN, laptop gets signals from microcomputer and microcontroller using TCP/IP and SPI
by Sa Sha
Implementation of GMDH algorithm, using a sigmoid function. C++, VS, AlgLib-based
by Apriorit Inc, Artur Bulakaiev, Oleksii Kupriienko
Use of Gmock makes unit testing much faster and less resource intensive. Mock objects mimic real objects, but provide specific responses.
by pasztorpisti
How to open a console in a non-console C/C++ application or DLL and make printf/scanf work (stdin/stdout/stderr related functions)
by Dave Cross
I just use OutputDebugString() and Sysinternals' DebugView.exe.
by Jaime Olivares
Plain old console output is still a valuable debugging tool, even when used in a GUI application.There are many tools here in CP that can be combined with console output like:CConsole - a simple console for debug output[^]Creating a console for your MFC app's debug output[^]You can use...
by tombog0
GridLine, opengl with C++
by trident99
GT is a compact, efficient, and customizable graphical user interface (GUI) library for the Windows environment.
by Steffen Ploetz
A solution for: If the toolbar is created button by button with single TB_ADDBUTTONS calls, the width of the separators is not calculated correctly.
by Mehul Donga
Handle managed (C#) event in managed (C++/CLI)
by dhruv_mca
This program will help you understand how you can avoid crashes for unexpected input.
by Aescleal
Instead of doing what the original author does (which is read a string and convert it manually into a number) why not use streams properly?When a program wants a number, read a number and then check the stream state is still good. If it's not you know the user has entered something that's...
by Richard MacCutchan
Recent questions on reading ANSI vs Unicode text prompted the following
by jfriedman
When you need a janky [unsafe] way to generate communitive hash codes
by José Cintra
Simplifies your programs through the use of HashMaps and other data structures with the Arduino programming language
by Jipat
For creating filesystem driver we need IFS kit [ http://www.microsoft.com/whdc/devtools/ifskit/default.mspx...
by Marco Bertschi
Qt grew up to be a quite adult framework, but is still missing a global named Mutex - Something I fixed with a little trick.
by pasztorpisti
How to create your first DLL without coding too much... :)
by honey the codewitch
Use batching to increase performance during complex rendering operations.
by Rick York
A simple, header-only class for high resolution timing
by Andy Kirkham
The Poco XML Configuration has thrown up a number of (unanswered) questions across the inter-webs. This tip is intended to answer the commonest of them all, how to read multiple tags within an XML container tag
by Simon-Benyo
Hooking unmanaged processes using VB.NET.
by ShilpiP
How do I make GSOAP support Unicode?
by Paul Heil
A quick demonstration of how boost.phoenix makes a messy boost.bind call much easier to read
by schollii
Compute the number of trailing zeros in factorial(N) for any 32-bit integer N > 0
by Dharmateja Challa
This article is about generating random data using Trusted Platform Module in Windows 10 and testing its randomness using dieharder test suite.
by Kashif.Mushtaq.Ca
A time-based, One-time Password Algorithm (RFC-6238, TOTP - HMAC-based One-time Password Algorithm) based token, implemented by e.g. Microsoft or Google Authenticator mobile application.
by bleedingfingers
I want to share a simple class I use for this purpose. The class operates on kernel objects.
by Aescleal
I tend to use boost::interprocess::named_mutex for the same thing. The equivalent code is something like:using boost::interprocess;const char *application_name = "Application Name";int main()try{ struct named_mutex_killer { ~named_mutex_killer() {...
by Malli_S
Solution II used to use following simple way to manage the single instance of the app.//Usually I append the UID to the application name to achieve the unique object name.TCHAR szAppName[] = _T("Application_Name_999e7ba3-e8fc-4c21-985b-ab11f39ce759");HANDLE hMutex =...
by Menuki
This solution works in Windows environment under Visual Studio.I don't know if there is a Linux equivalent.I use a counter common for all processes.#pragma data_seg("counter") // counter common for all processesLONG gs_nCtApp = -1; #pragma data_seg()#pragma comment(linker,...
by Siarhei Boika
At first site, you can use BOOL WINAPI ShowWindow(__in HWND hWnd,__in int nCmdShow); with SW_RESTORE in nCmdShow (msd link) and maybe it needs to activate window before (not tested :))
by Siarhei Boika
Use SetForegroundWindow() to bring window to the top
by Lakamraju Raghuram
How to build an image (DLL/EXE) when two of its included libraries have the same symbol (say function/variable) using VC++
by Lakamraju Raghuram
As stated by many, the inclusion of /FORCE:MULTIPLE switch may lead to unexpected scenarios (even though the code will compile and link) and as an alternative we can build a DLL wrapper [as hinted by dvpsun] over any of the static lib and can invoke the repeated function via this wrapper...
by Pablo Aliskevicius
If the .lib files you're linking to represent some .dll files somewhere else, you can do the following:void main(){ FunB(); // from external_1.lib FunC(); // from external_2.lib // FunA(); // from external_1.lib / external_2.lib ???? typedef void (WINAPI *...
by Severin Friede
This article should help you building log4cxx with Visual Studio 2010
by Alexander Lednev
How to check if a string is literal in compile-time (C++)
by Nitesh Kejriwal
Friends, I am planning to write a series of articles on creating menus in different ways and this is the 1st one in the series. This post will explain how to create a simple 2 level menu using HTML and CSS only. We know there are a lot of ways to create a HTML menu &#8230;Read more &#8594;
by Doug Langston
The Add New Project wizard in Visual Studio (since 2015) is missing an option for Windows Form App - only for C++. Windows Forms are still available for C# and VB.
by PJ Arends
I needed to disable the Sleep button on my keyboard, here's how.
by OlegKrivtsov
Some tips on available ways of distributing CRT DLLs with your Visual C++ application
by Lai Taiyu
How to do simple image binarization?
by Lai Taiyu
A simple ordered dither algorithm (Half-tone image)
by Juan AG
Let´s do unit testing in a C++ project inside Visual Studio 2015 quick and easy
by zcrj
Reassembling the left-hand button mechanism
by Itai Basel
A macro that gets current function's return type on visual C++
by PE32_64
How to get Present Logical Drives by function GetLogicalDrives
by jean Davy
Forget all that "C" old bit operator, you are "C++", use the modern STL way ;) #include #include void PrintLogicalDrives(){ using namespace std; bitset lt ld = (int)GetLogicalDrives(); for( char i = 'A'; i <= 'Z'; i++ ) { ...
by mohamadArdestani
get shutdown message in java application with jni
by Mircea Neacsu
Get a unique identifier for a computer
by _Flaviu
A method of how to get rid of "close" menu from multiple CDockablePane panels
by altomaltes
Effortless configuration file added to your existing code
by Mukit, Ataul
Link to How to implement a resizable property sheet class that contains a menu bar in Visual C++ 6.0
by Bipin Paul
Implementation of Contact Us Page using ASP.NET MVC pattern
by Southmountain
How to install Visual Studio 6 on Windows 7 professional (64 bit)
by IgorRadionyuk
An iterator over parametric function, which is a well known mathematical abstraction: Parametric Function. It maps interval of real numbers[start, stop] to some values in the range of function.
by BernardIE5317
This tip demonstrates the use of the STL template std::invoke_result
by Vhalun
A step-by-step tutorial about how to build a Qt/C++ project on Android
by Tecfield
This post shows how to make a callback to C# from C/C++
by Lai Taiyu
How to make a clear color image (Histogram Equalization)?
by Lai Taiyu
How to make a clear gray image (Histogram Equalization)?
by SoMad
The example for CStringT::Tokenize() on the MSDN page (and just about everywhere else on the Internet) skips empty tokens. Here is how to use it in order to get empty strings instead of simply skipping those fields.
by Software_Developer
How to pass a two dimensional array to a function (C++)
by Randor
Console threads can be promoted to GUI thread and receive thread messages
by Tiago Cavalcante Trindade
How to put color in Python, C, C++, C#, Java and batch on the Windows console
by Steffen Ploetz
Use STL and C++14 to return a dynamically created string from a function/method, that is automatically garbage collected.
by Steffen Ploetz
My best practice approach to change the image of a toolbar button
by falvarezcp2008
Resolve long timeout when connection target is unavailable
by Jerry Jiang
Code to simulate a mouse click event in C++
by Marcell Lipp
This tip shows how to unit test a private function in C++.
by reachmeviz
This article explains how to map source code & assembly for easy debugging in Solaris OS.
by Dharmateja Challa
Using parallel_for_each which is part of Parallel Pattern Library ( PPL )
by Mukit, Ataul
This tip gives you a solution to verify whether an rtmp stream URL is working or not!
by YoungJin Shin
How to wake up a PC using waitable timer
by Marc Clifton
Each function should answer "how-what-why."
by ThatsAlok
Describing various method to zeroing the buffer in memory
by trotwa
char szTest[128] = { 0 };;)
by YvesDaoust
What about this, using SSE2 assembly (32 bits):void Zero(void* Buffer, int Count){ char* Cur= (char*)Buffer; char* End= (char*)Buffer + Count; // Clear the initial unaligned bytes while (Cur < End && (Cur - (char*)0) & 0xf) { *Cur++= 0; } // Clear...
by Jose David Pujo
I always use a home-made macro to zero my struct's and class's:#define ZEROMEMORY ZeroMemory (this, sizeof (*this))Sample1:struct S1 { double x; long i; char s[255+1]; S1 () { ZEROMEMORY; } };Sample2:class foo { private: double x[16]; char a,b,c; foo () {...
by Member 13737597
This article shows how Windows generates IP header's ID field
by trident99
The HPC Template Library is a supplement to the Standard Template Library providing threadsafe containers.
by Martin Vorbrodt
How to use cURLpp (C++ wrapper around libcURL) to make a simple HTTP query to ip-api.com in order to retrieve geolocation information of a given host or IP address
by Nick Alexeev
I'm advocating for the use of Hungarian notation in microcontroller code
by Member 11246861
RaspberryPi2 master transmits to and receives from Pic24FJ64GB002 slave through I2C
by KjellKod.cc
Ideone.com pastebin and online compiler with support for 40 programming languages
by Member 2398479
How to dispatch event messages in C++ like a Delphi TMethod
by Ahmed Elkafrawy
Implementation of an easy, fast, and optimized (CByte, CShort, CInt) with bits access using bit field and union
by Ștefan-Mihai MOGA
Implementation of Producer-Consumer problem in C++ and Python
by Gregory Morse
Implementing a complete WRL native C++ XAML blank project template
by Malcolm Arthur McLean
How to implement principal component analysis clustering algorithm to perform image segmentation.
by William Bourke
Uses Gödel numbering constants from program state for use with C++ switch statements
by Stefan_Lang
Header files often #include lots of other headers because other classes are being referenced. These chained includes force the compiler to repeatedly load and precompile long lists of headers over and over again. Thanks to #pragma directives or #ifdef guards this is a rather cheap operation,...
by George Shagov
An idea how to improve the performance of binary search algorithm using three boolean logic
by AlexZakharenko
A more efficient way to create objects for usage with shared_ptr
by Albert Holguin
The vc compiler and intellisense don't look for pre-compiled header in a similar manner, this is a summary of the issue along with workarounds
by Stefan_Lang
When incrementing or decrementing a variable, favor prefix operators over postfix operators if you do not need the value of the expression.Example:void foo(std::vector intvec){ for (std::vector::iterator it = intvec.begin(); it != intvec.end(); ++it) { // do something ...
by Mirzakhmet Syzdykov
Network programming in C++
by Martin Vorbrodt
Initialization List Exceptions and Raw Pointers
by Daniel Ramnath
C++, Win32 API - Injecting DLL in a process
by altomaltes
This code calculates square root of an integer on a few assembler code lines.
by sunhui
Integrate .NET Component to your Native MFC Application at runtime
by Stefan_Lang
When you compare a variable (a lvalue) to a constant (not a lvalue), always write the lvalue on the right hand side of the comparison.Bad example:if ( n == 5 ){ // do something}Good example:if ( 5 == n ){ // do something}This will help with your debugging in case...
by Ștefan-Mihai MOGA
A look at the URLDownloadToFile function and architecture of IntelliLink
by vivekshankars
Program to calculate the IRR value using C/C++ similar to the one available in Excel
by FenrisH
Demo of how C++ and C# interoperate
by Amir Hesami
An example of interprocess communication using named pipes.
by Martin Vorbrodt
Given only a stack, how to implement a queue
by Martin Vorbrodt
Interview question - analyze and point out what is wrong
by Martin Vorbrodt
Interview question - a programming puzzle
by flyhigh
SOUI is a directui library and had been used in many commercial softwares, which is published based on MIT and is completely free to any user.
by Steffen Ploetz
How to embed icons into Win32 programs without utilizing resources - useful for platforms without resource editor/resorce compiler, e.g., ReactOS. Learn the missing things about the .ico format.
by Steffen Ploetz
Check whether ReactOS is able to run OpenGL, determine a convincing IDE and get started with the OpenGL on ReactOS.
by Mukit, Ataul
This tip tells you how to solve the Invalid Address specified to RtlFreeHeap issue
by Mukit, Ataul
invoke method pointer elegantly
by honey the codewitch
Get location information based on your IP address using an ESP32 and ip-api.com
by Southmountain
How to smoothly build Diligent Engine on Windows 10 with Visual Studio 2019
by _Flaviu
A way to know when a floating CDialogBar is closed
by ThatsAlok
Showcase for lambda function in C++
by Ghosuwa Wogomon
How to use lambda functions in C
by Member 11246861
Some ways in which laptops and microcontrollers communicate
by Mohammed Faci
How to leverage ChatGPT to Build an Automation Framework using the Page Object Model
by Steffen Ploetz
Basic light source approaches and related material properties handling for OpenGL
by hairy_hats
When linking a mixture of mixed-mode and unmanaged DLLs to an unmanaged C++ executable, the link order can affect how the program runs.
by santosh poojari
This is most general collection operation that we come across daily. Its set based operation using LINQ Except Operator.
by Tiago Cavalcante Trindade
How to use WSL, GUI on WSL and how to compile for Linux on Windows
by jan.mach71
A small tool listing Administrators group members recursively using the ActiveDS library.
by Mukit, Ataul
This tip shows the technique of loading a 256 color bitmap into an image list
by Alain Rist
A set of C++ functions to load the resource into an existing string or build the string from it
by Aescleal
Alain's (original, now much hacked) narrow character version, could leak if std::basic_string::asign threw. To make the function exception safe either use a local buffer (if the size is fixed) or a vector (if the size isn't known).In both cases it's usually more efficient (and readable) to...
by Lars [Large] Werner
Use the standard GDI API to load an HBITMAP into SFML.
by pasztorpisti
This library loads the DLL (from file/memory/etc) into an allocated memory block and takes care of its relocations and imports.
by Member 4079860
Describes a process to load/unload built in drivers under WinCE at run time to speed up development process
by Derell Licht
C++ class that provides a convenient wrapper for lodepng library
by Adam Wojnar
A complete log viewer written in C++/WTL.
by Pankaj Choudhary - C++ Devepoler
Logging in C++
by Shiva Varshovi_
There are so many recipies to get the Longest Common Substring from two given strings...
by KingsGambit
When we look at pointer declarations, reading from right-to-left gives a better idea about what the pointer actually points to. Consider const int * p; if we read right to left: p -> * -> int -> const. i.e. 'p is a pointer to an integer constant' rather than 'constant integer pointer' (if we...
by avinash064
It is very simple :laugh: and fun ..just divide the line before and after * , likeconst int * pconst int (before *) represent [constant integer]and *p represent a pointer add both u get a pointer pointing to a constant integer , it means u can't change value but pointer can...
by ratah_
This tip discusses about a solution to allow us to use any class as a C-like 2-dimension array.
by Lakamraju Raghuram
Expanding a macro in VC++
by Member 8279190
Use Eclipse-CDT IDE. It shows the macro expansion in place without having to resort to running the pre-processor.
by Shvetsov Evgeniy
Everything you always wanted to know about Macros but were afraid to ask
by ThatsAlok
Simple tip and trick for Mail Slot
by Huzifa Terkawi
Prevent default copy constructor and assignment operator side effect
by ratah_
The purpose of this tip is to discuss a solution for managing a raster data format using modern C++ features.
by Kai Schtrom
Win32_NetworkAdapterConfiguration WMI class in plain C and C++
by Ștefan-Mihai MOGA
How to get the MAPI server nane
by bishopnator29a
Simple method how to make application's window maximized on different monitors in multi-monitor setup.
by Mostafa Hashemi _
Mean absolute error calculation in C++
by Rick York
A Handy Memory Allocation Tracking Macro and Header for Visual Studio C++ Code
by Orjan Westin
Function and supporting class to write a memory dump with hex values and characters to an output stream
by lagos_fernando
A C++ template to encrypt strings at compile time with template metaprogramming.
by rev78
Simply bypass the 255 columns in MFC CRecordset
by Aydin Homay
Minor changes on CGridCtrl 2.27 for compatibility with old version of this control
by Shao Voon Wong
MFC KillFocus Derived CEdit to solve the Q&A question which has been reposted
by Christian Kleinheinz
Retrieving the correct pointer anytime and anywhere in MFC MDI applications
by aljodav
An easy way to encrypt files that are automatically decrypted in the same user account
by aljodav
A simple, short and easy way to display a JSON object in a browser (motivated by a forum question)
by aljodav
Easily reading CodeProject RSS feed for new articles from a MFC Application
by Anton Kaminsky
Min Binary Heap Implementation in C++
by zdf
A solution for conversion of a non-undoable application to an undoable one.
by Mukit, Ataul
How to minimize the possibility of data corruption when exporting a class
by LloydA111
Very useful :) Perhaps a slight improvement would be for it to take the retrieved value (in this case 97) and take it away from 100?
by Minh Danh Nguyen (ToughDev)
On Windows Mobile, The Call Log API provides read-only access to the device call history via its PhoneOpenCallLog and PhoneGetCallLogEntry function. The .NET Compact Framework does not provide methods to access these APIs but OpenNetCF has a nice wrapper via its OpenNETCF.Phone...
by Jacob F. W.
A Practical Introduction to Efficient Modular Exponentiation
by gtalkiyibirseymis
Title: Mors Alfabet ConverterLanguage: C/C++Platform: All PlatformsLevel: BeginnerDescription: Mors Alfabet ConverterIntroductionEasy Mors Alphabet Converter Using the codeThis is the trick char *encode(const char *s){ static char encoding[][5] = ...
by botman1001
Given a Singly Linked List, we have to modify it such that all Even numbers appear before Odd
by MaxMax14
For single or multiple selection CListBox
by Paul Churchfield
Shows how MP3 ID3 tags are added automatically using filename via drag and drop
by Zanga D. Dagnogo
This is a simple multiclient server chat on a Local Area Network.
by Damian Reloaded
List comprehensions in C++
by bkelly13
Multiple Projects in One Solution
by captnmac
Find the multiplicative inverse mod-256 with no division operations
by Hubert Haien
SLQ lazy? Object pointers are annoying? How about you look your object up by assigning it a unique name?
by John J. Scott
A tip that compares the performance of a simple Mandelbrot generator in C# against native C++
by GenialX
NCGREP, which is based on ncurses library to provide user interface, is a grep tool for searching text on target directory.
by Rassul Yunussov
Introduction...
by Shao Voon Wong
Use an enum instead
by Shao Voon Wong
Optimization of finding a point with shortest distance w.r.t. a point of interest
by Shao Voon Wong
It could be a hacking to crash your program.
by Kenny MacLean
Using SmartMap to create objects that will clean up after themselves
by Eric Z (Jing)
There is an efficient way provided by std::map to solve a common programming pattern ("query-and-insert-if-nonexistent")
by Indivara
Illustrates a method of ejecting and closing the CD or DVD drive tray programmatically
by Indivara
Illustrates a method of ejecting and closing the CD or DVD drive tray programmatically
by ReturnVoid
Working example: OpenGL CDialog Multiple Context
by MaximilianW
OpenGL rendering to WPF window
by Jani Mäkinen
This fully copy pasteable program shows the version of OpenGL your Windows OS supports.
by Caner Korkmaz
How to open the Internet browser from code.
by kbo-mvs
I use this one in C++ (has the advantage that you can use your preferred browser ;-):ShellExecute (NULL, NULL, _T("http://www.codeproject.com"), NULL, NULL, SW_SHOWNORMAL);
by Kevin Marois
You're incorrect. Explorer is Windows Explorer, not Internet Explorer. Try this:System.Diagnostics.Process.Start("explorer");then this:System.Diagnostics.Process.Start("iexplore.exe", "http://www.codeproject.com");and this:System.Diagnostics.Process.Start("winword.exe",...
by Michael B. Hansen
If I remember correctly, then I had some issues with the above method some years ago. It would not always work on some systems.I personally use the following method to get the EXE path to the system's default browser:public static string GetDefaultBrowser(){ string browser =...
by thatraja
Given below is code for opening the Internet browser programmatically in VB 6 and VB.NET.VB 6Private Declare Function ShellExecute Lib "shell32.dll" Alias _ "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, _ ByVal lpFile As String, ByVal lpParameters As...
by KarstenK
Using the Wincrypto in the Windows SDK
by Philippe Mori
The original solution has many flaws. Arguments and return types are not what they should be in most cases (by value vs. by reference and also for the constness). No code reuse and also some operators are not doing what would be intuitive like the unary minus.Information here is much more...
by Lakamraju Raghuram
Optimizing object size by clustering
by marcus obrien
This article compares the OO features of inheritance and function overriding in C++, C# and Java.
by Martin Vorbrodt
Parsing Command Line Options
by Kiril Shulga
Parsing XML tree containing heterogeneous data using libxml2 Reader API
by Mukit, Ataul
This tip shows how to pass a delegate to a C++ exported DLL function from C#
by Mukit, Ataul
This tip shows you how to pass a const char* or const wchar_t* as a template argument
by Doc Lobster
Consider a class template of the form (the method cout is just explanatory):template struct A { static void cout() { std::cout << str << std::endl; };};How can this template be instantiated?From the C++ standard can be understood that the address...
by Philippe Mori
Since you must pass the string at each instanciation points, it is useless to make a template argument for it.templatestruct CVHDialogTmpl{ CVHDialogTmpl(const char *ptr_) : ptr(ptr_) { } INT_PTR DoModal() { return t.DoModal(ptr); } Ty t; ...
by Philippe Mori
Provided that the intent is to associate a string (const char *) with a particular dialog type, an implementation like this one could be used.templatestruct CVHDialogTmpl{ CVHDialogTmpl() { } INT_PTR DoModal() { return t.DoModal(ptr); } ...
by Fernando Cortes Flores
An Apache Cordova app that can download a PDF from an URL, store the PDF in the device and show the PDF to the user
by Jochen Arndt
Information about COleDataSource not contained in the Microsoft documentation or hardly to be found
by Martin Vorbrodt
Plugins: loading code at runtime
by fernando amatulli
Polynomial interpolation algorithm from 1 to 9 degree that allow forcing constant term to 0
by Aleksey Vitebskiy
Simple and free Cppcheck integration into Visual Studio.
by textorijum
How to SIMPLY populate TreeView from some sort of "list" variable / object / structure
by Debdatta Basu
Emulating iterative structures with the C++ pre-processor.
by Mukit, Ataul
This tip shows how to prevent Subversion (a version/source control tool) from doing automatic merges
by Herre Kuijpers
How to prevent nested code blocks
by liwei.contact
A sample project shows How to print XML documents by a WebBrowser control , with orientation setted programingly.
by Martin Vorbrodt
How to print stack traces
by Antonio Miras
Programatically set a static IP, subnet mask and gateway to an ethernet network adapter on your local machine
by K.badari
Programmatically Convert PDF-To-XPS Document
by Mukit, Ataul
Shows how to enable invoking of the OnUpdateCmdUI(...) in a dialog or property sheet when a menu bar item is pulled down to show popup menu
by Member 4206974
A function for works on event
by schollii
Classes that provide simple Pythonic enumeration of STL container items using range-for loop in C++11
by Elangovan Deivasigamani
QML property binding with QT C++
by trident99
QtCalcStar is an adaptation of the GtCalc engine with a QT Spreadsheet interface. It is based on the QT Spreadsheet supplied from their website.
by Steffen Ploetz
High-end quality in text rendering concerns not only the characters, but also the character spaces - and here FreeType is not quite up to date anymore: The kerning used by FreeType is not always available (especially with newer fonts).
by Mahdi Nejadsahebi
How to query a database file from an MFC application.
by cassert24
For those who are searching for a quick template code for the C++ replacement of C# properties, this is it.
by Michael Safyan
If you've done a regular search for API reference documentation, most likely you've come across links to very old versions of the API (e.g. links to Java 1.4.2 instead of Java 5 or Java 6), or you've probably come across plenty of links that are completely unrelated to the actual search (getting...
by Sebastian Krysmanski
How to check whether two template instances of a C++ class have the same template parameters without using dynamic_cast
by Stefan_Lang
If you're using templates already, and are willing to adapt your class definitions, then this should work:template class BaseClass {public: virtual bool equals(T* other) = 0;};template class ChildClass : public BaseClass > {public: typedef...
by Paul Michalik
This post helps to quickly check whether C++ template instances have the same parameters.
by Doc Lobster
How to quickly check whether C++ Template Instances have the same parameters
by geoyar
How to quickly check whether C++ Template instances have the same parameters
by imagiro
How to use the shell to unzip a file to a folder location
by Martin Vorbrodt
RAII
by CPallini
The question: "How can I extract 5 random cards from a deck?" (or similar), appears every now and then at the C/C++ forum.I use the following method:const int CARDS = 52;int card[CARDS]; // the 'card' array represents all of the cardsint i, deck_cards;// initializationfor (i=0;...
by Martin Vorbrodt
Random number generator
by Member 11246861
Raspberry master, Pic24 slave over SPI
by Member 11246861
Wifi communication between RaspberryPi2 and Laptop ASUS: fonts English, Russian.
by Orjan Westin
Reading an input of any type, or simply enter, from the command line
by Malcolm Arthur McLean
How to read and write binary data portably, including IEEE 754 floating point numbers.
by phillipvoyle
This article describes a C++ header only library for reflecting C++ objects and parsing and formatting JSON.
by Philipp Sch
How to read compressed LZMA files on-the-fly using a custom C++ std::streambuf
by Mitendra Anand
How to read a value from a key in the Windows Registry.
by Shao Voon Wong
Ternary Operator vs Lookup Table Benchmark
by harold@talerian.com
C is still the best language for native-code development.
by Marco Bertschi
A quick overview why you should abandon Qt's QRegExp class and move on to use QRegularExpression
by Mukit, Ataul
A useful algorithm to divide a rectangular area into rectangular subregions. Good for tiling windows in a given area
by RodrigoMattosoSilveira
This article deserves recognition for its fun potential. After reading it, I decided to try it out by building a simple HTML/JavaScript application to try it out. I used jQuery and a jQuery plugin, SVG. The work is simple and not very elegant, but I had fun putting it together.The HTML...
by Zebedee Mason
Wrap writing to the test logger with std::streambuf then substitute in std::clog
by User 26942
You could use internal and external include guards in your headers. This reduces compile time dramatically.
by Martin Vorbrodt
How to refactor std::auto_ptr
by Alain Rist
With a helper CharMap class using VC2010 C++0x implementation
by Mahdi Nejadsahebi
This tip describes how we can remove close pixels from color around the edges.
by egladysh
Using the Call Gate idiom to reduce number of boolean flags and state variables.
by tonywilk
Everyone knows GDI+ is generally slow in rendering, what is not so obvious is what combination of settings is the fastest.I have an app which renders a lot of items, which may be drawn or are bitmap-sourced 'sprites', onto a full page (usually 1024x768). The first attempts ran at around 3...
by Durga Prasad Dhulipudi
Rendering polygon shapefiles and filling them
by prasad_som
How to modify a bitmap in memory once it is read as a string.
by David C Shepherd
A peek into the inspiration behind two cutting edge Visual Studio extensions.
by Reiss
How about this one line command for MS-DOS?for /f %a IN ('dir /b *.txt') do attrib %a -RSee: attrib command[^]andhow to write a dos batch file to loop through files[^]
by Krosus
At an MS-DOS prompt, enter:attrib -r *.*
by Jason N. Gaylord
Have you ever noticed an exception being thrown by your application stating something like the following:System.Net.Mail.SmtpException: Service not available, closing transmission channel. The server response was: #4.x.2 Too many messages for this sessionThis has been an issue since early versions o
by PawelBujak
How to avoid blocking long operations in GUI applications, that lead to hung state.
by Norbert Schneider
A short code snippet to fetch the USB Serial Number of a file name residing on a stick.
by Mostafa Hashemi _
Machine Learning & coefficients using MLPack
by peterchen
Reusable safe_bool implementation
by Matt Fichtenbaum
A rich edit control's "find text" operation failed, but the same code worked in another program.
by Martin Vorbrodt
RPC with protocol buffers
by Software_Developer
Description of how to read a number input from the keyboard and then put each of its components in an array
by Asif Bahrainwala
A simple C++ program to generate RSA key pair
by HateCoding
This tip will show you an example for using R-tree.
by flyhigh
By implementing a UI library and exporting its necessary components to lua script, we can create a beautiful UI and implement relevant logic in Lua script completely.
by John M. Dlugosz
Did you realize that the `*this` object can be qualified with lvalue vs rvalue? Here’s what you can do with that.
by shailesh91082
This tip explains how to use Safe APIs which are a replacement for older APIs like strcpy, strcat, etc.
by Mukit, Ataul
This tip shows how to save a 24 bitmap to a file given filename, pixel data, bitmap width and bitmap height
by Ștefan-Mihai MOGA
How to save a message to an MSG Compound file.
by honey the codewitch
Easily blank the screen after a timeout period
by kanbang
Save/Load Image between buffer
by Vedat Ozan Oner
Revised timer for Arduino
by steveb
A simple Sci-Fi plot compiler
by Joshi, Rushikesh
Scope of Return Statement, Reachable Code and Behavior in Finally Block
by Derell Licht
C++ classes that implement scrolling simulated-LED displays
by Tu (Le Hong)
A scroll window that surpasses the 16-bit limit and can be hosted by a dialog.
by Yohamnes Hernandez
How to free blocked files, inclusive if they are mapped in memory. Something that many tools are missing.
by Richard MacCutchan
Obscure a window or the screen and show a dialog.
by Adamanteus
Intercepting SEH exceptions in C++ program
by Roger65
Selected Font name, Point Size and Weight are displayed
by Daniele Rota Nodari
I was glad to integrate your code into my C# application.Actually, within the debugger windows, I can't recognize any human-readable reference to the calling process, but the function is working. :)So, for whoever may be interested, the following code is my C# 4 equivalent:using...
by zidane168
This topic focuses on what is the difference between SendMessage and PostMessage and how to use them?
by computermagic
Generating sequential GUIDs in C++ and Qt 5
by Member 11246861
Under laptop's control, microcontroller sends sensor data to laptop that displays numbers and graphic.
by Gilad Rozban
C++ Serialization implementation
by Martin Vorbrodt
How to serialize data to XML
by Vedat Ozan Oner
Arduino.SerialLcd library
by Member 11246861
Raspberry; laptop ASUS: up to 150 clients.
by WoodyMou
Session 1: Setup SoftEther L2TP server on Amazon AWS Ubuntu
by DigitalInBlue
Guidance on C++/C++!1 Parameter Passing
by Bob Van Tuyl
How to set landscape mode in MFC app
by Lakamraju Raghuram
Memory leak detection in VC++
by DecodedSolutions.co.uk
This is a simple article describing how to create an add an outlook appointment to your MS Outlook Calender.
by Eugen Podsypalnikov
http://rapidsh...
by mzdude
shared_ptr and the class factory
by Amer Saffo
This tip presents a .NET like Event implemented in C++, with which developers can fire events in C++ the same way they do in C#.
by Martin Vorbrodt
Short introduction to parameter packs and fold expressions
by Kamran Bilgrami
How to show threads in the source - Windbg way
by Ghosuwa Wogomon
Detecting character encoding in just 4 lines of code
by Farhad Reza
A simple ChessBoard graphics using GDI32
by Hasan Gurler
Simple DXF reader and viewer supporting the most common AutoCAD entities
by ravenspoint
This is an alternative for "Simple DXF Reader/Viewer with Spline Support"
by Martin Vorbrodt
Simple file I/O
by Farhad Reza
A simple graphics class for 2D drawing
by Elangovan Deivasigamani
It describes Abstract Factory Pattern which picks up the common hardware interface for different communication protocol.
by Bartlomiej Filipek
Simple introduction to std::future and std::async and why they can be useful.
by Mehdi Maujood
This tip provides an approach to object-oriented programming for developers familiar with class-based OOP in languages such as C++ and Java.
by Evgeny Pereguda
This tip presents a simple class for printing of log information with some features of C++11.
by Manuel Campos
A modeless dialog that allows magnification of a section of a display screen
by ruben rick
This simple code displays a perlin noise like example.
by Andres Cassagnes
A simple serial communication library, with a serial ports enumerator
by Martin Vorbrodt
Simple thread pool
by Martin Vorbrodt
A simple timer
by Gautam Agrawal (Programming Expert)
Enable user to make a dialog transparent without making its child control transparent
by l_sheba
:laugh: :laugh: :laugh: This trick will show you how shellcode works (in a simple way). First, create a Win32 application, and delete all generated code in your main.cpp and leave the _tWinMain block empty and return 0. And then, put MessageBox function, make all parameters zero. The code...
by Mukit, Ataul
This tip shows how to simulate a key stroke in windows environment
by Jose David Pujo
With SendInput:void SetNumLock (bool active){ BYTE keyState[256]; GetKeyboardState((LPBYTE)&keyState); bool active0= keyState[VK_NUMLOCK] & 1; if (active0!=active) { INPUT inp[2]; ZeroMemory(inp, sizeof(inp)); inp[0].type=INPUT_KEYBOARD; ...
by Shahadat Hossain Mazumder
Single precision floating point and double precesion floating values operations in SSE optimization
by David Wincelberg
A simple way to display "item" or "items" instead of "item(s)"
by Hatim Haidry
SIP Stack Implementation on the basis of RFC SIP 3261 Specification
by cassert24
Template code for basic reflection functionalities (e.g., dynamic casting, instance type comparison, class name) with C#-like singular inheritance rule (a.k.a, one-base-multiple-interface rule)
by Jake Franta
The database classes in the SolidWidgets library are powerful, flexible, and very easy to use.
by Jake Franta
A short tutorial to quickly show how the Visual Editor component is used.
by Jake Franta
SolidWidgets Grid tutorial.
by Jake Franta
This article introduces the SolidWidgets Report Designer, which is part of the SolidWidgets UI framework library.
by David A. Gray
This tip describes how I resolved a C4183 compiler error emitted by the Visual C++ 2013 compiler.
by Shao Voon Wong
Solving Fizz Buzz in C# and C++ using six different approaches
by sunhui
In this paper, we will discuss some advanced skills for ATL COM development.
by Cale Dunlap
C/C++ pre-processor macros which I have found to be quite useful, so I decided to share them. I hope they help you as much as they've helped me.
by Martin Vorbrodt
Sorting and locality
by David A. Gray
Sparsely documented cause of compiler error C2143
by osy
You can't partially specialize function templates - or maybe you can?
by Mircea Neacsu
How to spell even large numbers in English
by honey the codewitch
This is a very specialized tool that generates source code to upload files into SPIFFS on an ESP32
by spore123
This is a fast multi-threaded quick-sort based algorithm
by Gareth Jensen
Tips on how to declare a class template in a header file and define a class template in a source file.
by Martin Vorbrodt
SQL database access
by jsolutions_uk
How to have a single declaration of a static member for derived classes, using a simple template
by Mukit, Ataul
sometimes console applications give runtime error when you declare static varialbes, so here is a solution how to deal with it
by Jerry.Wang
Instructions about linking EasyHook library statically
by ThatsAlok
This tip will demonstrate std::function in various avatars, with function pointers and std::bind.
by kennethman
Hide data inside the zip structure of any zip-based file.
by Basil_2
How to choose an STL sorting algorithm.
by Steffen Ploetz
Why replacing std::vector with std::set sped up my UndoRedoAction class by about 20x
by Schrödter
How to write data to SQLSERVER varbinary(MAX) columns in C++ using ADO
by khazaad
An overview of lack of strong typing in higher order functions in modern C++ and possible solution to this problem
by Aurelian Georgescu
Strongly Typeded Identifiers in Qt
by Mahdi Nejadsahebi
This tip describes how 3D images are converted to 2D images.
by sam stokes
How to implement live tile notification in just a few lines of code
by sam stokes
This sample demonstrates how to use the Tile Template, specifically the TileSquareImage and an image.
by sam stokes
How to perform arithmetic operations on XAML Text
by TheyCallMeMrJames
If you have two blocks of code that you are testing and need to switch back-and-forth between them, here's a commenting trick that works as a powerful code block toggling mechanism.Say you have a variable called foo of type string and want to change between using initialized values and...
by Caner Korkmaz
For debug use, you can do something like this:#ifdef DEBUG #define dprintf(...) printf(__VA_ARGS__)#else #define dprintf(...)#endif//Usage:dprintf("In debug mode.");//orchar *foo = "foo";dprintf("%d bar.",foo);// :)/*Edit reason :: *if you type...
by ILa @ work
This nice trick extends into://*/block 1/*/block 2; // commented out/*/block 3;/*/block 4; // commented out//*/and removing the first slash gives inverted alternation:/*/block 1; // commented out/*/block 2;/*/block 3; // commented out/*/block...
by josh.rendon
That conclusion is definitely wrong. Your equation expanded equals: b = (a+b) - (a-b) = a+b - a + b = 2*bFor your example a=20, b=10b = (20+10) - (20-10) = (30) - (10) = 20b = 20 + 10 - 20 + 10 = 20A counter example to disprove this: a=75, b=88b = (75+88) - (75-88) =...
by GregEllis
You can do it with some XORs:int a = 25, b = 7;a = a ^ b;b = b ^ a;a = a ^ b;Or the same thing with some shorthand to make the code even harder to read:a ^= b;b ^= a;a ^= b;
by chevu
I don't know whether these type of tips are allowed or not. But after having experience of core algorithm-base technical interview I thought I should share question I was asked in my interview.They asked me to show all methods I know to swap values of two variables.I Tried my level best...
by WebBiscuit
There is also InterlockedExchange (or your operating system's equivalent).long a = 1;long b = 2;b = InterlockedExchange(&a, b);
by Francis Xavier Pulikotil
A switch-like construct for custom objects to improve readability.
by dan146
swprintf_s() and sprintf_s() are additions to VC++8, and were supposedly written to tolerate formatting errors and to avoid buffer overruns. They differ from their corresponding non-safe cousins swprintf() and sprintf() by taking an extra argument (the 2nd parameter), which is the size of the...
by Eugen Podsypalnikov
Hello :)Your own description of the second parameteris different to the "original"...http://msdn.microsoft.com/en-us/library/ce3zzk1k(VS.80).aspx[^]
by qqmrichter
Overuse of #define can be ludicrous.
by Ritesh_Singh
Asynchronous communication through messaging using Websphere MQ Synch Point Commit, Back out and correlation id
by Shweta Lodha
I’ll show you the traditional way of converting Synchronous example to Asynchronous one and then how the same can be accomplished using Fx 4.5.
by Martin Vorbrodt
Template concepts, sort of
by trotwa
How to avoid memory leak in WinXP, if you kill a thread
by john_meade
The right thing to do in this case is attach a debugger to determine the underlying cause of the the deadlock. This solution ignores the fact that the thread being terminated might have an exclusive lock on other critical resources (e.g., the OS loader lock or any application defined...
by Asif Bahrainwala
Atomic set and test in critical sections
by cth027
Check how your application behaves when there's not much memory
by Martin Vorbrodt
Don’t invent your own!
by Malcolm Arthur McLean
A completely portable, tiny, Unix style shell in pure ANSI C.
by sujit agarwal
read this article if you really are a code snippet freak...
by Bruno van Dooren
What to do when you want to use the current thread handle
by Michael Chourdakis
A ready to use equalizer for your projects
by cocaf
The generic network endpoint (IP address and port) class that can be compared with and cast to/from the protocol aware boost::asio::ip::udp::endpoint and boost::asio::ip::tcp::endpoint objects.
by Ajay Vijayvargiya
The goto-less goto!
by Sauro Viti
Use C++ exceptions:try{ if (condition1_fails) throw 1; ... if (condition2_fails) throw 2; ... ... if (conditionN_fails) throw N; PerformActionOnAllSuccess(); DoNormalCleanup();}catch (int condition){ printf("The condition %d fails!\n",...
by Robert S Sharp
I'm a C# programmer. I try to avoid goto at all costs, and generally I try to avoid throwing exceptions for the purpose of controlling the flow of execution. I've always been of the opinion that exceptions are for exceptional situations and indicate errors rather than expected conditions.I...
by Philippe Mori
If the number of conditions is relatively small, the following code would made sense: bool bFailed = true; if (!condition1_fails) { if(!condition2_fails) { ... if(!conditionN_fails) { bFailed=false; ...
by Philippe Mori
Alternative 2 can be enhanced by returning a booleen value if we want to code something similar to the original example. A (early) return value of false would indicate a failure which could then be handle by checking the function result.if (!DoAllActions()){ ...
by guilherme heringer
In C#, you can always use try..finally to add some finalization code.Just write:bool bFailed = true; try{ if(condition1_fails) return; ... if(condition2_fails) return; ... ... if(conditionN_fails) ...
by jsc42
It is much easier (and cleaner) to test for success than to test for failure.Viz:if ( condition1 // Note: Test for success, not for fail && condition2 // Will be short-circuited if condition1 fails && condition3 // Will be short-circuited if condition1 or condition 2...
by rxantos
For Cbool bFailed = true;// foreverfor(;;) { // do something here. if(condition1) { // exit the loop (goto) break; } // do something here. // .... // In case you want to goto to the top instead of exit. if(condition2) { // jump to top of the...
by abridges
Alternate 8, why not just do this:bool bFailed = true;// In case of an exception.try{ // while bFailed while (bFailed) { // do something here. if (condition1) { // exit the loop (goto) bFalse = false; ...
by sergiogarcianinja
As this piece of code is normally a function, should be more readable if all of it is put inside a function returning a bool, indicating success or failure.The cleanup function could be only resource deallocation, not a function at all. If it is intended to use with C++ or C#, a try..finally...
by Jörgen Sigvardsson
Usually, gotos are used to clean up resources when exiting a function. I would recommend using the RAII[^] idiom. It also works works well in the presence of exceptions.For C# I would use IDisposable/using. If that's not possible, I'd use a finally clause to clean up.Everything else...
by Wolfgang_Baron
If you really have to put everything into a single function and want to keep the code analyzable and maybe want to be able put some common code at the end, you can always use a success variable. The code does not slow down, as the compiler optimizes the sequenced if-conditions away and produces...
by Member 4694807
My favorite is a variant of alternative 2.{ ... DoInit(); status=DoAllActions(); DoCleanup(status); ...}int DoAllActions(){ if (condition1_fails) return status1; ... if (condition2_fails) return status2; ... if(conditionN_fails) ...
by Jose David Pujo
Here goes my alternate.I am a C++ programmer. My goal is always to try to make code short and simple.bool bFailed=false;if (!bFailed) bFailed= condition1_fails;if (!bFailed) bFailed= condition2_fails;if (!bFailed) bFailed= condition3_fails;if (bFailed) DoFailedCleanup();else {...
by testy_proconsul
bool bFailed = false; bFailed |= bFailed ? true : condition1; bFailed |= bFailed ? true : condition2; bFailed |= bFailed ? true : condition3; if( !bFailed ) { PerformActionOnAllSuccess(); ...
by CashCow2
The correct way to do this in C++ is to invoke some form of RAII whereby the failure logic happens automatically in an object's destructor.class CleanupObject{public: CleanupObject() : successState( false ) { } void completedOk() { successState = false;...
by Lakamraju Raghuram
A glance around vector of bool-type
by pasztorpisti
A custom implementation of the FindResource() and LoadString() functions with better error indication. Pointing the direction for those who want to learn the binary PE resource format.
by Saad Mousliki
In this tip, I will describe how to implement a cursor controller in your project that use the Kinect to control the mouse of your PC.
by John M. Dlugosz
Short list of things to watch out for when using C++
by lxdfigo
A Photoshop-Like Color Palette Dialog in MFC
by gxm_ddsr
Use XML to configure a database server
by Southmountain
This post sheds some light on all WGL functions(wiggle functions) in OpenGL extension for Microsoft Windows system
by SkyProgger
This article describes the StorageManager class I have developed. It's created to save data beyond the Programs lifespan, as easy as possible.
by cocaf
The virtual inheritance helps to solve certain class design problems even if they are unrelated to the "deadly diamond of death".
by Martin Vorbrodt
In search of a portable library, this time not for serialization, but for a portable RPC mechanism
by Eugen Podsypalnikov
http://rapidsh...
by Ahmed-Fayed
Using Artifecial Intelligance in the tic tac toe game to make computer never lose. Moreover two humans can play with each other.
by BD Star
This is a mini project (Tic-Tac-Toe game) for Turbo C / C++ compiler.
by Lothar Perr
Simple and lightweight XML Serialization using tinyxml2
by Andreas Gieriet
Short tip to show a convenient use of the lesser known xor operator
by Eyal Rosner
If you are looking for memory leaks related to BSTR pointers, this tip might be very relevant for you.
by BrainlessLabs.com
This tip describes a n ary tree structure.
by BrainlessLabs.com
This tip describes a n ary tree structure. We will see how traversal works.
by Member 13376231
An overview of a tricky binary collision example when there are multiple definitions of symbols in linked binaries
by Geoffrey Mellar
Template class for calling trigger functions by a key
by Mirzakhmet Syzdykov
Traveling Salesman Problem using Ant Colony Optimization
by Shao Voon Wong
Two C++ features win over C equivalents in performance
by Orjan Westin
Getting negative numbers from 10-bit (and other unusual size) integers
by ajrarn
This enum class makes it hard to use it wrongly. Enumeration from one type can’t be mixed with any other data type.
by Roger65
How to type text into a static control, change the font used and then save it into a bitmap
by Jacob F. W.
Adding and subtracting a 128 Bit Unsigned Integer
by Jacob F. W.
Bit Operations on a 128 Bit Unsigned Integer
by Jacob F. W.
Dividing and Modulo with a 128 Bit Unsigned Integer
by Jacob F. W.
Multiplying and Squaring a 128 Bit Unsigned Integer
by Member 15078716
Unicode / Creating, Writing, Appending / a text (*.txt) file - how to do it
by Kosta Cherry
Unique identifier for the class
by mzdude
Making unique_ptr more user friendly.
by Subhendu Sekhar Behera
Algorithm to find out all the Matchings and Uniquely Restricted Matchings in a Graph
by John M. Dlugosz
How can an automated test program test that something is rejected at compile time?
by xdoukas
A tip on the implementation of Unix ucontext_t operations on Microsoft Windows.
by Lakamraju Raghuram
Usage of '_HAS_CPP0X' macro in Visual C++ compiler
by Stefan_Lang
Consider the following scenario:Your team provides libraries for use in other, unspecified applications. When designing your API, you have to consider the fact that not every customer will have access to the newest compiler.Let's say you develop a Vector class that looks like...
by BlueMaple_chief
How to perform easy http request
by 8MX
Quick and easy way to use the Intel C++ compiler with C++/CLI.
by Verma.No.1
Use Intel Perceptual Computing SDK with VS2012.
by honey the codewitch
Presenting a simple to create understandable and maintainable builds for projects with dependencies
by dotcpp
Wrapping WideCharToMultiByte and MultiByteToWideChar
by aref.bozorgmehr
How to use a Persian datetime picker and calendar in your applications.
by bkelly13
Include code from other directories
by Romain Gailleton
A presentation on how to extract data from a Type Library (.tlb) and access COM Binary Interface from C++ using Qt
by imagiro
A small class for using COM DLL modules without registering them
by EricF
Download sourceThe ProblemI always found unpleasant to change dynamically the layout of a form or a dialog. In these cases, we had to call SetWindowPos or MoveWindow on each control of the form. We had to calculate manually the position of each controls on the form too.The...
by Martin Ton
Using JNI to read Window-My in Java.
by D4rkTrick
Get manifest support with VC6
by Vedat Ozan Oner
A library for PIR motion sensor
by Gregory Morse
WebView navigateToLocalStreamUri can be used from WinJS/JavaScript with some more advanced coding techniques to wrap a necessary interface
by srana1
Using Visual Studio 2008 IDE with Visual C++ 2010 compiler
by Mukit, Ataul
How to use wxWidgets in FireBreath
by Oliver Kohl
This is a small "how to" that shows you how to get wxWidgets running under Windows
by Mircea Neacsu
How to handle UTF-8 in Windows INI files
by leon de boer
Direct Win32 API window controls that support validation (no MFC)
by Sweta Mittal
Validate whether value in string is a valid decimal number or not.
by IgorRadionyuk
Proposal for implementation diapasons of values or it ranges
by Shao Voon Wong
Make a console program not to show the console screen
by Michael Sydney Balloni
Use vectormap when you want the fast lookup of unordered_map, and the order-added iteration of vector
by Jacob F. W.
A Practical Alternative to Assert in C++
by Mukit, Ataul
Shows how to view the current library link order in a VC project
by Petr Kirjat Valasek
This technique allows the Visitor (i.e., an instance of Visitor design pattern) to return value of arbitrary type.
by Emiliarge
How to statically link a Win32 Project with Visual C++ libraries (m***.dll)
by Bartlomiej Filipek
By default, Visual Studio (up to VS 2013) uses additional debug heap that slows down applications, even in Release mode. Read what you can do about this.
by _Flaviu
A small guide to use VTK in MFC
by Prasad Agarmore
Datacontract channelfactory WCF way of consuming SOAP web services written in C, C++ using gSoap framework on Linux platform
by Fabio Durigon
A class to handle WDM (Windows Driver Mode).
by Ayush Swiss
C++, WebView2, Edge Browser, Edge in MFC application
by jasper.mandos
/// /// Stuct for the ISO 8601 week date/// /// /// See:/// See:/// Algorithm:<see...
by Richard MacCutchan
Week numbers according to ISO8601
by Luc Pattyn
This is an alternative to "Week Numbers According to ISO8601".
by Martin Vorbrodt
A look at what the C++ compiler generates for us when we use the keywords new, new[], delete, and delete[]
by David Crow
An alternative to iterating a folder's contents to get the size is to use the scripting object, FileSystemObject.Using ClassWizard (Ctrl+W), the first thing you'll need to do is add the classes contained in the Script Runtime engine (scrrun.dll). This will add scrrun.cpp and scrrun.h to...
by Leonid Belousov
This tip shows how to find the default browser command line in registry using Visual C++.
by Tarie Nosworthy
C and C++ are still very useful indeed.
by REALTBU
Easy to use class which supports displaying icons on button controls
by Steffen Ploetz
The Win32++ class library sample collection does not contain a sample, that creates the frame menu via API instead of via resources. Here is the missing part.
by Eugen Podsypalnikov
A workaround to convert UTC to the LocalTime, in summer but without DST flag
by Tim Stevens
An updated version of the code in David A Jones' article "Memory Leak Detection"
by Mahdi Nejadsahebi
This program protects and locks every window in Windows, and encrypts any files even in large volume without any problem.
by Manish K. Agarwal
Windows symbols and crash dump analysis.
by 23ars
A tool that I wrote some time ago called WinHexView which I used it for displaying file's content in different format like hexadecimal, decimal or octal
by zoufeiyy
A program to operate WMI Namespace Security with Windows Native APIs which are supported on Windows 2000/XP/2003/2008/7.
by Andrey Grodzovsky
Stack corruptions are usually tricky to solve, they can be random or consistent in nature, random are usually due to some rogue pointer writing to a random location wrecking havoc along the process address space and the consistent are due to overrunning allocated write buffer with more bytes that it
by _Flaviu
Improved Excel class
by Michael Bergman
Wrapper: A Bridge for Class Properties
by John Stewien
Wrapping a C++ callback in a .NET Action so you can use the .NET Task Parallel Library
by Yochai Timmer
A way to avoid JNI's reflection oriented programming. Wrapping Java with C++
by Gregory Morse
WRL Collection library ported to native C++
by Alex Puchades
In this tip, XEndian, a header-only library will be presented
by trident99
An STL based simple XML serialization and de-serialization engine
by Martin Vorbrodt
XML-RPC
by Steffen Ploetz
Another fully functional ownerdraw menu with minimal effort - this time based on Win32, with icons instead of bitmaps, with accelerators and tested for ReactOS and WinNT 4.0 to Windows 10
by Akos Mattiassich
Find a window on the desktop, spy its properties and manipulate it.
by himanshupareek
A class for listing files (including ADS) with callback