Filed under Windows programming

Find File in windows with C++ code

Windows doesn’t have a built-in function that checks if a file with a given name exists. It can be trivially written using GetFileAttributes or FindFirstFile APIs. Version below uses GetFileAttributes. /* Return TRUE if file ‘fileName’ exists */ bool FileExists(const TCHAR *fileName) { DWORD fileAttr; fileAttr = GetFileAttributes(fileName); if (0xFFFFFFFF == fileAttr && GetLastError() == … Continue reading

Import native DLL into a C++ program

When you are writing C++ programs, sometimes you may need to use third party dll files in your application. This tutorial is a comprehensive guide to using a native dll within a C++ application. Before we start the coding, let’s have a small introduction about dynamic loading. What is Dynamic Loading? Normally, when you link … Continue reading