When dealing with data encryption and decryption in Windows operating systems, probably one of the best choices is to use the Data Protection API. In this post I’ll be sharing two simple functions that can be used to encrypt and decrypt data (such as passwords, recovery keys and so on) that you want to store in an easy, quick and highly protected manner. Needless to say, these functions can be used with C++ and Qt Framework.
Continue reading “How to Use DPAPI with Qt Framework to Encrypt and Decrypt Data”How to Check if Windows is Locked in Qt/C++
Here is how you can check and see if Windows is locked in Qt/C++. This same function will also let you know if the user is switched to another. Note that this involves using some Win32 API functions.
Continue reading “How to Check if Windows is Locked in Qt/C++”How to Open CHM Files and Topics in C++/Qt (Using Windows API)
In Qt/C++ you can open Compiled HTML Help files (*.CHM files) quite easily with a simple Win32 API function named HtmlHelp. In this post I have shared a wrapper function that you can copy and paste in your Qt/C++ code and use.
Continue reading “How to Open CHM Files and Topics in C++/Qt (Using Windows API)”How to Get Window Handle (HWND) in Qt
You can use the following approach to get a Window‘s Handle in Qt. This can be useful in case you need to call a Windows API (Win32 API) function that is not implemented in Qt or for any other purposes.
Continue reading “How to Get Window Handle (HWND) in Qt”What you need to know about LPCTSTR in Windows API (Specially for Qt users)
This question comes up a lot and is sometimes very confusing but if you just pay attention for a few seconds you’ll get past this forever, I promise you.
Continue reading “What you need to know about LPCTSTR in Windows API (Specially for Qt users)”How to Send and Receive JSON Requests in Qt
There are many APIs on the web that accept JSON requests and reply using JSON. An example for this can be most of Google’s API services. For example if you are writing a Qt application that needs JSON interaction with a Google API (such as Google Webmaster API) you can easily send requests and receive responses if you follow these steps.
How to List All Running Programs and Windows in Qt
If you are learning how to use Windows API (specially Win32 API) in Qt you might have come across a lot of functions which require the usage of Callback Functions. A very well-known example is EnumWindows function. This function allows listing all open windows through a callback function.
Continue reading “How to List All Running Programs and Windows in Qt”How To Mix C++ And Java Code (In Qt For Android)
Qt allows you to use Java code in your Android applications. This is the same code that Android Studio (or Eclipse etc.) users use when they are writing applications for Android. In Qt, by default, you are limited to C++ code and what the Qt modules have to offer (which in most cases are enough) but there are certain situations where you need to use something from Android API which is not provided in Qt. An obvious example for this can be using the default Android Galley to open a picture, or using Text-To-Speech engine or any other API that you can think of. If you don’t want to be limited to what is provided by Qt while writing Android apps then follow the steps below to be able to add Java code to your Qt project.
Continue reading “How To Mix C++ And Java Code (In Qt For Android)”How To Get Free Disk Space In C++ (Qt for Windows)
You can use the following Win32 API function to get the free disk space in C++. Note that this function can be used with Qt for Windows if you add the required dependencies described in this post.
Continue reading “How To Get Free Disk Space In C++ (Qt for Windows)”How to use System-Wide Hotkeys in your Qt application
First of all, this method can only be used in Windows because it makes use of the RegisterHotKey function which is a Win32 API function. So if you want to trigger a function in your Qt application even when your application is out of focus or minimized or even hidden then follow the steps below one by one:
Continue reading “How to use System-Wide Hotkeys in your Qt application”