Skip to content

Instantly share code, notes, and snippets.

@caiorss
caiorss / CMakeLists.txt
Created December 27, 2018 03:05
Minimal CMake project with OpenGL
cmake_minimum_required(VERSION 3.9)
# Proeject name - should not contain whitespace
project(OpengGL_CPP)
#========== Global Configurations =============#
#----------------------------------------------#
# Set the C++ standard for all targets (It sets the flags
# (-std=c++11, -std=c++14 ...) on Clang or GCC. and /std=c++17 on MSVC
@caiorss
caiorss / .gitignore
Last active March 30, 2021 21:24
Sample Windows DLL - shared library testlib.dll and client program (client code). - https://caiorss.github.io/C-Cpp-Notes/DLL-Binary-Components-SharedLibraries.html
*.dll
*.exe
*.obj
*.so
*.bin
*.zip
*.7z
*.exp
*.lib
.vs/*
@caiorss
caiorss / winprocess.cpp
Last active December 14, 2018 18:09
Class encapsulatiung MS-Windows process API functions in modern C++ - https://caiorss.github.io/C-Cpp-Notes/WindowsAPI-cpp.html
// File: winprocess.cpp
// Brief: Class encapsulatiung MS-Windows process API functions.
// APIS: CreateProcess, WaitForSingObject, GetProcessExitCode ...
// Author: Caio Rodrigues
//--------------------------------------------------------------
#include <iostream>
#include <string>
#include <vector>
#include <cstdio>
@caiorss
caiorss / cpp17-structured-bindings.cpp
Last active December 13, 2018 19:28
C++17 Structured bindings experiments
// Brief: C++17 Structured bindings experiments.
// Author: Caio Rodrigues
//--------------------------------------------------
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <map>
#include <tuple>
#include <iomanip>
// File: dynamic-loading2.cpp
// Brief: Dynamically loads a DLL - shared library at runtime using a class.
// Note: Demonstration of WINAPIs LoadLibrary, FreeLibrary, GetProcAddress
// Author: Caio Rodrigues
//---------------------------------------------------------------------------
#include <iostream>
#include <string>
#include <windows.h>
@caiorss
caiorss / dynamic-loading1.cpp
Created December 12, 2018 18:21
Dynamically loads a DLL - shared library at runtime. -- https://caiorss.github.io/C-Cpp-Notes/WindowsAPI-cpp.html
// File: dynamic-loading1.cpp
// Brief: Dynamically loads a DLL - shared library at runtime.
// Note: Demonstration of WINAPIs LoadLibrary, FreeLibrary, GetProcAddress
// Author: Caio Rodrigues
//---------------------------------------------------------------------------
#include <iostream>
#include <string>
#include <windows.h>
@caiorss
caiorss / GetLogicalDrivers.cpp
Created December 11, 2018 23:25
Get Windows logical drivers
//---------------------------------------------------------------
// File: GetLogicalDrivers.cpp
// Description: Enumerate all logical drivers in the computer.
// Author: Caio Rodrigues
//--------------------------------------------------------------
#include <iostream>
#include <string>
#include <sstream>
#include <deque>
@caiorss
caiorss / gui-without-winmain.cpp
Created December 11, 2018 16:13
Minimal Windows GUI Program for Win32 API without WinMain - https://caiorss.github.io/C-Cpp-Notes/WindowsAPI-cpp.html#orgc3f65d8
// File: gui-without-winmain.cpp
// Brief: Minimal Windows GUI Program for Win32 API without WinMain.
// Author: Caio Rodrigues
//--------------------------------------------------------------------------------------
#include <iostream>
#include <string>
#include <windows.h>
@caiorss
caiorss / gui-basic1.cpp
Created December 11, 2018 15:57
Basic 'hello world' - Win32API GUI Graphical User Interface in modern C++ - https://caiorss.github.io/C-Cpp-Notes/WindowsAPI-cpp.html
// File: gui-basic1.cpp
// Brief: Minimal Windows GUI Program with Win32 API.
// Author: Caio Rodrigues
//
// Build with:
// $ cl.exe gui-basic1.cpp /EHsc /Zi /nologo /Fe:GuiApp.exe user32.lib gdi32.lib
//--------------------------------------------------------------------------------------
#include <iostream>
#include <string>
@caiorss
caiorss / winlNet-basic.cpp
Created December 10, 2018 19:04
winlNet-basic.cpp - WinlNet - Windows high level APIs for HTTP and FTP protocol - https://caiorss.github.io/C-Cpp-Notes/WindowsAPI-cpp.html#org49fca3a
#include <iostream>
#include <vector>
#include <string>
#include <cstdio>
#include <windows.h>
#include <urlmon.h> //Provides URLDownloadToFileW
#include <wininet.h>
#include <tchar.h>