Tag: win32

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.

In this post I’ll share a method you can use to access and read events in Windows operating system, using C++. Note that this method is modified to be used with Qt, but you can easily replace the few Qt classes used in this example and remove the dependency on Qt if you are using any other frameworks. In any case, this method relies on Win32 APIs and will work only on Windows operating system.

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.

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.

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.

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:

Qt is a cross-platform framework that encapsulates API across many Operating Systems but one always faces situations in which he/she needs to access and use OS specific capabilities. Windows API is a massive collection of interfaces that allow a programmer to use and include Windows features in their programs. Below is a simple example on how to use Windows API in Qt.

Let’s say we want to use GetSystemTime function in our Qt program. Searching Google for “GetSystemTime API” you’ll get the API Documentation from MSDN website. Parameters and return type values should be obvious: