Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use the Windows API in MinGW?

Tags:

c++

mingw

winapi

How to use the Windows API in MinGW?

like image 567
SomeUser Avatar asked Oct 10 '09 21:10

SomeUser


People also ask

Does MinGW have Windows H?

MinGW comes with a windows. h file so you don't need to do anything extra.

How do I use GCC on Windows MinGW?

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.

How do I add MinGW to Windows path?

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.


Video Answer


2 Answers

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.

like image 149
Greg Hewgill Avatar answered Oct 13 '22 06:10

Greg Hewgill


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.

like image 30
Rob Avatar answered Oct 13 '22 07:10

Rob