I need to set priorities of threads manually, and I do this with GetProcessIdOfThread. Unfortunately, a 3rd party library requires me to build the code as Use MFC in a Shared DLL so that I can use afx.h for some dll trickery.
How can I use functions like GetProcessIdOfThread without windows.h?
I have tried to include WinBase.h but this throws out a lot of nonsense, compile errors.
Provided your downstream linker settings are correct, you can simply add the function declaration to a project header file of your choosing.
Here’s the original declaration in
WinBase.h:If you’re not including
Windows.h, then you’re not going to have most of the used preprocessor macros/definitions necessary for that particular declaration. If you’re linking against the static library version of the CRT, this is the equivalent definition:If you’re linking against the DLL version of the CRT, you’ll need to prefix the declaration with
__declspec(dllimport):