How to use the Windows API in MinGW?
MinGW comes with a windows. h file so you don't need to do anything extra.
Install GCC on Windows First, select mingw-get from your application menu to launch it. To install GCC, click the GCC and G++ package to mark GNU C and C++ compiler for installation. To complete the process, select Apply Changes from the Installation menu in the top-left corner of the mingw-get window.
In the Windows search bar, type 'settings' to open your Windows Settings. Search for Edit environment variables for your account. Choose the Path variable in your User variables and then select Edit. Select New and add the Mingw-w64 destination folder path to the system path.
Whenever I've done this, I just
#include <windows.h>
and start coding. MinGW comes with a windows.h
file so you don't need to do anything extra.
I occasionally use the Windows API for Qt apps that I build using Qt Creator/MinGW - I just #include
the appropriate Windows SDK header (the headers come with MinGW) and it just works. However, you may need to #define
a few things in order that some API calls are exposed. For example, I recently needed to call SHGetSpecialFolderPath
(found in shlobj.h
) but needed to define _WIN32_IE
to 0x0400
first.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With