Is there a way to create a preprocessor macro for a function?
问题 Is it possible to create a C++ preprocessor macro based on a function result? For example, I'd like to save the screen height dynamically in a preprocessor macro definition: #define SCREEN_HEIGHT GetSystemMetrics(SM_CYVIRTUALSCREEN) Then I want to use the result to set values based on the screen height: #if SCREEN_HEIGHT < 1200 #define TOP_COORD 200 #define BOTTOM_COORD 500 #define LEFT_COORD 0 #define RIGHT_COORD 1280 #else #define TOP_COORD 1100 #define BOTTOM_COORD 1400 #define LEFT_COORD