tags:

views:

849

answers:

3

How to use the Windows API in MinGW?

+2  A: 

This seems to be a good resource to take a look at.

GMan
+4  A: 

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.

Greg Hewgill
It is wrong to tell that MinGW comes with windows.h. People like me, who prefers copying latest packages and building MinGW by yourself (not using installer), should copy w32api package from MinGW download site.
Andrejs Cainikovs
+1  A: 

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.

Rob