Click here to Skip to main content
15,867,923 members
Everything / Programming Languages / C++

C++

C++

Great Reads

by Dr. WPF
.NET 3.5 SP1 is here! It's time to break out your DirectX skills. This article provides the information necessary to get started using a new DirectX interop feature in WPF called D3DImage.
by Hatem Mostafa
Artificial Neural Network C++ class with two use cases: Counter and Handwritten Digits recognition
by Jeffrey Walton
Import and export Cryptographic Keys in PKCS#8 and X.509 formats, using Crypto++, C#, and Java.
by Hans Dietrich
XColorSpectrumCtrl displays a color spectrum that allows user selection, and provides APIs for color based on RGB and HSL color models.

Latest Articles

by Yochai Timmer
A way to avoid JNI's reflection oriented programming. Wrapping Java with C++
by Mircea Neacsu
Examines the performance of SQLite in multi-threading applications
by honey the codewitch
Do you need to be able to perform a firmware update without using WiFi? This project is for you.
by Uwe_Sieber
Shows how to use IOCTL_USB_HUB_CYCLE_PORT to restart a USB port under Windows

All Articles

Sort by Updated

C++ 

17 Nov 2014 by #realJSOP
How to fix this ANNOYING problem
4 Jan 2017 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
23 Mar 2013 by 8MX
Quick and easy way to use the Intel C++ compiler with C++/CLI.
9 Apr 2013 by _Flaviu
Improved Excel class
10 Jul 2014 by _Flaviu
A small guide to use VTK in MFC
23 Mar 2016 by _Flaviu
A way to know when a floating CDialogBar is closed
8 Oct 2017 by _Flaviu
A memory CTreeCtrl like object, but resident in memory only
9 Sep 2021 by _Flaviu
A simple way to convert an office document to PDF
13 Apr 2018 by _Flaviu
A method of how to get rid of "close" menu from multiple CDockablePane panels
4 May 2012 by _Flaviu
A class designed to connect to a database through ODBC and perform basic operations such as inserts, updates, and deletes
28 Feb 2014 by _Ravikant Tiwari_
This program will demonstrate the process of injecting code into already running processes. Here we have choosen to inject into Explorer
7 Mar 2014 by _Ravikant Tiwari_
Code Injection - A Generic Approach for 32bit and 64bit Versions
20 Sep 2010 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
1 Feb 2013 by aaverian
A very simple console progress bar.
27 Nov 2014 by Abdallah Al-Dalleh
How to handle post data coming inside an HTTP POST request
5 Jun 2012 by Abed AlSayed
AlSayed ColorBar is a TrackBar best for professional color picker, like the one used in Adobe Photoshop.
1 Feb 2011 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; ...
17 Sep 2012 by Adam Wojnar
A complete log viewer written in C++/WTL.
6 Feb 2014 by Adamanteus
Intercepting SEH exceptions in C++ program
10 Jun 2010 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...
15 Jun 2010 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...
1 Aug 2010 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...
19 Sep 2010 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...
20 Sep 2010 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
27 Sep 2010 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() {...
21 Oct 2010 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...
6 Mar 2013 by Ahmed Elkafrawy
An easy way to simulate keyboard press & release keys to another application
28 Apr 2017 by Ahmed Elkafrawy
Implementation of an easy, fast, and optimized (CByte, CShort, CInt) with bits access using bit field and union
13 Aug 2013 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.
24 Jan 2011 by Ajay Vijayvargiya
The goto-less goto!
1 May 2010 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
13 Oct 2010 by Ajay Vijayvargiya
Wouldn't be easier if you just pass a simple function to your favourite thread creation function? Read on!
20 Oct 2010 by Ajay Vijayvargiya
Need to Format/sprintf a string before displaying a messagebox? Here is solution!
19 Mar 2013 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.
28 Dec 2014 by Akos Mattiassich
Find a window on the desktop, spy its properties and manipulate it.
28 Feb 2010 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...
12 Jun 2010 by Alain Rist
A set of C++ functions to load the resource into an existing string or build the string from it
16 Nov 2010 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)
29 Nov 2010 by Alain Rist
With a helper CharMap class using VC2010 C++0x implementation
11 Apr 2011 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
9 Oct 2012 by Aleksey Vitebskiy
Simple and free Cppcheck integration into Visual Studio.
28 Mar 2014 by Alex Culea
Shows how to create a window that behaves like a context menu
12 Sep 2014 by Alex Puchades
In this tip, XEndian, a header-only library will be presented
26 May 2014 by Alexander Golde
Analyzing Syslog files can be easy...
30 Sep 2017 by Alexander Lednev
How to check if a string is literal in compile-time (C++)
2 Oct 2017 by Alexander Lednev
This method uses "constexpr"
28 Aug 2017 by Alexey Shtykov
A few words about function templates
19 Aug 2019 by Alexey Shtykov
How to become a fancy guy who uses C++ time library instead of old and famous time.h
8 Dec 2022 by Alexey Shtykov
Activate a particular document window in MDI application via MFC/C++
15 Jun 2012 by AlexZakharenko
A more efficient way to create objects for usage with shared_ptr
26 Feb 2015 by aljodav
Easily reading CodeProject RSS feed for new articles from a MFC Application
27 Feb 2015 by aljodav
An easy way to encrypt files that are automatically decrypted in the same user account
28 Feb 2015 by aljodav
A simple, short and easy way to display a JSON object in a browser (motivated by a forum question)
24 Oct 2013 by altomaltes
Effortless configuration file added to your existing code
5 Jun 2019 by altomaltes
This code calculates square root of an integer on a few assembler code lines.
10 Jan 2016 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#.
13 Jul 2012 by Amir Hesami
An example of interprocess communication using named pipes.
19 May 2013 by Amit Deshmukh 1010
Accessing class object present in exe from explicitly loaded DLL using Inheritance and virtual function.
8 Sep 2014 by amsainju
This tip shows you how to compile crypto++ for 64-bit environment.
12 Feb 2012 by Andreas Gieriet
HTML page with all syntax/grammar productions of C++98/C++11
12 Jan 2013 by Andreas Gieriet
Short tip to show a convenient use of the lesser known xor operator
29 Aug 2014 by Andres Cassagnes
A simple serial communication library, with a serial ports enumerator
10 Feb 2011 by Andrew Rissing
Always review all changes before submitting them. Especially, if using a global find and replace.
15 Jan 2014 by Andrey Grodzovsky
External functions call tracer for executable linked shared libraries
26 Aug 2014 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
8 Sep 2014 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
25 Feb 2011 by Ansas Bogdan
This shows you how to cast a Pointer to a Memberfunction to any Pointer Type you whish.
10 Jun 2010 by Anshul R
You can simply use the sleep() function in dos.h in a loop and print it!
8 Nov 2010 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...
16 Sep 2014 by Anton Kaminsky
Min Binary Heap Implementation in C++
2 Mar 2016 by Antonio Miras
Programatically set a static IP, subnet mask and gateway to an ethernet network adapter on your local machine
22 Jun 2015 by Apprieu (Apprieu)
13 May 2020 by Apprieu (Apprieu)
How to generate a serial key with Crypto API MFC
5 Oct 2018 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.
15 Mar 2016 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.
19 Jun 2013 by aref.bozorgmehr
How to use a Persian datetime picker and calendar in your applications.
6 Mar 2014 by Arkadiusz@inquiry
CRichEditCtrl does not take the return
29 Dec 2010 by Arman S.
Shows how one can use IStream for in-memory operations
5 Jan 2011 by Arman S.
Shows how to convert between different image formats by using GDI+
15 Oct 2014 by Arthur Caputo
Tutorial on setting a false transparency onto your button's edges.
1 May 2017 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
17 Jan 2017 by Arun Maiya
How to setup GCC cross compiler in Windows to generate Linux binaries
4 Apr 2015 by arussell
Unlock a file that is in use by another process
4 Aug 2013 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
14 Jan 2015 by Asif Bahrainwala
FFT using DX11 compute shader
14 Jan 2014 by Asif Bahrainwala
Atomic set and test in critical sections
19 Feb 2022 by Asif Bahrainwala
A simple C++ program to generate RSA key pair
20 Feb 2019 by Aurelian Georgescu
Strongly Typeded Identifiers in Qt
15 Jan 2010 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...
27 Mar 2013 by Aydin Homay
Minor changes on CGridCtrl 2.27 for compatibility with old version of this control
15 Jun 2022 by Ayush Swiss
C++, WebView2, Edge Browser, Edge in MFC application
14 Oct 2014 by Bartlomiej Filipek
Simple introduction to std::future and std::async and why they can be useful.
23 Sep 2015 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?
23 Sep 2015 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.
22 Oct 2011 by Basil_2
A few uncommon code sample
16 Dec 2012 by Basil_2
How to choose an STL sorting algorithm.
11 Jun 2015 by BD Star
This is a mini project (Tic-Tac-Toe game) for Turbo C / C++ compiler.
7 Feb 2023 by Ben McNamara
I++ presents one option for the direction of Win32.
22 Apr 2023 by Ben McNamara
Container classes much faster than STL.
25 May 2010 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...