#ifndef INCLUDED_C_WINGUIAPP_H #define INCLUDED_C_WINGUIAPP_H #ifndef INCLUDED_WINDOWS_H #define INCLUDED_WINDOWS_H #include #endif /*INCLUDED_WINDOWS_H*/ #ifndef INCLUDED_WINDOWSX_H #define INCLUDED_WINDOWSX_H #include #endif /*INCLUDED_WINDOWSX_H*/ #ifndef INCLUDED_STRING_H #define INCLUDED_STRING_H #include #endif /*INCLUDED_STRING_H*/ #ifndef INCLUDED_STDLIB_H #define INCLUDED_STDLIB_H #include #endif /*INCLUDED_STDLIB_H*/ #ifndef INCLUDED_STDIO_H #define INCLUDED_STDIO_H #include #endif /*INCLUDED_STDIO_H*/ #ifndef INCLUDED_TIME_H #define INCLUDED_TIME_H #include #endif /*INCLUDED_TIME_H*/ #ifndef INCLUDED_STDINT_H #define INCLUDED_STDINT_H #include #endif /*INCLUDED_STDINT_H*/ #ifndef INCLUDED_STDBOOL_H #define INCLUDED_STDBOOL_H #include #endif /*INCLUDED_STDBOOL_H*/ #ifndef INCLUDED_STDATOMIC_H #define INCLUDED_STDATOMIC_H #include #endif /*INCLUDED_STDATOMIC_H*/ #ifndef INCLUDED_STDDEF_H #define INCLUDED_STDDEF_H #include #endif /*INCLUDED_STDDEF_H*/ #ifndef INCLUDED_INTTYPES_H #define INCLUDED_INTTYPES_H #include #endif /*INCLUDED_INTTYPES_H*/ /* -------------------------------------------------------------------------------------------------------------- */ /* */ typedef struct { HINSTANCE hInstance; HWND hMainWindow; }c_WinGuiApp_t; typedef bool (*c_WinGuiApp_fRegister_t)(HINSTANCE hInstance); typedef HWND (*c_WinGuiApp_fCreate_t)(HINSTANCE hInstance, int nCmdShow); extern c_WinGuiApp_t c_WinGuiApp; /* -------------------------------------------------------------------------------------------------------------- */ /* */ #define c_WinGuiApp_Main(fRegister, fCreate) \ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdParam, int nCmdShow){ \ MSG Msg; \ if(!hPrevInstance){ \ c_WinGuiApp.hInstance = hInstance; \ if(!fRegister(hInstance)){ \ return FALSE; \ } \ } \ c_WinGuiApp.hMainWindow = fCreate(hInstance, nCmdShow); \ if(!c_WinGuiApp.hMainWindow){ \ return FALSE; \ } \ while(GetMessage(&Msg, NULL, 0, 0)){ \ TranslateMessage(&Msg); \ DispatchMessage(&Msg); \ } \ return Msg.wParam; \ } #define c_WinGuiApp_OnEvent(msg, handler) case msg: return HANDLE_##msg(hWnd, wParam, lParam, handler); #define c_WinGuiApp_EventBegin(name) \ static LRESULT CALLBACK name(HWND hWnd, UINT Message, WPARAM wParam, LPARAM lParam){ \ switch (Message) { #define c_WinGuiApp_EventEnd\ default: \ return DefWindowProc(hWnd, Message, wParam, lParam); \ } \ } #endif /*INCLUDED_C_WINGUIAPP_H*/