Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*+src\kit_win32\kit_Bitmap.cpp+*/
- #include <kit/_video_Bitmap.hpp>
- #include "kit_Bitmap_shared.hpp"
- #define KIT_INVALID_BITMAP _kit_invalid_bitmap
- namespace kit {
- static const char _kit_invalid_bitmap[] = "invalid bitmap";
- //loads from memory
- Bitmap::Bitmap(const color::ARGB* pixelData,
- u32 width, u32 height,
- bool directAccess)
- {
- _type = KIT_CLASSTYPE_BITMAP;
- _opq = (_BitmapOpaque*)CoTaskMemAlloc(sizeof(_BitmapOpaque));
- if(_opq == nullptr) throw "ran out of memory creating _opq";
- memset(_opq, 0, sizeof(_BitmapOpaque));
- if(!width ) throw "width = 0";
- if(!height) throw "height = 0";
- if(!PopulateBitmapOpaque(*_opq, pixelData, width, height, directAccess)){
- CoTaskMemFree(_opq);
- throw "failed to create internal bitmap";
- }
- _valid = true;
- }
- Bitmap::~Bitmap(){
- if(!_valid) return;
- _valid = false;
- if(_opq != nullptr){
- DeleteObject(_opq->handle);
- DeleteDC(_opq->devCtx);
- CoTaskMemFree(_opq);
- _opq = nullptr;
- }
- }
- }; /* namespace kit */
- /*-src\kit_win32\kit_Bitmap.cpp-*/
- /*+src\kit_win32\kit_main.cpp+*/
- #include "_kit_globals.hpp"
- using namespace kit;
- HINSTANCE w32::hThisInst = nullptr;
- HINSTANCE w32::hPrevInst = nullptr;
- LPSTR w32::lpszArg = nullptr;
- int w32::nCmdShow = SW_HIDE;
- LARGE_INTEGER w32::ticksPerSecond;
- //get first and last char of string, excluding leading or trailing whitespace
- //(whitespace as in ' '; i'm not going to bother with '\t', '\n', etc.)
- static inline char* _getFirstCharPtr(char* start){
- if(*start == 0) return start;
- while(*start == ' ') ++start;
- return start;
- }
- static inline char* _getLastCharPtr(char* start){
- if(*start == 0) return start;
- char* end = start;
- while(*(end+1) != 0 ) ++end; //go to null terminator
- while(*end == ' ') --end; //go back until a non-whitespace char is found
- return end;
- }
- //provided by the user
- extern int main(int argc, char** argv);
- //converts lpszArg to how argv normally behaves,
- //before calling a user-defined main() function
- int WINAPI WinMain(HINSTANCE hThisInst, HINSTANCE hPrevInst,
- LPSTR lpszArg, int nCmdShow)
- {
- //assign some global values
- w32::hThisInst = hThisInst;
- w32::hPrevInst = hPrevInst;
- w32::lpszArg = lpszArg;
- w32::nCmdShow = nCmdShow;
- QueryPerformanceFrequency(&w32::ticksPerSecond);
- char* p = (char*)lpszArg;
- int _argc = 1; //should always contain path to executable
- char** _argv = nullptr;
- //parse for the number of arguments (assuming space as delimiter)
- char* first = _getFirstCharPtr(p);
- char* last = _getLastCharPtr(p);
- int Arg_len = (int)(last-first) + ((*first!=0) ? 1 : 0);
- if(Arg_len > 0) ++_argc;
- for(p=first; p<=last; ++p){
- if(*p == ' ') ++_argc;
- }
- //create and fill in _argv
- _argv = (char**)CoTaskMemAlloc( sizeof(char*) * _argc );
- if(_argv == nullptr) return ERROR_NOT_ENOUGH_MEMORY;
- memset(_argv, 0, sizeof(char*)*_argc ); //this may be redundant...
- char filepath[MAX_PATH]; //path to current process
- if(GetModuleFileNameA(NULL, filepath, MAX_PATH) == 0)
- return ERROR_INSUFFICIENT_BUFFER;
- _argv[0] = filepath;
- if(Arg_len > 0){
- int i = 1;
- _argv[i++] = first;
- for(p=first; p<=last; ++p){
- if(*p == ' '){
- *p = 0; //set delimiter to null
- _argv[i++] = p+1; //+1 as in +sizeof(char*)
- }
- }
- *p = 0; //make sure last arg has null terminator
- }
- int returnCode = main(_argc,_argv);
- CoTaskMemFree(_argv);
- return returnCode;
- }
- /*-src\kit_win32\kit_main.cpp-*/
- /*+src\kit_win32\kit_Mutex.cpp+*/
- #include <kit/_misc_Mutex.hpp>
- #include "_kit_globals.hpp"
- #define KIT_MUTEX_NULLPTR _kit_mutex_nullptr
- using namespace kit;
- static const char _kit_mutex_nullptr[] = "internal mutex = nullptr";
- MutexSimple::MutexSimple(u32 spinCount){
- _type = KIT_CLASSTYPE_MUTEXSIMPLE;
- //(no cast needed when allocating, since _mutex_ptr is already of type void*)
- _mutex_ptr = CoTaskMemAlloc(sizeof(CRITICAL_SECTION));
- if(_mutex_ptr == nullptr) throw "ran out of memory creating internal mutex";
- memset(_mutex_ptr, 0, sizeof(CRITICAL_SECTION));
- if(spinCount == -1){
- InitializeCriticalSection((CRITICAL_SECTION*)_mutex_ptr);
- //to my knowledge, there is no GetCriticalSectionSpinCount,
- //so i need to probe for it with a "Set" before setting it back
- //(also, i tried to grab the SpinCount member of the critical section
- // directly, but that seemed to result in undefined behavior for some reason!!!)
- _spinCount = SetCriticalSectionSpinCount((CRITICAL_SECTION*)_mutex_ptr, 0);
- SetCriticalSectionSpinCount((CRITICAL_SECTION*)_mutex_ptr, _spinCount);
- } else {
- InitializeCriticalSectionAndSpinCount((CRITICAL_SECTION*)_mutex_ptr, spinCount);
- _spinCount = spinCount;
- }
- }
- MutexSimple::~MutexSimple(){
- if(_mutex_ptr == nullptr) return;
- DeleteCriticalSection((CRITICAL_SECTION*)_mutex_ptr);
- CoTaskMemFree(_mutex_ptr);
- _mutex_ptr = nullptr;
- }
- void MutexSimple::setSpinCount(u32 spinCount){
- if(_mutex_ptr == nullptr) throw KIT_MUTEX_NULLPTR;
- SetCriticalSectionSpinCount((CRITICAL_SECTION*)_mutex_ptr, spinCount);
- _spinCount = spinCount;
- }
- void MutexSimple::lock(bool locked){
- if(_mutex_ptr == nullptr) throw KIT_MUTEX_NULLPTR;
- if(locked) EnterCriticalSection((CRITICAL_SECTION*)_mutex_ptr);
- else LeaveCriticalSection((CRITICAL_SECTION*)_mutex_ptr);
- }
- bool MutexSimple::tryLock(){
- if(_mutex_ptr == nullptr) throw KIT_MUTEX_NULLPTR;
- return TryEnterCriticalSection((CRITICAL_SECTION*)_mutex_ptr);
- }
- /*-src\kit_win32\kit_Mutex.cpp-*/
- /*+src\kit_win32\kit_time.cpp+*/
- #include <kit/_misc_time.hpp>
- #include "_kit_globals.hpp"
- #include <Windows.h>
- namespace kit {
- u64 time::getTicks(){
- LARGE_INTEGER ticks;
- QueryPerformanceCounter(&ticks);
- return ticks.QuadPart;
- }
- u64 time::getTicksPerSecond(){
- return w32::ticksPerSecond.QuadPart;
- }
- f64 time::getUptime(){
- return (f64)time::getTicks()/w32::ticksPerSecond.QuadPart;
- }
- void time::sleep(u32 milliseconds){
- Sleep(milliseconds);
- }
- }; /* namespace kit */
- /*-src\kit_win32\kit_time.cpp-*/
- /*+src\kit_win32\kit_Window.cpp+*/
- #include <kit/_video_Window.hpp>
- #include "kit_Window_shared.hpp"
- #define KIT_IS_INVALID_WINDOW ( (!_valid && !_constructing) || _opq->winClosed )
- #define KIT_INVALID_WINDOW _kit_invalid_window
- namespace kit {
- static const char _kit_invalid_window[] = "invalid window";
- namespace w32 {
- u32 winCount = 0; //number of existing kit::Window instances
- const char winClassName[] = "kit::Window Class";
- WNDCLASSEXA winClass;
- ATOM winClassAtom;
- };
- Window::Window(const char* windowTitle,
- u32 windowWidth, u32 windowHeight,
- u32 windowFlags,
- s32 windowX, s32 windowY,
- u32 canvasWidth, u32 canvasHeight,
- bool directAccess)
- {
- _type = KIT_CLASSTYPE_WINDOW;
- _opq = (_WindowOpaque*)CoTaskMemAlloc(sizeof(_WindowOpaque));
- if(_opq == nullptr) throw "ran out of memory creating _opq";
- memset(_opq, 0, sizeof(_WindowOpaque));
- char* errorText = "no error";
- if(0){ //this code block is only entered via goto in the event of an exception
- //(destroying the window is unnecessary, as it's the last thing to be made anyway)
- //_DestroyWindow : DestroyWindow(_opq->winHandle);
- _DestroyCanvas : DeleteObject(_opq->canvas.handle);
- DeleteDC(_opq->canvas.devCtx);
- _UnregisterClass: if(w32::winCount == 0) UnregisterClassA(w32::winClassName, w32::hThisInst);
- _DelCritSection : DeleteCriticalSection(&_opq->lock);
- _FreeOpaque : CoTaskMemFree(_opq);
- throw (const char*)errorText;
- }
- //window title
- if(windowTitle != nullptr){
- if( strncpy_s(_title, 256, windowTitle, 255) )
- throw "windowTitle failed to copy";
- _title[255] = 0; //just in case
- } else {
- _title[0] = 0;
- }
- //window size
- if(!windowWidth ) windowWidth = GetSystemMetrics(SM_CXSCREEN);
- if(!windowHeight) windowHeight = GetSystemMetrics(SM_CYSCREEN);
- //create event queue
- _opq->eventQueue = (WindowEvent*)CoTaskMemAlloc(sizeof(WindowEvent)*65536);
- if(_opq->eventQueue == nullptr){
- errorText = "ran out of memory creating event queue";
- goto _FreeOpaque;
- }
- //(no memset is necessary for the event queue, thankfully)
- _opq->eventQueueNext = 0; //both indexes are 16-bit, so they'll roll over on overflow
- _opq->eventQueueEnd = 0; //(which is nice, since the queue's length is exactly 2^16)
- //initialize mutex
- InitializeCriticalSectionAndSpinCount(&_opq->lock, KIT_LOCK_SPINCOUNT);
- //create and register window class (only if no other windows are present)
- if(w32::winCount == 0){
- w32::winClass.cbSize = sizeof(WNDCLASSEX);
- w32::winClass.style = CS_DBLCLKS; //allow double clicks
- w32::winClass.lpfnWndProc = w32::WindowProc;
- w32::winClass.cbClsExtra = 0;
- w32::winClass.cbWndExtra = 0;
- w32::winClass.hInstance = w32::hThisInst;
- w32::winClass.hIcon = nullptr;
- w32::winClass.hCursor = LoadCursor(NULL, IDC_ARROW);
- w32::winClass.hbrBackground = nullptr;
- w32::winClass.lpszMenuName = nullptr;
- w32::winClass.lpszClassName = w32::winClassName;
- w32::winClass.hIconSm = nullptr; //(the window's small icon)
- w32::winClassAtom = RegisterClassExA(&w32::winClass);
- if(!w32::winClassAtom){
- errorText = "RegisterClassA() failed";
- goto _DelCritSection;
- }
- }
- //create canvas
- if(canvasWidth > windowWidth ) throw "canvasWidth > windowWidth";
- if(canvasHeight > windowHeight) throw "canvasHeight > windowHeight";
- if(!canvasWidth ) canvasWidth = windowWidth;
- if(!canvasHeight) canvasHeight = windowHeight;
- _opq->canvasStretch = (canvasWidth<windowWidth || canvasHeight<windowHeight);
- if(!PopulateBitmapOpaque(_opq->canvas, nullptr, canvasWidth, canvasHeight, directAccess))
- {
- errorText = "failed to create canvas";
- goto _UnregisterClass;
- }
- HandlePreCreationWindowFlags(_opq, windowFlags);
- //create window
- shape::point winSize = CalculateWindowSize(windowWidth, windowHeight,
- _opq->winFlags, _opq->winFlagsEx);
- _opq->winHandle = CreateWindowExA(_opq->winFlagsEx, w32::winClassName, _title,
- _opq->winFlags, windowX, windowY, winSize.x, winSize.y,
- nullptr, nullptr, w32::hThisInst, (LPVOID)this);
- if(_opq->winHandle == nullptr){
- errorText = "CreateWindowA() failed";
- goto _DestroyCanvas;
- }
- _opq->winRect.x = (windowX != WINPOS_UNCHANGED) ? windowX : WINPOS_UNDEFINED;
- _opq->winRect.y = (windowY != WINPOS_UNCHANGED) ? windowY : WINPOS_UNDEFINED;
- _opq->winRect.w = winSize.x;
- _opq->winRect.h = winSize.y;
- setWindowRect(&_opq->winRect);
- if(_opq->winFullscreen ) setFullscreen(true);
- if(!(windowFlags & WINFLAG_HIDDEN)) setVisibility(true);
- if( windowFlags & WINFLAG_FOCUS ) setFocus(true);
- _opq->winClosed = false;
- _opq->winIndex = w32::winCount++; //set window index, before adding to total count
- _valid = true;
- _constructing = false;
- }
- Window::~Window(){
- if(!_valid) return;
- _valid = false;
- --w32::winCount; //remove window from total count
- if(_opq != nullptr){
- DestroyWindow(_opq->winHandle);
- DeleteObject(_opq->canvas.handle);
- DeleteDC(_opq->canvas.devCtx);
- if(w32::winCount == 0) UnregisterClassA(w32::winClassName, w32::hThisInst);
- DeleteCriticalSection(&_opq->lock);
- CoTaskMemFree(_opq->eventQueue);
- CoTaskMemFree(_opq);
- _opq = nullptr;
- }
- }
- bool Window::isClosed(){
- //(can't use KIT_IS_INVALID_WINDOW here)
- if(!_valid && !_constructing) throw KIT_INVALID_WINDOW;
- return _opq->winClosed; //set by w32::WindowProc, rather than destructor
- }
- shape::rect Window::getWindowRect(){
- if(KIT_IS_INVALID_WINDOW) throw KIT_INVALID_WINDOW;
- return _opq->winRect;
- }
- shape::point Window::getCanvasSize(){
- if(KIT_IS_INVALID_WINDOW) throw KIT_INVALID_WINDOW;
- return _opq->canvas.size;
- }
- color::ARGB* Window::getPixels(){
- if(KIT_IS_INVALID_WINDOW) throw KIT_INVALID_WINDOW;
- if(_opq->canvas.directAccess) return _opq->canvas.pixels;
- else throw "window does not support direct access";
- }
- //if newRect == nullptr, the window will stretch to fit the whole screen
- void Window::setWindowRect(shape::rect* newRect){
- if(KIT_IS_INVALID_WINDOW) throw KIT_INVALID_WINDOW;
- s32 screenWidth = GetSystemMetrics(SM_CXSCREEN);
- s32 screenHeight = GetSystemMetrics(SM_CYSCREEN);
- if(newRect != nullptr){
- RECT winRectTmp;
- GetWindowRect(_opq->winHandle, &winRectTmp); //get window's bounding box
- shape::rect winRectCurrent = ConvertToKitRect(winRectTmp);
- shape::point centerPos;
- centerPos.x = screenWidth /2 - winRectCurrent.w/2;
- centerPos.y = screenHeight/2 - winRectCurrent.h/2;
- if( newRect->x == WINPOS_UNDEFINED) newRect->x = CW_USEDEFAULT;
- else if(newRect->x == WINPOS_CENTERED ) newRect->x = centerPos.x;
- if( newRect->y == WINPOS_UNDEFINED) newRect->y = CW_USEDEFAULT;
- else if(newRect->y == WINPOS_CENTERED ) newRect->y = centerPos.y;
- shape::rect _newRect = winRectCurrent;
- if(newRect->x != WINPOS_UNCHANGED) _newRect.x = newRect->x;
- if(newRect->y != WINPOS_UNCHANGED) _newRect.y = newRect->y;
- if(newRect->w!=WINPOS_UNCHANGED && newRect->w>0) _newRect.w = newRect->w;
- if(newRect->h!=WINPOS_UNCHANGED && newRect->h>0) _newRect.h = newRect->h;
- SetWindowPos(_opq->winHandle, nullptr, newRect->x,newRect->y,
- newRect->w, newRect->h, SWP_NOZORDER);
- GetWindowRect(_opq->winHandle, &winRectTmp); //get window's bounding box (again)
- _opq->winRect = ConvertToKitRect(winRectTmp); //update the window's rect
- } else {
- //winRect automatically gets overwritten for every WM_MOVE and WM_SIZE message,
- //so record its previous value so it can be set back after the SetWindowPos
- shape::rect previousRectValue = _opq->winRect;
- //this will fill the entire screen
- SetWindowPos(_opq->winHandle, nullptr, 0,0,
- screenWidth, screenHeight, SWP_NOZORDER);
- _opq->winRect = previousRectValue;
- }
- }
- void Window::setVisibility(bool showWindow){
- if(KIT_IS_INVALID_WINDOW) throw KIT_INVALID_WINDOW;
- ShowWindow(_opq->winHandle, (showWindow) ? SW_SHOW : SW_HIDE);
- _opq->winShown = showWindow;
- //*maybe* set _opq->winFlags (probably not needed, though)
- }
- void Window::setFocus(bool enable){
- if(KIT_IS_INVALID_WINDOW) throw KIT_INVALID_WINDOW;
- SetFocus((enable) ? _opq->winHandle : nullptr);
- _opq->winFocus = enable;
- }
- void Window::setFullscreen(bool enable){
- if(KIT_IS_INVALID_WINDOW) throw KIT_INVALID_WINDOW;
- if(enable){ //modify values accordingly
- //style flags
- SetWindowLongA(_opq->winHandle, GWL_STYLE,
- _opq->winFlags & ~(WS_CAPTION | WS_THICKFRAME));
- //extended style flags
- SetWindowLong(_opq->winHandle, GWL_EXSTYLE,
- _opq->winFlagsEx & ~(WS_EX_DLGMODALFRAME |
- WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE | WS_EX_STATICEDGE));
- //stretch window to match screen's width and height
- setWindowRect(nullptr);
- } else { //restore values to what they were before
- //restore style flags
- SetWindowLongA(_opq->winHandle, GWL_STYLE, _opq->winFlags);
- //restore extended style flags
- SetWindowLong(_opq->winHandle, GWL_EXSTYLE, _opq->winFlagsEx);
- //restore window position and size
- setWindowRect(&_opq->winRect);
- }
- //idk for sure why this fixes the issue of the window breaking when
- //fullscreen is toggled, but if it works in the constructor and here too,
- //then i have no problem with doing it this way :)
- setVisibility(_opq->winShown);
- }
- bool Window::pollEvent(WindowEvent* event_p){
- if(KIT_IS_INVALID_WINDOW) throw KIT_INVALID_WINDOW;
- //take one event off the current event queue and set it to *event_p
- EnterCriticalSection(&_opq->lock);
- WindowEvent event = RemoveFromEventQueue(_opq);
- LeaveCriticalSection(&_opq->lock);
- //if previous event queue is now empty, process any pending window messages,
- //while adding any events generated by WindowProc to the event queue
- if(_opq->eventQueueNext == _opq->eventQueueEnd){
- MSG message;
- while(PeekMessageA(&message, _opq->winHandle, 0, 0, PM_REMOVE)){
- TranslateMessage(&message);
- DispatchMessageA(&message);
- }
- }
- if(event_p != nullptr) *event_p = event;
- return event.type != WINEVENT_NULL;
- }
- void Window::lock(bool locked){
- if(KIT_IS_INVALID_WINDOW) throw KIT_INVALID_WINDOW;
- if(locked) EnterCriticalSection(&_opq->lock);
- else LeaveCriticalSection(&_opq->lock);
- }
- void Window::present(){
- if(KIT_IS_INVALID_WINDOW) throw KIT_INVALID_WINDOW;
- InvalidateRect(_opq->winHandle, nullptr, false);
- UpdateWindow(_opq->winHandle);
- }
- void Window::clear(color::ARGB color){
- if(KIT_IS_INVALID_WINDOW) throw KIT_INVALID_WINDOW;
- HBRUSH brushHandle = CreateSolidBrush(color.v);
- if(brushHandle != nullptr){
- SelectObject(_opq->canvas.devCtx, brushHandle);
- RECT rectF;
- rectF.left = 0;
- rectF.top = 0;
- rectF.right = _opq->canvas.size.x;
- rectF.bottom = _opq->canvas.size.y;
- FillRect(_opq->canvas.devCtx, &rectF, brushHandle);
- DeleteObject(brushHandle);
- }
- }
- }; /* namespace kit */
- /*-src\kit_win32\kit_Window.cpp-*/
- /*+src\kit_win32\kit_Window_WindowProc.cpp+*/
- #include <kit/_video_Window.hpp>
- #include <kit/_video_WindowEvent.hpp>
- #include "kit_Window_shared.hpp"
- #include "kit_Window_WindowProcEvent.hpp"
- using namespace kit;
- #if defined(_DEBUG)
- static void printMessage(HWND, UINT, WPARAM, LPARAM);
- #else
- #define printMessage(...) ;
- #endif /* _DEBUG */
- LRESULT CALLBACK w32::WindowProc(HWND winHandle, UINT message,
- WPARAM wParam, LPARAM lParam)
- {
- //printMessage(winHandle, message, wParam, lParam); //debug thingy
- Window* window = (Window*)GetWindowLongPtrA(winHandle, GWLP_USERDATA);
- if(window == nullptr){
- if(message == WM_CREATE){
- //set userdata to a pointer to the associated kit::Window
- CREATESTRUCT* cs = (CREATESTRUCT*)lParam;
- SetWindowLongPtrA(winHandle, GWLP_USERDATA, (LONG_PTR)cs->lpCreateParams);
- return 0;
- }
- goto _dwp; //lol
- } else if(!window->isValid() && !window->isConstructing()){
- _dwp: return DefWindowProcA(winHandle, message, wParam, lParam);
- }
- _WindowOpaque* opq = window->_accessOpaque();
- EnterCriticalSection(&opq->lock);
- LRESULT returnResult = 0;
- WindowEvent event; //will be populated by any call to KIT_HANDLE_EVENT()...
- memset(&event, 0, sizeof(WindowEvent));
- event.common.type = WINEVENT_COMMON; //...otherwise it will stay common
- event.common.winIndex = opq->winIndex;
- bool switchBool = false; //multipurpose
- bool switchBool2 = true; //^^
- u32 switchFlags = 0; //^^
- switch(message){
- //window and canvas messages (WINEVENT_WIN_<event name>)
- //WINEVENT_WIN_CLOSE
- case WM_CLOSE:
- {
- KIT_HANDLE_EVENT(WIN_CLOSE);
- } break;
- //WINEVENT_WIN_MOVED
- case WM_MOVE:
- {
- //window moved; adjust its position accordingly
- opq->winRect.x = GET_X_LPARAM(lParam);
- opq->winRect.y = GET_Y_LPARAM(lParam);
- KIT_HANDLE_EVENT(WIN_MOVED, opq->winRect);
- } break;
- //WINEVENT_WIN_RESIZED
- case WM_SIZE:
- {
- //window resized; adjust its size accordingly
- opq->winRect.w = LOWORD(lParam);
- opq->winRect.h = HIWORD(lParam);
- //resize canvas if it's supposed to scale with the window
- if(!opq->canvasStretch)
- ResizeBitmapOpaque(opq->canvas, opq->winRect.w, opq->winRect.h);
- //blit canvas to the window to reflect its new size
- window->present();
- KIT_HANDLE_EVENT(WIN_RESIZED, opq->winRect);
- } break;
- //WINEVENT_WIN_UNFOCUSING
- case WM_KILLFOCUS:
- {
- //if a key is released outside the client area, its key up message
- //is never sent, so here the key states are reset when unfocusing...
- //...but first, send a key up event for every currently pressed key
- //call QPC only once, since the events technically happen at the same time
- QueryPerformanceCounter((LARGE_INTEGER*)&event.key.timestamp);
- using namespace WindowProcEvent;
- KEY_Params params = 0;
- params.currUnpressed = 1;
- for(u32 chr=0; chr<256; ++chr){
- //send a KEY_UP only if the state was previously true
- if(opq->keyStates[chr] == true){
- params.scanCode = MapVirtualKeyA(chr, MAPVK_VK_TO_VSC);
- KIT_HANDLE_EVENT(KEY_CHARUPDOWN, false, chr, params, 0);
- if(!AddToEventQueue(opq,event)){ _printf("event queue is full!!!\n"); }
- }
- }
- memset(opq->keyStates, 0, sizeof(bool)*256); //NOW the states can be reset
- opq->kmod.all = 0; //reset any key modifiers too
- opq->winFocus = false;
- KIT_HANDLE_EVENT(WIN_UNFOCUSING);
- } break;
- //WINEVENT_WIN_FOCUSED
- case WM_SETFOCUS:
- {
- opq->winFocus = true;
- KIT_HANDLE_EVENT(WIN_FOCUSED);
- } break;
- //(no associated event)
- case WM_DESTROY:
- {
- opq->winClosed = true;
- } break;
- //(no associated event)
- case WM_GETMINMAXINFO:
- {
- //enforce minimum window size if canvas does not scale with the window
- if(opq->canvasStretch){
- u32 winStyleCurrent = GetWindowLongA(winHandle, GWL_STYLE );
- u32 winStyleExCurrent = GetWindowLongA(winHandle, GWL_EXSTYLE);
- shape::point winSizeAdjusted = CalculateWindowSize(opq->canvas.size.x,
- opq->canvas.size.y,
- winStyleCurrent,
- winStyleExCurrent);
- MINMAXINFO* mmi = (MINMAXINFO*)lParam;
- mmi->ptMinTrackSize.x = winSizeAdjusted.x;
- mmi->ptMinTrackSize.y = winSizeAdjusted.y;
- }
- } break;
- //(no associated event)
- case WM_PAINT:
- {
- if(opq->canvas.handle == nullptr) break; //just in case
- PAINTSTRUCT paint;
- HDC winDevCtx; //window device context
- RECT rectO; //[O]riginal
- shape::rect rectW; //[W]indow
- shape::rect rectF; //[F]rame
- //prepare window for painting
- winDevCtx = BeginPaint(winHandle, &paint);
- rectO = paint.rcPaint;
- rectW = ConvertToKitRect(rectO);
- //calculate copy region of canvas
- f64 percentageX = (f64)rectW.x/rectW.w; //from 0.0 -> 1.0
- f64 percentageY = (f64)rectW.y/rectW.h; //from 0.0 -> 1.0
- rectF.w = opq->canvas.size.x;
- rectF.h = opq->canvas.size.y;
- rectF.x = (s32)( (f64)rectF.w*percentageX + 0.5 ); //(+0.5 for rounding)
- rectF.y = (s32)( (f64)rectF.y*percentageY + 0.5 );
- //copy canvas bitmap to window
- //(window and canvas stretch modes should be the same)
- SetStretchBltMode(winDevCtx, opq->canvas.stretchMode);
- StretchBlt(winDevCtx, rectW.x,rectW.y, rectW.w,rectW.h,
- opq->canvas.devCtx, rectF.x,rectF.y, rectF.w,rectF.h, SRCCOPY);
- EndPaint(winHandle, &paint);
- } break;
- //keyboard messages (WINEVENT_KEY_<event name>)
- //WINEVENT_KEY_CHAR, WINEVENT_KEY_UP, WINEVENT_KEY_DOWN
- case WM_CHAR:
- case WM_SYSKEYUP:
- case WM_SYSKEYDOWN:
- case WM_KEYUP:
- case WM_KEYDOWN:
- case WM_SYSCHAR:
- {
- #define printKeyParams() { \
- _printf("{\n"); \
- _printf(" charEvent = %s\n", (charEvent) ? "true" : "false"); \
- _printf(" virtualKeyCode = %c (0x%02X)\n", virtualKeyCode, virtualKeyCode); \
- _printf(" repeatCount = %u\n", params.repeatCount); \
- _printf(" scanCode = %c (0x%02X)\n", params.scanCode,params.scanCode); \
- _printf(" extendedKey = %s\n", (params.extendedKey) ? "true" : "false"); \
- _printf(" altKeyDown = %s\n", (params.altKeyDown) ? "true" : "false"); \
- _printf(" prevPressed = %s\n", (!params.prevUnpressed) ? "true" : "false"); \
- _printf(" currPressed = %s\n", (!params.currUnpressed) ? "true" : "false"); \
- _printf("}\n"); }
- //^^ i'll remove this stuff once i figure out how to handle key modifiers
- using namespace WindowProcEvent;
- //marshal relevant stuff to pass to event handler
- bool charEvent = message==WM_CHAR;
- u8 virtualKeyCode = (u8)wParam;
- KEY_Params params = (u32)lParam;
- //set repeat flag
- params.repeatCount = (!params.currUnpressed) == true &&
- opq->keyStates[virtualKeyCode] == true;
- if(!charEvent) opq->keyStates[virtualKeyCode] = !params.currUnpressed;
- //update any relevant key modifiers
- opq->kmod.all = 0; //tbd
- KIT_HANDLE_EVENT(KEY_CHARUPDOWN, charEvent, virtualKeyCode,
- params, opq->kmod.all);
- } break;
- //mouse messages (WINEVENT_MOUSE_<event name>)
- //WINEVENT_MOUSE_MOVE
- case WM_MOUSEMOVE:
- {
- using namespace WindowProcEvent;
- //get button states
- MOUSE_ButtonStates buttonStates;
- buttonStates.left = (wParam&MK_LBUTTON ) != 0;
- buttonStates.middle = (wParam&MK_MBUTTON ) != 0;
- buttonStates.right = (wParam&MK_RBUTTON ) != 0;
- buttonStates.x1 = (wParam&MK_XBUTTON1) != 0;
- buttonStates.x2 = (wParam&MK_XBUTTON2) != 0;
- //get new mouse position
- shape::point mousePositionNew;
- mousePositionNew.x = GET_X_LPARAM(lParam);
- mousePositionNew.y = GET_Y_LPARAM(lParam);
- //if this is the first instance of WINEVENT_MOUSE_MOVE,
- //there is no previous mouse position, so the delta should be 0 then
- if(!opq->mouseWasMovedBefore){
- //(handle MOUSE_ENTER events here too, since
- //there is no special message for it)
- KIT_HANDLE_EVENT(MOUSE_ENTER);
- QueryPerformanceCounter((LARGE_INTEGER*)&event.common.timestamp);
- if(!AddToEventQueue(opq,event)){ _printf("event queue is full!!!\n"); }
- opq->mousePosition = mousePositionNew,
- opq->mouseWasMovedBefore = true;
- }
- KIT_HANDLE_EVENT(MOUSE_MOVE, buttonStates.value,
- opq->mousePosition, mousePositionNew);
- opq->mousePosition = mousePositionNew; //set current position to new one
- } break;
- //WINEVENT_MOUSE_LEAVE
- case WM_MOUSELEAVE:
- {
- //indicates that the mouse will have yet to be moved inside client area
- opq->mouseWasMovedBefore = false;
- KIT_HANDLE_EVENT(MOUSE_LEAVE);
- } break;
- /*WINEVENT_MOUSE_ENTER (is handled inside WM_MOUSEMOVE)
- case WM_<there is no mouse enter message!>:
- {
- KIT_HANDLE_EVENT(MOUSE_ENTER);
- } break; */
- //WINEVENT_MOUSE_UP, WINEVENT_MOUSE_DOWN
- //switchBool = event.mouse.dblClick
- //switchBool2 = event.mouse.pressed
- //switchFlags = event.mouse.button
- case WM_LBUTTONDBLCLK: switchBool = true; goto _notLButtonUp;
- case WM_LBUTTONUP : switchBool2 = false; _notLButtonUp:
- case WM_LBUTTONDOWN : switchFlags |= MBUTTON_LEFT; goto _handleMouseClick;
- case WM_MBUTTONDBLCLK: switchBool = true; goto _notMButtonUp;
- case WM_MBUTTONUP : switchBool2 = false; _notMButtonUp:
- case WM_MBUTTONDOWN : switchFlags |= MBUTTON_MIDDLE; goto _handleMouseClick;
- case WM_RBUTTONDBLCLK: switchBool = true; goto _notRButtonUp;
- case WM_RBUTTONUP : switchBool2 = false; _notRButtonUp:
- case WM_RBUTTONDOWN : switchFlags |= MBUTTON_RIGHT; goto _handleMouseClick;
- case WM_XBUTTONDBLCLK: switchBool = true; goto _notXButtonUp;
- case WM_XBUTTONUP : switchBool2 = false; _notXButtonUp:
- case WM_XBUTTONDOWN : if(wParam & MK_XBUTTON1) switchFlags |= MBUTTON_X1;
- else switchFlags |= MBUTTON_X2;
- {
- _handleMouseClick:
- shape::point clickPosition;
- clickPosition.x = GET_X_LPARAM(lParam);
- clickPosition.y = GET_Y_LPARAM(lParam);
- u8 buttonStates = (u8)switchFlags;
- bool pressed = switchBool2;
- bool doubleClick = switchBool;
- KIT_HANDLE_EVENT(MOUSE_UPDOWN, clickPosition,
- buttonStates, pressed, doubleClick);
- } break;
- //WINEVENT_MOUSE_HWHEEL, WINEVENT_MOUSE_VWHEEL
- case WM_MOUSEHWHEEL:
- case WM_MOUSEWHEEL:
- {
- using namespace WindowProcEvent;
- bool verticalScroll = message==WM_MOUSEWHEEL;
- s16 scrollAmount = (s16)HIWORD(wParam);
- MOUSE_ButtonStates buttonStates;
- buttonStates.left = (wParam&MK_LBUTTON ) != 0;
- buttonStates.middle = (wParam&MK_MBUTTON ) != 0;
- buttonStates.right = (wParam&MK_RBUTTON ) != 0;
- buttonStates.x1 = (wParam&MK_XBUTTON1) != 0;
- buttonStates.x2 = (wParam&MK_XBUTTON2) != 0;
- shape::point scrollMousePosition;
- scrollMousePosition.x = GET_X_LPARAM(lParam);
- scrollMousePosition.y = GET_Y_LPARAM(lParam);
- //the coordinates are relative to the screen, not the window (for some reason)
- ScreenToClient(winHandle, (POINT*)&scrollMousePosition);
- KIT_HANDLE_EVENT(MOUSE_HVWHEEL, verticalScroll, scrollAmount,
- buttonStates.value, scrollMousePosition);
- } break;
- default: returnResult = DefWindowProcA(winHandle, message, wParam, lParam);
- }
- if(event.type != WINEVENT_COMMON){
- //idk how expensive QPC is, so i'll only call it if the event is valid
- QueryPerformanceCounter((LARGE_INTEGER*)&event.common.timestamp);
- //i pray AddToEventQueue never fails ever
- if(!AddToEventQueue(opq,event)){ _printf("event queue is full!!!\n"); }
- }
- LeaveCriticalSection(&opq->lock);
- return returnResult;
- }
- //these are for enabling and disabling what messages are printed
- //simply comment these out to disable them
- #define KIT_PM_WM_NULL //0x0000
- #define KIT_PM_WM_CREATE //0x0001
- #define KIT_PM_WM_DESTROY //0x0002
- #define KIT_PM_WM_MOVE //0x0003
- #define KIT_PM_WM_SIZE //0x0005
- #define KIT_PM_WM_ACTIVATE //0x0006
- #define KIT_PM_WM_SETFOCUS //0x0007
- #define KIT_PM_WM_KILLFOCUS //0x0008
- #define KIT_PM_WM_ENABLE //0x000A
- #define KIT_PM_WM_SETREDRAW //0x000B
- #define KIT_PM_WM_SETTEXT //0x000C
- //#define KIT_PM_WM_GETTEXT //0x000D
- //#define KIT_PM_WM_GETTEXTLENGTH //0x000E
- #define KIT_PM_WM_PAINT //0x000F
- #define KIT_PM_WM_CLOSE //0x0010
- #define KIT_PM_WM_QUERYENDSESSION //0x0011
- #define KIT_PM_WM_QUIT //0x0012
- #define KIT_PM_WM_QUERYOPEN //0x0013
- #define KIT_PM_WM_ERASEBKGND //0x0014
- #define KIT_PM_WM_SYSCOLORCHANGE //0x0015
- #define KIT_PM_WM_ENDSESSION //0x0016
- #define KIT_PM_WM_SHOWWINDOW //0x0018
- #define KIT_PM_WM_SETTINGCHANGE //0x001A
- #define KIT_PM_WM_DEVMODECHANGE //0x001B
- #define KIT_PM_WM_ACTIVATEAPP //0x001C
- #define KIT_PM_WM_FONTCHANGE //0x001D
- #define KIT_PM_WM_TIMECHANGE //0x001E
- #define KIT_PM_WM_CANCELMODE //0x001F
- //#define KIT_PM_WM_SETCURSOR //0x0020
- #define KIT_PM_WM_MOUSEACTIVATE //0x0021
- #define KIT_PM_WM_CHILDACTIVATE //0x0022
- #define KIT_PM_WM_QUEUESYNC //0x0023
- #define KIT_PM_WM_GETMINMAXINFO //0x0024
- #define KIT_PM_WM_PAINTICON //0x0026
- #define KIT_PM_WM_ICONERASEBKGND //0x0027
- #define KIT_PM_WM_NEXTDLGCTL //0x0028
- #define KIT_PM_WM_SPOOLERSTATUS //0x002A
- #define KIT_PM_WM_DRAWITEM //0x002B
- #define KIT_PM_WM_MEASUREITEM //0x002C
- #define KIT_PM_WM_DELETEITEM //0x002D
- #define KIT_PM_WM_VKEYTOITEM //0x002E
- #define KIT_PM_WM_CHARTOITEM //0x002F
- #define KIT_PM_WM_SETFONT //0x0030
- #define KIT_PM_WM_GETFONT //0x0031
- #define KIT_PM_WM_SETHOTKEY //0x0032
- #define KIT_PM_WM_GETHOTKEY //0x0033
- #define KIT_PM_WM_QUERYDRAGICON //0x0037
- #define KIT_PM_WM_COMPAREITEM //0x0039
- #define KIT_PM_WM_GETOBJECT //0x003D
- #define KIT_PM_WM_COMPACTING //0x0041
- #define KIT_PM_WM_COMMNOTIFY //0x0044
- #define KIT_PM_WM_WINDOWPOSCHANGING //0x0046
- #define KIT_PM_WM_WINDOWPOSCHANGED //0x0047
- #define KIT_PM_WM_POWER //0x0048
- #define KIT_PM_WM_COPYDATA //0x004A
- #define KIT_PM_WM_CANCELJOURNAL //0x004B
- #define KIT_PM_WM_NOTIFY //0x004E
- #define KIT_PM_WM_INPUTLANGCHANGEREQUEST //0x0050
- #define KIT_PM_WM_INPUTLANGCHANGE //0x0051
- #define KIT_PM_WM_TCARD //0x0052
- #define KIT_PM_WM_HELP //0x0053
- #define KIT_PM_WM_USERCHANGED //0x0054
- #define KIT_PM_WM_NOTIFYFORMAT //0x0055
- #define KIT_PM_WM_CONTEXTMENU //0x007B
- #define KIT_PM_WM_STYLECHANGING //0x007C
- #define KIT_PM_WM_STYLECHANGED //0x007D
- #define KIT_PM_WM_DISPLAYCHANGE //0x007E
- #define KIT_PM_WM_GETICON //0x007F
- #define KIT_PM_WM_SETICON //0x0080
- #define KIT_PM_WM_NCCREATE //0x0081
- #define KIT_PM_WM_NCDESTROY //0x0082
- #define KIT_PM_WM_NCCALCSIZE //0x0083
- //#define KIT_PM_WM_NCHITTEST //0x0084
- #define KIT_PM_WM_NCPAINT //0x0085
- #define KIT_PM_WM_NCACTIVATE //0x0086
- #define KIT_PM_WM_GETDLGCODE //0x0087
- #define KIT_PM_WM_SYNCPAINT //0x0088
- //#define KIT_PM_WM_NCMOUSEMOVE //0x00A0
- #define KIT_PM_WM_NCLBUTTONDOWN //0x00A1
- #define KIT_PM_WM_NCLBUTTONUP //0x00A2
- #define KIT_PM_WM_NCLBUTTONDBLCLK //0x00A3
- #define KIT_PM_WM_NCRBUTTONDOWN //0x00A4
- #define KIT_PM_WM_NCRBUTTONUP //0x00A5
- #define KIT_PM_WM_NCRBUTTONDBLCLK //0x00A6
- #define KIT_PM_WM_NCMBUTTONDOWN //0x00A7
- #define KIT_PM_WM_NCMBUTTONUP //0x00A8
- #define KIT_PM_WM_NCMBUTTONDBLCLK //0x00A9
- #define KIT_PM_WM_NCXBUTTONDOWN //0x00AB
- #define KIT_PM_WM_NCXBUTTONUP //0x00AC
- #define KIT_PM_WM_NCXBUTTONDBLCLK //0x00AD
- #define KIT_PM_WM_INPUT_DEVICE_CHANGE //0x00FE
- #define KIT_PM_WM_INPUT //0x00FF
- #define KIT_PM_WM_KEYDOWN //0x0100
- #define KIT_PM_WM_KEYUP //0x0101
- #define KIT_PM_WM_CHAR //0x0102
- #define KIT_PM_WM_DEADCHAR //0x0103
- #define KIT_PM_WM_SYSKEYDOWN //0x0104
- #define KIT_PM_WM_SYSKEYUP //0x0105
- #define KIT_PM_WM_SYSCHAR //0x0106
- #define KIT_PM_WM_SYSDEADCHAR //0x0107
- #define KIT_PM_WM_UNICHAR //0x0109
- #define KIT_PM_WM_IME_STARTCOMPOSITION //0x010D
- #define KIT_PM_WM_IME_ENDCOMPOSITION //0x010E
- #define KIT_PM_WM_IME_COMPOSITION //0x010F
- #define KIT_PM_WM_INITDIALOG //0x0110
- #define KIT_PM_WM_COMMAND //0x0111
- #define KIT_PM_WM_SYSCOMMAND //0x0112
- #define KIT_PM_WM_TIMER //0x0113
- #define KIT_PM_WM_HSCROLL //0x0114
- #define KIT_PM_WM_VSCROLL //0x0115
- #define KIT_PM_WM_INITMENU //0x0116
- #define KIT_PM_WM_INITMENUPOPUP //0x0117
- #define KIT_PM_WM_GESTURE //0x0119
- #define KIT_PM_WM_GESTURENOTIFY //0x011A
- #define KIT_PM_WM_MENUSELECT //0x011F
- #define KIT_PM_WM_MENUCHAR //0x0120
- #define KIT_PM_WM_ENTERIDLE //0x0121
- #define KIT_PM_WM_MENURBUTTONUP //0x0122
- #define KIT_PM_WM_MENUDRAG //0x0123
- #define KIT_PM_WM_MENUGETOBJECT //0x0124
- #define KIT_PM_WM_UNINITMENUPOPUP //0x0125
- #define KIT_PM_WM_MENUCOMMAND //0x0126
- #define KIT_PM_WM_CHANGEUISTATE //0x0127
- #define KIT_PM_WM_UPDATEUISTATE //0x0128
- #define KIT_PM_WM_QUERYUISTATE //0x0129
- #define KIT_PM_WM_CTLCOLORMSGBOX //0x0132
- #define KIT_PM_WM_CTLCOLOREDIT //0x0133
- #define KIT_PM_WM_CTLCOLORLISTBOX //0x0134
- #define KIT_PM_WM_CTLCOLORBTN //0x0135
- #define KIT_PM_WM_CTLCOLORDLG //0x0136
- #define KIT_PM_WM_CTLCOLORSCROLLBAR //0x0137
- #define KIT_PM_WM_CTLCOLORSTATIC //0x0138
- #define KIT_PM_MN_GETHMENU //0x01E1
- //#define KIT_PM_WM_MOUSEMOVE //0x0200
- #define KIT_PM_WM_LBUTTONDOWN //0x0201
- #define KIT_PM_WM_LBUTTONUP //0x0202
- #define KIT_PM_WM_LBUTTONDBLCLK //0x0203
- #define KIT_PM_WM_RBUTTONDOWN //0x0204
- #define KIT_PM_WM_RBUTTONUP //0x0205
- #define KIT_PM_WM_RBUTTONDBLCLK //0x0206
- #define KIT_PM_WM_MBUTTONDOWN //0x0207
- #define KIT_PM_WM_MBUTTONUP //0x0208
- #define KIT_PM_WM_MBUTTONDBLCLK //0x0209
- #define KIT_PM_WM_MOUSEWHEEL //0x020A
- #define KIT_PM_WM_XBUTTONDOWN //0x020B
- #define KIT_PM_WM_XBUTTONUP //0x020C
- #define KIT_PM_WM_XBUTTONDBLCLK //0x020D
- #define KIT_PM_WM_PARENTNOTIFY //0x0210
- #define KIT_PM_WM_ENTERMENULOOP //0x0211
- #define KIT_PM_WM_EXITMENULOOP //0x0212
- #define KIT_PM_WM_NEXTMENU //0x0213
- #define KIT_PM_WM_SIZING //0x0214
- #define KIT_PM_WM_CAPTURECHANGED //0x0215
- #define KIT_PM_WM_MOVING //0x0216
- #define KIT_PM_WM_POWERBROADCAST //0x0218
- #define KIT_PM_WM_DEVICECHANGE //0x0219
- #define KIT_PM_WM_MDICREATE //0x0220
- #define KIT_PM_WM_MDIDESTROY //0x0221
- #define KIT_PM_WM_MDIACTIVATE //0x0222
- #define KIT_PM_WM_MDIRESTORE //0x0223
- #define KIT_PM_WM_MDINEXT //0x0224
- #define KIT_PM_WM_MDIMAXIMIZE //0x0225
- #define KIT_PM_WM_MDITILE //0x0226
- #define KIT_PM_WM_MDICASCADE //0x0227
- #define KIT_PM_WM_MDIICONARRANGE //0x0228
- #define KIT_PM_WM_MDIGETACTIVE //0x0229
- #define KIT_PM_WM_MDISETMENU //0x0230
- #define KIT_PM_WM_ENTERSIZEMOVE //0x0231
- #define KIT_PM_WM_EXITSIZEMOVE //0x0232
- #define KIT_PM_WM_DROPFILES //0x0233
- #define KIT_PM_WM_MDIREFRESHMENU //0x0234
- #define KIT_PM_WM_POINTERDEVICECHANGE //0x0238
- #define KIT_PM_WM_POINTERDEVICEINRANGE //0x0239
- #define KIT_PM_WM_POINTERDEVICEOUTOFRANGE //0x023A
- #define KIT_PM_WM_TOUCH //0x0240
- #define KIT_PM_WM_NCPOINTERUPDATE //0x0241
- #define KIT_PM_WM_NCPOINTERDOWN //0x0242
- #define KIT_PM_WM_NCPOINTERUP //0x0243
- #define KIT_PM_WM_POINTERUPDATE //0x0245
- #define KIT_PM_WM_POINTERDOWN //0x0246
- #define KIT_PM_WM_POINTERUP //0x0247
- #define KIT_PM_WM_POINTERENTER //0x0249
- #define KIT_PM_WM_POINTERLEAVE //0x024A
- #define KIT_PM_WM_POINTERACTIVATE //0x024B
- #define KIT_PM_WM_POINTERCAPTURECHANGED //0x024C
- #define KIT_PM_WM_TOUCHHITTESTING //0x024D
- #define KIT_PM_WM_POINTERWHEEL //0x024E
- #define KIT_PM_WM_POINTERHWHEEL //0x024F
- #define KIT_PM_DM_POINTERHITTEST //0x0250
- #define KIT_PM_WM_POINTERROUTEDTO //0x0251
- #define KIT_PM_WM_POINTERROUTEDAWAY //0x0252
- #define KIT_PM_WM_POINTERROUTEDRELEASED //0x0253
- #define KIT_PM_WM_IME_SETCONTEXT //0x0281
- #define KIT_PM_WM_IME_NOTIFY //0x0282
- #define KIT_PM_WM_IME_CONTROL //0x0283
- #define KIT_PM_WM_IME_COMPOSITIONFULL //0x0284
- #define KIT_PM_WM_IME_SELECT //0x0285
- #define KIT_PM_WM_IME_CHAR //0x0286
- #define KIT_PM_WM_IME_REQUEST //0x0288
- #define KIT_PM_WM_IME_KEYDOWN //0x0290
- #define KIT_PM_WM_IME_KEYUP //0x0291
- #define KIT_PM_WM_MOUSEHOVER //0x02A1
- #define KIT_PM_WM_MOUSELEAVE //0x02A3
- #define KIT_PM_WM_NCMOUSEHOVER //0x02A0
- #define KIT_PM_WM_NCMOUSELEAVE //0x02A2
- #define KIT_PM_WM_WTSSESSION_CHANGE //0x02B1
- #define KIT_PM_WM_DPICHANGED //0x02E0
- #define KIT_PM_WM_DPICHANGED_BEFOREPARENT //0x02E2
- #define KIT_PM_WM_DPICHANGED_AFTERPARENT //0x02E3
- #define KIT_PM_WM_GETDPISCALEDSIZE //0x02E4
- #define KIT_PM_WM_CUT //0x0300
- #define KIT_PM_WM_COPY //0x0301
- #define KIT_PM_WM_PASTE //0x0302
- #define KIT_PM_WM_CLEAR //0x0303
- #define KIT_PM_WM_UNDO //0x0304
- #define KIT_PM_WM_RENDERFORMAT //0x0305
- #define KIT_PM_WM_RENDERALLFORMATS //0x0306
- #define KIT_PM_WM_DESTROYCLIPBOARD //0x0307
- #define KIT_PM_WM_DRAWCLIPBOARD //0x0308
- #define KIT_PM_WM_PAINTCLIPBOARD //0x0309
- #define KIT_PM_WM_VSCROLLCLIPBOARD //0x030A
- #define KIT_PM_WM_SIZECLIPBOARD //0x030B
- #define KIT_PM_WM_ASKCBFORMATNAME //0x030C
- #define KIT_PM_WM_CHANGECBCHAIN //0x030D
- #define KIT_PM_WM_HSCROLLCLIPBOARD //0x030E
- #define KIT_PM_WM_QUERYNEWPALETTE //0x030F
- #define KIT_PM_WM_PALETTEISCHANGING //0x0310
- #define KIT_PM_WM_PALETTECHANGED //0x0311
- #define KIT_PM_WM_HOTKEY //0x0312
- #define KIT_PM_WM_PRINT //0x0317
- #define KIT_PM_WM_PRINTCLIENT //0x0318
- #define KIT_PM_WM_APPCOMMAND //0x0319
- #define KIT_PM_WM_THEMECHANGED //0x031A
- #define KIT_PM_WM_CLIPBOARDUPDATE //0x031D
- #define KIT_PM_WM_DWMCOMPOSITIONCHANGED //0x031E
- #define KIT_PM_WM_DWMNCRENDERINGCHANGED //0x031F
- #define KIT_PM_WM_DWMCOLORIZATIONCOLORCHANGED //0x0320
- #define KIT_PM_WM_DWMWINDOWMAXIMIZEDCHANGE //0x0321
- #define KIT_PM_WM_DWMSENDICONICTHUMBNAIL //0x0323
- #define KIT_PM_WM_DWMSENDICONICLIVEPREVIEWBITMAP //0x0326
- #define KIT_PM_WM_GETTITLEBARINFOEX //0x033F
- //#define KIT_PM_WM_UNKNOWN //0x????
- #if defined(_DEBUG) //this function will do nothing otherwise
- static void printMessage(HWND hwnd, UINT message,
- WPARAM wParam, LPARAM lParam)
- {
- char* messageName = nullptr;
- switch(message){
- # ifdef KIT_PM_WM_NULL
- case WM_NULL : messageName = "WM_NULL"; break; //0x0000
- # endif
- # ifdef KIT_PM_WM_CREATE
- case WM_CREATE : messageName = "WM_CREATE"; break; //0x0001
- # endif
- # ifdef KIT_PM_WM_DESTROY
- case WM_DESTROY : messageName = "WM_DESTROY"; break; //0x0002
- # endif
- # ifdef KIT_PM_WM_MOVE
- case WM_MOVE : messageName = "WM_MOVE"; break; //0x0003
- # endif
- # ifdef KIT_PM_WM_SIZE
- case WM_SIZE : messageName = "WM_SIZE"; break; //0x0005
- # endif
- # ifdef KIT_PM_WM_ACTIVATE
- case WM_ACTIVATE : messageName = "WM_ACTIVATE"; break; //0x0006
- # endif
- # ifdef KIT_PM_WM_SETFOCUS
- case WM_SETFOCUS : messageName = "WM_SETFOCUS"; break; //0x0007
- # endif
- # ifdef KIT_PM_WM_KILLFOCUS
- case WM_KILLFOCUS : messageName = "WM_KILLFOCUS"; break; //0x0008
- # endif
- # ifdef KIT_PM_WM_ENABLE
- case WM_ENABLE : messageName = "WM_ENABLE"; break; //0x000A
- # endif
- # ifdef KIT_PM_WM_SETREDRAW
- case WM_SETREDRAW : messageName = "WM_SETREDRAW"; break; //0x000B
- # endif
- # ifdef KIT_PM_WM_SETTEXT
- case WM_SETTEXT : messageName = "WM_SETTEXT"; break; //0x000C
- # endif
- # ifdef KIT_PM_WM_GETTEXT
- case WM_GETTEXT : messageName = "WM_GETTEXT"; break; //0x000D
- # endif
- # ifdef KIT_PM_WM_GETTEXTLENGTH
- case WM_GETTEXTLENGTH : messageName = "WM_GETTEXTLENGTH"; break; //0x000E
- # endif
- # ifdef KIT_PM_WM_PAINT
- case WM_PAINT : messageName = "WM_PAINT"; break; //0x000F
- # endif
- # ifdef KIT_PM_WM_CLOSE
- case WM_CLOSE : messageName = "WM_CLOSE"; break; //0x0010
- # endif
- # ifdef KIT_PM_WM_QUERYENDSESSION
- case WM_QUERYENDSESSION : messageName = "WM_QUERYENDSESSION"; break; //0x0011
- # endif
- # ifdef KIT_PM_WM_QUIT
- case WM_QUIT : messageName = "WM_QUIT"; break; //0x0012
- # endif
- # ifdef KIT_PM_WM_QUERYOPEN
- case WM_QUERYOPEN : messageName = "WM_QUERYOPEN"; break; //0x0013
- # endif
- # ifdef KIT_PM_WM_ERASEBKGND
- case WM_ERASEBKGND : messageName = "WM_ERASEBKGND"; break; //0x0014
- # endif
- # ifdef KIT_PM_WM_SYSCOLORCHANGE
- case WM_SYSCOLORCHANGE : messageName = "WM_SYSCOLORCHANGE"; break; //0x0015
- # endif
- # ifdef KIT_PM_WM_ENDSESSION
- case WM_ENDSESSION : messageName = "WM_ENDSESSION"; break; //0x0016
- # endif
- # ifdef KIT_PM_WM_SHOWWINDOW
- case WM_SHOWWINDOW : messageName = "WM_SHOWWINDOW"; break; //0x0018
- # endif
- # ifdef KIT_PM_WM_SETTINGCHANGE
- case WM_SETTINGCHANGE : messageName = "WM_SETTINGCHANGE"; break; //0x001A
- # endif
- # ifdef KIT_PM_WM_DEVMODECHANGE
- case WM_DEVMODECHANGE : messageName = "WM_DEVMODECHANGE"; break; //0x001B
- # endif
- # ifdef KIT_PM_WM_ACTIVATEAPP
- case WM_ACTIVATEAPP : messageName = "WM_ACTIVATEAPP"; break; //0x001C
- # endif
- # ifdef KIT_PM_WM_FONTCHANGE
- case WM_FONTCHANGE : messageName = "WM_FONTCHANGE"; break; //0x001D
- # endif
- # ifdef KIT_PM_WM_TIMECHANGE
- case WM_TIMECHANGE : messageName = "WM_TIMECHANGE"; break; //0x001E
- # endif
- # ifdef KIT_PM_WM_CANCELMODE
- case WM_CANCELMODE : messageName = "WM_CANCELMODE"; break; //0x001F
- # endif
- # ifdef KIT_PM_WM_SETCURSOR
- case WM_SETCURSOR : messageName = "WM_SETCURSOR"; break; //0x0020
- # endif
- # ifdef KIT_PM_WM_MOUSEACTIVATE
- case WM_MOUSEACTIVATE : messageName = "WM_MOUSEACTIVATE"; break; //0x0021
- # endif
- # ifdef KIT_PM_WM_CHILDACTIVATE
- case WM_CHILDACTIVATE : messageName = "WM_CHILDACTIVATE"; break; //0x0022
- # endif
- # ifdef KIT_PM_WM_QUEUESYNC
- case WM_QUEUESYNC : messageName = "WM_QUEUESYNC"; break; //0x0023
- # endif
- # ifdef KIT_PM_WM_GETMINMAXINFO
- case WM_GETMINMAXINFO : messageName = "WM_GETMINMAXINFO"; break; //0x0024
- # endif
- # ifdef KIT_PM_WM_PAINTICON
- case WM_PAINTICON : messageName = "WM_PAINTICON"; break; //0x0026
- # endif
- # ifdef KIT_PM_WM_ICONERASEBKGND
- case WM_ICONERASEBKGND : messageName = "WM_ICONERASEBKGND"; break; //0x0027
- # endif
- # ifdef KIT_PM_WM_NEXTDLGCTL
- case WM_NEXTDLGCTL : messageName = "WM_NEXTDLGCTL"; break; //0x0028
- # endif
- # ifdef KIT_PM_WM_SPOOLERSTATUS
- case WM_SPOOLERSTATUS : messageName = "WM_SPOOLERSTATUS"; break; //0x002A
- # endif
- # ifdef KIT_PM_WM_DRAWITEM
- case WM_DRAWITEM : messageName = "WM_DRAWITEM"; break; //0x002B
- # endif
- # ifdef KIT_PM_WM_MEASUREITEM
- case WM_MEASUREITEM : messageName = "WM_MEASUREITEM"; break; //0x002C
- # endif
- # ifdef KIT_PM_WM_DELETEITEM
- case WM_DELETEITEM : messageName = "WM_DELETEITEM"; break; //0x002D
- # endif
- # ifdef KIT_PM_WM_VKEYTOITEM
- case WM_VKEYTOITEM : messageName = "WM_VKEYTOITEM"; break; //0x002E
- # endif
- # ifdef KIT_PM_WM_CHARTOITEM
- case WM_CHARTOITEM : messageName = "WM_CHARTOITEM"; break; //0x002F
- # endif
- # ifdef KIT_PM_WM_SETFONT
- case WM_SETFONT : messageName = "WM_SETFONT"; break; //0x0030
- # endif
- # ifdef KIT_PM_WM_GETFONT
- case WM_GETFONT : messageName = "WM_GETFONT"; break; //0x0031
- # endif
- # ifdef KIT_PM_WM_SETHOTKEY
- case WM_SETHOTKEY : messageName = "WM_SETHOTKEY"; break; //0x0032
- # endif
- # ifdef KIT_PM_WM_GETHOTKEY
- case WM_GETHOTKEY : messageName = "WM_GETHOTKEY"; break; //0x0033
- # endif
- # ifdef KIT_PM_WM_QUERYDRAGICON
- case WM_QUERYDRAGICON : messageName = "WM_QUERYDRAGICON"; break; //0x0037
- # endif
- # ifdef KIT_PM_WM_COMPAREITEM
- case WM_COMPAREITEM : messageName = "WM_COMPAREITEM"; break; //0x0039
- # endif
- #if(WINVER >= 0x0500)
- #ifndef _WIN32_WCE
- # ifdef KIT_PM_WM_GETOBJECT
- case WM_GETOBJECT : messageName = "WM_GETOBJECT"; break; //0x003D
- # endif
- #endif
- #endif /* WINVER >= 0x0500 */
- # ifdef KIT_PM_WM_COMPACTING
- case WM_COMPACTING : messageName = "WM_COMPACTING"; break; //0x0041
- # endif
- # ifdef KIT_PM_WM_COMMNOTIFY
- case WM_COMMNOTIFY : messageName = "WM_COMMNOTIFY"; break; //0x0044
- # endif
- # ifdef KIT_PM_WM_WINDOWPOSCHANGING
- case WM_WINDOWPOSCHANGING : messageName = "WM_WINDOWPOSCHANGING"; break; //0x0046
- # endif
- # ifdef KIT_PM_WM_WINDOWPOSCHANGED
- case WM_WINDOWPOSCHANGED : messageName = "WM_WINDOWPOSCHANGED"; break; //0x0047
- # endif
- # ifdef KIT_PM_WM_POWER
- case WM_POWER : messageName = "WM_POWER"; break; //0x0048
- # endif
- # ifdef KIT_PM_WM_COPYDATA
- case WM_COPYDATA : messageName = "WM_COPYDATA"; break; //0x004A
- # endif
- # ifdef KIT_PM_WM_CANCELJOURNAL
- case WM_CANCELJOURNAL : messageName = "WM_CANCELJOURNAL"; break; //0x004B
- # endif
- #if(WINVER >= 0x0400)
- # ifdef KIT_PM_WM_NOTIFY
- case WM_NOTIFY : messageName = "WM_NOTIFY"; break; //0x004E
- # endif
- # ifdef KIT_PM_WM_INPUTLANGCHANGEREQUEST
- case WM_INPUTLANGCHANGEREQUEST : messageName = "WM_INPUTLANGCHANGEREQUEST"; break; //0x0050
- # endif
- # ifdef KIT_PM_WM_INPUTLANGCHANGE
- case WM_INPUTLANGCHANGE : messageName = "WM_INPUTLANGCHANGE"; break; //0x0051
- # endif
- # ifdef KIT_PM_WM_TCARD
- case WM_TCARD : messageName = "WM_TCARD"; break; //0x0052
- # endif
- # ifdef KIT_PM_WM_HELP
- case WM_HELP : messageName = "WM_HELP"; break; //0x0053
- # endif
- # ifdef KIT_PM_WM_USERCHANGED
- case WM_USERCHANGED : messageName = "WM_USERCHANGED"; break; //0x0054
- # endif
- # ifdef KIT_PM_WM_NOTIFYFORMAT
- case WM_NOTIFYFORMAT : messageName = "WM_NOTIFYFORMAT"; break; //0x0055
- # endif
- # ifdef KIT_PM_WM_CONTEXTMENU
- case WM_CONTEXTMENU : messageName = "WM_CONTEXTMENU"; break; //0x007B
- # endif
- # ifdef KIT_PM_WM_STYLECHANGING
- case WM_STYLECHANGING : messageName = "WM_STYLECHANGING"; break; //0x007C
- # endif
- # ifdef KIT_PM_WM_STYLECHANGED
- case WM_STYLECHANGED : messageName = "WM_STYLECHANGED"; break; //0x007D
- # endif
- # ifdef KIT_PM_WM_DISPLAYCHANGE
- case WM_DISPLAYCHANGE : messageName = "WM_DISPLAYCHANGE"; break; //0x007E
- # endif
- # ifdef KIT_PM_WM_GETICON
- case WM_GETICON : messageName = "WM_GETICON"; break; //0x007F
- # endif
- # ifdef KIT_PM_WM_SETICON
- case WM_SETICON : messageName = "WM_SETICON"; break; //0x0080
- # endif
- #endif /* WINVER >= 0x0400 */
- # ifdef KIT_PM_WM_NCCREATE
- case WM_NCCREATE : messageName = "WM_NCCREATE"; break; //0x0081
- # endif
- # ifdef KIT_PM_WM_NCDESTROY
- case WM_NCDESTROY : messageName = "WM_NCDESTROY"; break; //0x0082
- # endif
- # ifdef KIT_PM_WM_NCCALCSIZE
- case WM_NCCALCSIZE : messageName = "WM_NCCALCSIZE"; break; //0x0083
- # endif
- # ifdef KIT_PM_WM_NCHITTEST
- case WM_NCHITTEST : messageName = "WM_NCHITTEST"; break; //0x0084
- # endif
- # ifdef KIT_PM_WM_NCPAINT
- case WM_NCPAINT : messageName = "WM_NCPAINT"; break; //0x0085
- # endif
- # ifdef KIT_PM_WM_NCACTIVATE
- case WM_NCACTIVATE : messageName = "WM_NCACTIVATE"; break; //0x0086
- # endif
- # ifdef KIT_PM_WM_GETDLGCODE
- case WM_GETDLGCODE : messageName = "WM_GETDLGCODE"; break; //0x0087
- # endif
- #ifndef _WIN32_WCE
- # ifdef KIT_PM_WM_SYNCPAINT
- case WM_SYNCPAINT : messageName = "WM_SYNCPAINT"; break; //0x0088
- # endif
- #endif
- # ifdef KIT_PM_WM_NCMOUSEMOVE
- case WM_NCMOUSEMOVE : messageName = "WM_NCMOUSEMOVE"; break; //0x00A0
- # endif
- # ifdef KIT_PM_WM_NCLBUTTONDOWN
- case WM_NCLBUTTONDOWN : messageName = "WM_NCLBUTTONDOWN"; break; //0x00A1
- # endif
- # ifdef KIT_PM_WM_NCLBUTTONUP
- case WM_NCLBUTTONUP : messageName = "WM_NCLBUTTONUP"; break; //0x00A2
- # endif
- # ifdef KIT_PM_WM_NCLBUTTONDBLCLK
- case WM_NCLBUTTONDBLCLK : messageName = "WM_NCLBUTTONDBLCLK"; break; //0x00A3
- # endif
- # ifdef KIT_PM_WM_NCRBUTTONDOWN
- case WM_NCRBUTTONDOWN : messageName = "WM_NCRBUTTONDOWN"; break; //0x00A4
- # endif
- # ifdef KIT_PM_WM_NCRBUTTONUP
- case WM_NCRBUTTONUP : messageName = "WM_NCRBUTTONUP"; break; //0x00A5
- # endif
- # ifdef KIT_PM_WM_NCRBUTTONDBLCLK
- case WM_NCRBUTTONDBLCLK : messageName = "WM_NCRBUTTONDBLCLK"; break; //0x00A6
- # endif
- # ifdef KIT_PM_WM_NCMBUTTONDOWN
- case WM_NCMBUTTONDOWN : messageName = "WM_NCMBUTTONDOWN"; break; //0x00A7
- # endif
- # ifdef KIT_PM_WM_NCMBUTTONUP
- case WM_NCMBUTTONUP : messageName = "WM_NCMBUTTONUP"; break; //0x00A8
- # endif
- # ifdef KIT_PM_WM_NCMBUTTONDBLCLK
- case WM_NCMBUTTONDBLCLK : messageName = "WM_NCMBUTTONDBLCLK"; break; //0x00A9
- # endif
- #if(_WIN32_WINNT >= 0x0500)
- # ifdef KIT_PM_WM_NCXBUTTONDOWN
- case WM_NCXBUTTONDOWN : messageName = "WM_NCXBUTTONDOWN"; break; //0x00AB
- # endif
- # ifdef KIT_PM_WM_NCXBUTTONUP
- case WM_NCXBUTTONUP : messageName = "WM_NCXBUTTONUP"; break; //0x00AC
- # endif
- # ifdef KIT_PM_WM_NCXBUTTONDBLCLK
- case WM_NCXBUTTONDBLCLK : messageName = "WM_NCXBUTTONDBLCLK"; break; //0x00AD
- # endif
- #endif /* _WIN32_WINNT >= 0x0500 */
- #if(_WIN32_WINNT >= 0x0501)
- # ifdef KIT_PM_WM_INPUT_DEVICE_CHANGE
- case WM_INPUT_DEVICE_CHANGE : messageName = "WM_INPUT_DEVICE_CHANGE"; break; //0x00FE
- # endif
- # ifdef KIT_PM_WM_INPUT
- case WM_INPUT : messageName = "WM_INPUT"; break; //0x00FF
- # endif
- #endif /* _WIN32_WINNT >= 0x0501 */
- # ifdef KIT_PM_WM_KEYDOWN
- case WM_KEYDOWN : messageName = "WM_KEYDOWN"; break; //0x0100
- # endif
- # ifdef KIT_PM_WM_KEYUP
- case WM_KEYUP : messageName = "WM_KEYUP"; break; //0x0101
- # endif
- # ifdef KIT_PM_WM_CHAR
- case WM_CHAR : messageName = "WM_CHAR"; break; //0x0102
- # endif
- # ifdef KIT_PM_WM_DEADCHAR
- case WM_DEADCHAR : messageName = "WM_DEADCHAR"; break; //0x0103
- # endif
- # ifdef KIT_PM_WM_SYSKEYDOWN
- case WM_SYSKEYDOWN : messageName = "WM_SYSKEYDOWN"; break; //0x0104
- # endif
- # ifdef KIT_PM_WM_SYSKEYUP
- case WM_SYSKEYUP : messageName = "WM_SYSKEYUP"; break; //0x0105
- # endif
- # ifdef KIT_PM_WM_SYSCHAR
- case WM_SYSCHAR : messageName = "WM_SYSCHAR"; break; //0x0106
- # endif
- # ifdef KIT_PM_WM_SYSDEADCHAR
- case WM_SYSDEADCHAR : messageName = "WM_SYSDEADCHAR"; break; //0x0107
- # endif
- #if(_WIN32_WINNT >= 0x0501)
- # ifdef KIT_PM_WM_UNICHAR
- case WM_UNICHAR : messageName = "WM_UNICHAR"; break; //0x0109
- # endif
- #endif /* _WIN32_WINNT >= 0x0501 */
- #if(WINVER >= 0x0400)
- # ifdef KIT_PM_WM_IME_STARTCOMPOSITION
- case WM_IME_STARTCOMPOSITION : messageName = "WM_IME_STARTCOMPOSITION"; break; //0x010D
- # endif
- # ifdef KIT_PM_WM_IME_ENDCOMPOSITION
- case WM_IME_ENDCOMPOSITION : messageName = "WM_IME_ENDCOMPOSITION"; break; //0x010E
- # endif
- # ifdef KIT_PM_WM_IME_COMPOSITION
- case WM_IME_COMPOSITION : messageName = "WM_IME_COMPOSITION"; break; //0x010F
- # endif
- #endif /* WINVER >= 0x0400 */
- # ifdef KIT_PM_WM_INITDIALOG
- case WM_INITDIALOG : messageName = "WM_INITDIALOG"; break; //0x0110
- # endif
- # ifdef KIT_PM_WM_COMMAND
- case WM_COMMAND : messageName = "WM_COMMAND"; break; //0x0111
- # endif
- # ifdef KIT_PM_WM_SYSCOMMAND
- case WM_SYSCOMMAND : messageName = "WM_SYSCOMMAND"; break; //0x0112
- # endif
- # ifdef KIT_PM_WM_TIMER
- case WM_TIMER : messageName = "WM_TIMER"; break; //0x0113
- # endif
- # ifdef KIT_PM_WM_HSCROLL
- case WM_HSCROLL : messageName = "WM_HSCROLL"; break; //0x0114
- # endif
- # ifdef KIT_PM_WM_VSCROLL
- case WM_VSCROLL : messageName = "WM_VSCROLL"; break; //0x0115
- # endif
- # ifdef KIT_PM_WM_INITMENU
- case WM_INITMENU : messageName = "WM_INITMENU"; break; //0x0116
- # endif
- # ifdef KIT_PM_WM_INITMENUPOPUP
- case WM_INITMENUPOPUP : messageName = "WM_INITMENUPOPUP"; break; //0x0117
- # endif
- #if(WINVER >= 0x0601)
- # ifdef KIT_PM_WM_GESTURE
- case WM_GESTURE : messageName = "WM_GESTURE"; break; //0x0119
- # endif
- # ifdef KIT_PM_WM_GESTURENOTIFY
- case WM_GESTURENOTIFY : messageName = "WM_GESTURENOTIFY"; break; //0x011A
- # endif
- #endif /* WINVER >= 0x0601 */
- # ifdef KIT_PM_WM_MENUSELECT
- case WM_MENUSELECT : messageName = "WM_MENUSELECT"; break; //0x011F
- # endif
- # ifdef KIT_PM_WM_MENUCHAR
- case WM_MENUCHAR : messageName = "WM_MENUCHAR"; break; //0x0120
- # endif
- # ifdef KIT_PM_WM_ENTERIDLE
- case WM_ENTERIDLE : messageName = "WM_ENTERIDLE"; break; //0x0121
- # endif
- /* WHY IS THIS SET UP THIS WAY! */
- #if(WINVER >= 0x0500)
- #ifndef _WIN32_WCE
- # ifdef KIT_PM_WM_MENURBUTTONUP
- case WM_MENURBUTTONUP : messageName = "WM_MENURBUTTONUP"; break; //0x0122
- # endif
- # ifdef KIT_PM_WM_MENUDRAG
- case WM_MENUDRAG : messageName = "WM_MENUDRAG"; break; //0x0123
- # endif
- # ifdef KIT_PM_WM_MENUGETOBJECT
- case WM_MENUGETOBJECT : messageName = "WM_MENUGETOBJECT"; break; //0x0124
- # endif
- # ifdef KIT_PM_WM_UNINITMENUPOPUP
- case WM_UNINITMENUPOPUP : messageName = "WM_UNINITMENUPOPUP"; break; //0x0125
- # endif
- # ifdef KIT_PM_WM_MENUCOMMAND
- case WM_MENUCOMMAND : messageName = "WM_MENUCOMMAND"; break; //0x0126
- # endif
- #ifndef _WIN32_WCE
- #if(_WIN32_WINNT >= 0x0500)
- # ifdef KIT_PM_WM_CHANGEUISTATE
- case WM_CHANGEUISTATE : messageName = "WM_CHANGEUISTATE"; break; //0x0127
- # endif
- # ifdef KIT_PM_WM_UPDATEUISTATE
- case WM_UPDATEUISTATE : messageName = "WM_UPDATEUISTATE"; break; //0x0128
- # endif
- # ifdef KIT_PM_WM_QUERYUISTATE
- case WM_QUERYUISTATE : messageName = "WM_QUERYUISTATE"; break; //0x0129
- # endif
- #endif /* _WIN32_WINNT >= 0x0500 */
- #endif
- #endif
- #endif /* WINVER >= 0x0500 */
- /* WHY IS THIS SET UP THIS WAY! */
- # ifdef KIT_PM_WM_CTLCOLORMSGBOX
- case WM_CTLCOLORMSGBOX : messageName = "WM_CTLCOLORMSGBOX"; break; //0x0132
- # endif
- # ifdef KIT_PM_WM_CTLCOLOREDIT
- case WM_CTLCOLOREDIT : messageName = "WM_CTLCOLOREDIT"; break; //0x0133
- # endif
- # ifdef KIT_PM_WM_CTLCOLORLISTBOX
- case WM_CTLCOLORLISTBOX : messageName = "WM_CTLCOLORLISTBOX"; break; //0x0134
- # endif
- # ifdef KIT_PM_WM_CTLCOLORBTN
- case WM_CTLCOLORBTN : messageName = "WM_CTLCOLORBTN"; break; //0x0135
- # endif
- # ifdef KIT_PM_WM_CTLCOLORDLG
- case WM_CTLCOLORDLG : messageName = "WM_CTLCOLORDLG"; break; //0x0136
- # endif
- # ifdef KIT_PM_WM_CTLCOLORSCROLLBAR
- case WM_CTLCOLORSCROLLBAR : messageName = "WM_CTLCOLORSCROLLBAR"; break; //0x0137
- # endif
- # ifdef KIT_PM_WM_CTLCOLORSTATIC
- case WM_CTLCOLORSTATIC : messageName = "WM_CTLCOLORSTATIC"; break; //0x0138
- # endif
- # ifdef KIT_PM_MN_GETHMENU
- case MN_GETHMENU : messageName = "MN_GETHMENU"; break; //0x01E1
- # endif
- # ifdef KIT_PM_WM_MOUSEMOVE
- case WM_MOUSEMOVE : messageName = "WM_MOUSEMOVE"; break; //0x0200
- # endif
- # ifdef KIT_PM_WM_LBUTTONDOWN
- case WM_LBUTTONDOWN : messageName = "WM_LBUTTONDOWN"; break; //0x0201
- # endif
- # ifdef KIT_PM_WM_LBUTTONUP
- case WM_LBUTTONUP : messageName = "WM_LBUTTONUP"; break; //0x0202
- # endif
- # ifdef KIT_PM_WM_LBUTTONDBLCLK
- case WM_LBUTTONDBLCLK : messageName = "WM_LBUTTONDBLCLK"; break; //0x0203
- # endif
- # ifdef KIT_PM_WM_RBUTTONDOWN
- case WM_RBUTTONDOWN : messageName = "WM_RBUTTONDOWN"; break; //0x0204
- # endif
- # ifdef KIT_PM_WM_RBUTTONUP
- case WM_RBUTTONUP : messageName = "WM_RBUTTONUP"; break; //0x0205
- # endif
- # ifdef KIT_PM_WM_RBUTTONDBLCLK
- case WM_RBUTTONDBLCLK : messageName = "WM_RBUTTONDBLCLK"; break; //0x0206
- # endif
- # ifdef KIT_PM_WM_MBUTTONDOWN
- case WM_MBUTTONDOWN : messageName = "WM_MBUTTONDOWN"; break; //0x0207
- # endif
- # ifdef KIT_PM_WM_MBUTTONUP
- case WM_MBUTTONUP : messageName = "WM_MBUTTONUP"; break; //0x0208
- # endif
- # ifdef KIT_PM_WM_MBUTTONDBLCLK
- case WM_MBUTTONDBLCLK : messageName = "WM_MBUTTONDBLCLK"; break; //0x0209
- # endif
- #if (_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)
- # ifdef KIT_PM_WM_MOUSEWHEEL
- case WM_MOUSEWHEEL : messageName = "WM_MOUSEWHEEL"; break; //0x020A
- # endif
- #endif
- #if (_WIN32_WINNT >= 0x0500)
- # ifdef KIT_PM_WM_XBUTTONDOWN
- case WM_XBUTTONDOWN : messageName = "WM_XBUTTONDOWN"; break; //0x020B
- # endif
- # ifdef KIT_PM_WM_XBUTTONUP
- case WM_XBUTTONUP : messageName = "WM_XBUTTONUP"; break; //0x020C
- # endif
- # ifdef KIT_PM_WM_XBUTTONDBLCLK
- case WM_XBUTTONDBLCLK : messageName = "WM_XBUTTONDBLCLK"; break; //0x020D
- # endif
- #endif
- # ifdef KIT_PM_WM_PARENTNOTIFY
- case WM_PARENTNOTIFY : messageName = "WM_PARENTNOTIFY"; break; //0x0210
- # endif
- # ifdef KIT_PM_WM_ENTERMENULOOP
- case WM_ENTERMENULOOP : messageName = "WM_ENTERMENULOOP"; break; //0x0211
- # endif
- # ifdef KIT_PM_WM_EXITMENULOOP
- case WM_EXITMENULOOP : messageName = "WM_EXITMENULOOP"; break; //0x0212
- # endif
- #if(WINVER >= 0x0400)
- # ifdef KIT_PM_WM_NEXTMENU
- case WM_NEXTMENU : messageName = "WM_NEXTMENU"; break; //0x0213
- # endif
- # ifdef KIT_PM_WM_SIZING
- case WM_SIZING : messageName = "WM_SIZING"; break; //0x0214
- # endif
- # ifdef KIT_PM_WM_CAPTURECHANGED
- case WM_CAPTURECHANGED : messageName = "WM_CAPTURECHANGED"; break; //0x0215
- # endif
- # ifdef KIT_PM_WM_MOVING
- case WM_MOVING : messageName = "WM_MOVING"; break; //0x0216
- # endif
- # ifdef KIT_PM_WM_POWERBROADCAST
- case WM_POWERBROADCAST : messageName = "WM_POWERBROADCAST"; break; //0x0218
- # endif
- # ifdef KIT_PM_WM_DEVICECHANGE
- case WM_DEVICECHANGE : messageName = "WM_DEVICECHANGE"; break; //0x0219
- # endif
- #endif /* WINVER >= 0x0400 */
- # ifdef KIT_PM_WM_MDICREATE
- case WM_MDICREATE : messageName = "WM_MDICREATE"; break; //0x0220
- # endif
- # ifdef KIT_PM_WM_MDIDESTROY
- case WM_MDIDESTROY : messageName = "WM_MDIDESTROY"; break; //0x0221
- # endif
- # ifdef KIT_PM_WM_MDIACTIVATE
- case WM_MDIACTIVATE : messageName = "WM_MDIACTIVATE"; break; //0x0222
- # endif
- # ifdef KIT_PM_WM_MDIRESTORE
- case WM_MDIRESTORE : messageName = "WM_MDIRESTORE"; break; //0x0223
- # endif
- # ifdef KIT_PM_WM_MDINEXT
- case WM_MDINEXT : messageName = "WM_MDINEXT"; break; //0x0224
- # endif
- # ifdef KIT_PM_WM_MDIMAXIMIZE
- case WM_MDIMAXIMIZE : messageName = "WM_MDIMAXIMIZE"; break; //0x0225
- # endif
- # ifdef KIT_PM_WM_MDITILE
- case WM_MDITILE : messageName = "WM_MDITILE"; break; //0x0226
- # endif
- # ifdef KIT_PM_WM_MDICASCADE
- case WM_MDICASCADE : messageName = "WM_MDICASCADE"; break; //0x0227
- # endif
- # ifdef KIT_PM_WM_MDIICONARRANGE
- case WM_MDIICONARRANGE : messageName = "WM_MDIICONARRANGE"; break; //0x0228
- # endif
- # ifdef KIT_PM_WM_MDIGETACTIVE
- case WM_MDIGETACTIVE : messageName = "WM_MDIGETACTIVE"; break; //0x0229
- # endif
- # ifdef KIT_PM_WM_MDISETMENU
- case WM_MDISETMENU : messageName = "WM_MDISETMENU"; break; //0x0230
- # endif
- # ifdef KIT_PM_WM_ENTERSIZEMOVE
- case WM_ENTERSIZEMOVE : messageName = "WM_ENTERSIZEMOVE"; break; //0x0231
- # endif
- # ifdef KIT_PM_WM_EXITSIZEMOVE
- case WM_EXITSIZEMOVE : messageName = "WM_EXITSIZEMOVE"; break; //0x0232
- # endif
- # ifdef KIT_PM_WM_DROPFILES
- case WM_DROPFILES : messageName = "WM_DROPFILES"; break; //0x0233
- # endif
- # ifdef KIT_PM_WM_MDIREFRESHMENU
- case WM_MDIREFRESHMENU : messageName = "WM_MDIREFRESHMENU"; break; //0x0234
- # endif
- #if(WINVER >= 0x0602)
- # ifdef KIT_PM_WM_POINTERDEVICECHANGE
- case WM_POINTERDEVICECHANGE : messageName = "WM_POINTERDEVICECHANGE"; break; //0x0238
- # endif
- # ifdef KIT_PM_WM_POINTERDEVICEINRANGE
- case WM_POINTERDEVICEINRANGE : messageName = "WM_POINTERDEVICEINRANGE"; break; //0x0239
- # endif
- # ifdef KIT_PM_WM_POINTERDEVICEOUTOFRANGE
- case WM_POINTERDEVICEOUTOFRANGE : messageName = "WM_POINTERDEVICEOUTOFRANGE"; break; //0x023A
- # endif
- #endif /* WINVER >= 0x0602 */
- #if(WINVER >= 0x0601)
- # ifdef KIT_PM_WM_TOUCH
- case WM_TOUCH : messageName = "WM_TOUCH"; break; //0x0240
- # endif
- #endif /* WINVER >= 0x0601 */
- #if(WINVER >= 0x0602)
- # ifdef KIT_PM_WM_NCPOINTERUPDATE
- case WM_NCPOINTERUPDATE : messageName = "WM_NCPOINTERUPDATE"; break; //0x0241
- # endif
- # ifdef KIT_PM_WM_NCPOINTERDOWN
- case WM_NCPOINTERDOWN : messageName = "WM_NCPOINTERDOWN"; break; //0x0242
- # endif
- # ifdef KIT_PM_WM_NCPOINTERUP
- case WM_NCPOINTERUP : messageName = "WM_NCPOINTERUP"; break; //0x0243
- # endif
- # ifdef KIT_PM_WM_POINTERUPDATE
- case WM_POINTERUPDATE : messageName = "WM_POINTERUPDATE"; break; //0x0245
- # endif
- # ifdef KIT_PM_WM_POINTERDOWN
- case WM_POINTERDOWN : messageName = "WM_POINTERDOWN"; break; //0x0246
- # endif
- # ifdef KIT_PM_WM_POINTERUP
- case WM_POINTERUP : messageName = "WM_POINTERUP"; break; //0x0247
- # endif
- # ifdef KIT_PM_WM_POINTERENTER
- case WM_POINTERENTER : messageName = "WM_POINTERENTER"; break; //0x0249
- # endif
- # ifdef KIT_PM_WM_POINTERLEAVE
- case WM_POINTERLEAVE : messageName = "WM_POINTERLEAVE"; break; //0x024A
- # endif
- # ifdef KIT_PM_WM_POINTERACTIVATE
- case WM_POINTERACTIVATE : messageName = "WM_POINTERACTIVATE"; break; //0x024B
- # endif
- # ifdef KIT_PM_WM_POINTERCAPTURECHANGED
- case WM_POINTERCAPTURECHANGED : messageName = "WM_POINTERCAPTURECHANGED"; break; //0x024C
- # endif
- # ifdef KIT_PM_WM_TOUCHHITTESTING
- case WM_TOUCHHITTESTING : messageName = "WM_TOUCHHITTESTING"; break; //0x024D
- # endif
- # ifdef KIT_PM_WM_POINTERWHEEL
- case WM_POINTERWHEEL : messageName = "WM_POINTERWHEEL"; break; //0x024E
- # endif
- # ifdef KIT_PM_WM_POINTERHWHEEL
- case WM_POINTERHWHEEL : messageName = "WM_POINTERHWHEEL"; break; //0x024F
- # endif
- # ifdef KIT_PM_DM_POINTERHITTEST
- case DM_POINTERHITTEST : messageName = "DM_POINTERHITTEST"; break; //0x0250
- # endif
- # ifdef KIT_PM_WM_POINTERROUTEDTO
- case WM_POINTERROUTEDTO : messageName = "WM_POINTERROUTEDTO"; break; //0x0251
- # endif
- # ifdef KIT_PM_WM_POINTERROUTEDAWAY
- case WM_POINTERROUTEDAWAY : messageName = "WM_POINTERROUTEDAWAY"; break; //0x0252
- # endif
- # ifdef KIT_PM_WM_POINTERROUTEDRELEASED2
- case WM_POINTERROUTEDRELEASED : messageName = "WM_POINTERROUTEDRELEASED"; break; //0x0253
- # endif
- #endif /* WINVER >= 0x0602 */
- #if(WINVER >= 0x0400)
- # ifdef KIT_PM_WM_IME_SETCONTEXT
- case WM_IME_SETCONTEXT : messageName = "WM_IME_SETCONTEXT"; break; //0x0281
- # endif
- # ifdef KIT_PM_WM_IME_NOTIFY
- case WM_IME_NOTIFY : messageName = "WM_IME_NOTIFY"; break; //0x0282
- # endif
- # ifdef KIT_PM_WM_IME_CONTROL
- case WM_IME_CONTROL : messageName = "WM_IME_CONTROL"; break; //0x0283
- # endif
- # ifdef KIT_PM_WM_IME_COMPOSITIONFULL
- case WM_IME_COMPOSITIONFULL : messageName = "WM_IME_COMPOSITIONFULL"; break; //0x0284
- # endif
- # ifdef KIT_PM_WM_IME_SELECT
- case WM_IME_SELECT : messageName = "WM_IME_SELECT"; break; //0x0285
- # endif
- # ifdef KIT_PM_WM_IME_CHAR
- case WM_IME_CHAR : messageName = "WM_IME_CHAR"; break; //0x0286
- # endif
- #endif /* WINVER >= 0x0400 */
- #if(WINVER >= 0x0500)
- # ifdef KIT_PM_WM_IME_REQUEST
- case WM_IME_REQUEST : messageName = "WM_IME_REQUEST"; break; //0x0288
- # endif
- #endif /* WINVER >= 0x0500 */
- #if(WINVER >= 0x0400)
- # ifdef KIT_PM_WM_IME_KEYDOWN
- case WM_IME_KEYDOWN : messageName = "WM_IME_KEYDOWN"; break; //0x0290
- # endif
- # ifdef KIT_PM_WM_IME_KEYUP
- case WM_IME_KEYUP : messageName = "WM_IME_KEYUP"; break; //0x0291
- # endif
- #endif /* WINVER >= 0x0400 */
- #if((_WIN32_WINNT >= 0x0400) || (WINVER >= 0x0500))
- # ifdef KIT_PM_WM_MOUSEHOVER
- case WM_MOUSEHOVER : messageName = "WM_MOUSEHOVER"; break; //0x02A1
- # endif
- # ifdef KIT_PM_WM_MOUSELEAVE
- case WM_MOUSELEAVE : messageName = "WM_MOUSELEAVE"; break; //0x02A3
- # endif
- #endif
- #if(WINVER >= 0x0500)
- # ifdef KIT_PM_WM_NCMOUSEHOVER
- case WM_NCMOUSEHOVER : messageName = "WM_NCMOUSEHOVER"; break; //0x02A0
- # endif
- # ifdef KIT_PM_WM_NCMOUSELEAVE
- case WM_NCMOUSELEAVE : messageName = "WM_NCMOUSELEAVE"; break; //0x02A2
- # endif
- #endif /* WINVER >= 0x0500 */
- #if(_WIN32_WINNT >= 0x0501)
- # ifdef KIT_PM_WM_WTSSESSION_CHANGE
- case WM_WTSSESSION_CHANGE : messageName = "WM_WTSSESSION_CHANGE"; break; //0x02B1
- # endif
- #endif /* _WIN32_WINNT >= 0x0501 */
- #if(WINVER >= 0x0601)
- # ifdef KIT_PM_WM_DPICHANGED
- case WM_DPICHANGED : messageName = "WM_DPICHANGED"; break; //0x02E0
- # endif
- #endif /* WINVER >= 0x0601 */
- #if(WINVER >= 0x0605)
- # ifdef KIT_PM_WM_DPICHANGED_BEFOREPARENT
- case WM_DPICHANGED_BEFOREPARENT : messageName = "WM_DPICHANGED_BEFOREPARENT"; break; //0x02E2
- # endif
- # ifdef KIT_PM_WM_DPICHANGED_AFTERPARENT
- case WM_DPICHANGED_AFTERPARENT : messageName = "WM_DPICHANGED_AFTERPARENT"; break; //0x02E3
- # endif
- # ifdef KIT_PM_WM_GETDPISCALEDSIZE
- case WM_GETDPISCALEDSIZE : messageName = "WM_GETDPISCALEDSIZE"; break; //0x02E4
- # endif
- #endif /* WINVER >= 0x0605 */
- # ifdef KIT_PM_WM_CUT
- case WM_CUT : messageName = "WM_CUT"; break; //0x0300
- # endif
- # ifdef KIT_PM_WM_COPY
- case WM_COPY : messageName = "WM_COPY"; break; //0x0301
- # endif
- # ifdef KIT_PM_WM_PASTE
- case WM_PASTE : messageName = "WM_PASTE"; break; //0x0302
- # endif
- # ifdef KIT_PM_WM_CLEAR
- case WM_CLEAR : messageName = "WM_CLEAR"; break; //0x0303
- # endif
- # ifdef KIT_PM_WM_UNDO
- case WM_UNDO : messageName = "WM_UNDO"; break; //0x0304
- # endif
- # ifdef KIT_PM_WM_RENDERFORMAT
- case WM_RENDERFORMAT : messageName = "WM_RENDERFORMAT"; break; //0x0305
- # endif
- # ifdef KIT_PM_WM_RENDERALLFORMATS
- case WM_RENDERALLFORMATS : messageName = "WM_RENDERALLFORMATS"; break; //0x0306
- # endif
- # ifdef KIT_PM_WM_DESTROYCLIPBOARD
- case WM_DESTROYCLIPBOARD : messageName = "WM_DESTROYCLIPBOARD"; break; //0x0307
- # endif
- # ifdef KIT_PM_WM_DRAWCLIPBOARD
- case WM_DRAWCLIPBOARD : messageName = "WM_DRAWCLIPBOARD"; break; //0x0308
- # endif
- # ifdef KIT_PM_WM_PAINTCLIPBOARD
- case WM_PAINTCLIPBOARD : messageName = "WM_PAINTCLIPBOARD"; break; //0x0309
- # endif
- # ifdef KIT_PM_WM_VSCROLLCLIPBOARD
- case WM_VSCROLLCLIPBOARD : messageName = "WM_VSCROLLCLIPBOARD"; break; //0x030A
- # endif
- # ifdef KIT_PM_WM_SIZECLIPBOARD
- case WM_SIZECLIPBOARD : messageName = "WM_SIZECLIPBOARD"; break; //0x030B
- # endif
- # ifdef KIT_PM_WM_ASKCBFORMATNAME
- case WM_ASKCBFORMATNAME : messageName = "WM_ASKCBFORMATNAME"; break; //0x030C
- # endif
- # ifdef KIT_PM_WM_CHANGECBCHAIN
- case WM_CHANGECBCHAIN : messageName = "WM_CHANGECBCHAIN"; break; //0x030D
- # endif
- # ifdef KIT_PM_WM_HSCROLLCLIPBOARD
- case WM_HSCROLLCLIPBOARD : messageName = "WM_HSCROLLCLIPBOARD"; break; //0x030E
- # endif
- # ifdef KIT_PM_WM_QUERYNEWPALETTE
- case WM_QUERYNEWPALETTE : messageName = "WM_QUERYNEWPALETTE"; break; //0x030F
- # endif
- # ifdef KIT_PM_WM_PALETTEISCHANGING
- case WM_PALETTEISCHANGING : messageName = "WM_PALETTEISCHANGING"; break; //0x0310
- # endif
- # ifdef KIT_PM_WM_PALETTECHANGED
- case WM_PALETTECHANGED : messageName = "WM_PALETTECHANGED"; break; //0x0311
- # endif
- # ifdef KIT_PM_WM_HOTKEY
- case WM_HOTKEY : messageName = "WM_HOTKEY"; break; //0x0312
- # endif
- #if(WINVER >= 0x0400)
- # ifdef KIT_PM_WM_PRINT
- case WM_PRINT : messageName = "WM_PRINT"; break; //0x0317
- # endif
- # ifdef KIT_PM_WM_PRINTCLIENT
- case WM_PRINTCLIENT : messageName = "WM_PRINTCLIENT"; break; //0x0318
- # endif
- #endif /* WINVER >= 0x0400 */
- #if(_WIN32_WINNT >= 0x0500)
- # ifdef KIT_PM_WM_APPCOMMAND
- case WM_APPCOMMAND : messageName = "WM_APPCOMMAND"; break; //0x0319
- # endif
- #endif /* _WIN32_WINNT >= 0x0500 */
- #if(_WIN32_WINNT >= 0x0501)
- # ifdef KIT_PM_WM_THEMECHANGED
- case WM_THEMECHANGED : messageName = "WM_THEMECHANGED"; break; //0x031A
- # endif
- #endif /* _WIN32_WINNT >= 0x0501 */
- #if(_WIN32_WINNT >= 0x0501)
- # ifdef KIT_PM_WM_CLIPBOARDUPDATE
- case WM_CLIPBOARDUPDATE : messageName = "WM_CLIPBOARDUPDATE"; break; //0x031D
- # endif
- #endif /* _WIN32_WINNT >= 0x0501 */
- #if(_WIN32_WINNT >= 0x0600)
- # ifdef KIT_PM_WM_DWMCOMPOSITIONCHANGED
- case WM_DWMCOMPOSITIONCHANGED : messageName = "WM_DWMCOMPOSITIONCHANGED"; break; //0x031E
- # endif
- # ifdef KIT_PM_WM_DWMNCRENDERINGCHANGED
- case WM_DWMNCRENDERINGCHANGED : messageName = "WM_DWMNCRENDERINGCHANGED"; break; //0x031F
- # endif
- # ifdef KIT_PM_WM_DWMCOLORIZATIONCOLORCHANGED
- case WM_DWMCOLORIZATIONCOLORCHANGED : messageName = "WM_DWMCOLORIZATIONCOLORCHANGED"; break; //0x0320
- # endif
- # ifdef KIT_PM_WM_DWMWINDOWMAXIMIZEDCHANGE
- case WM_DWMWINDOWMAXIMIZEDCHANGE : messageName = "WM_DWMWINDOWMAXIMIZEDCHANGE"; break; //0x0321
- # endif
- #endif /* _WIN32_WINNT >= 0x0600 */
- #if(_WIN32_WINNT >= 0x0601)
- # ifdef KIT_PM_WM_DWMSENDICONICTHUMBNAIL
- case WM_DWMSENDICONICTHUMBNAIL : messageName = "WM_DWMSENDICONICTHUMBNAIL"; break; //0x0323
- # endif
- # ifdef KIT_PM_WM_DWMSENDICONICLIVEPREVIEWBITMAP
- case WM_DWMSENDICONICLIVEPREVIEWBITMAP: messageName = "WM_DWMSENDICONICLIVEPREVIEWBITMAP"; break; //0x0326
- # endif
- #endif /* _WIN32_WINNT >= 0x0601 */
- #if(WINVER >= 0x0600)
- # ifdef KIT_PM_WM_GETTITLEBARINFOEX
- case WM_GETTITLEBARINFOEX : messageName = "WM_GETTITLEBARINFOEX"; break; //0x033F
- # endif
- #endif /* WINVER >= 0x0600 */
- default:;
- # ifdef KIT_PM_WM_UNKNOWN
- messageName = "(unknown)";
- # endif
- }
- if(messageName != nullptr){
- printf("hwnd=%p, wParam=0x%08X, lParam=%p, msg={ 0x%08X \"%s\" }\n",
- hwnd, (u32)wParam, (void*)lParam, message, messageName);
- }
- }
- #endif /* _DEBUG */
- /*-src\kit_win32\kit_Window_WindowProc.cpp-*/
- /*+include\kit\_misc_Mutex.hpp+*/
- #ifndef _KIT_INC__MISC_MUTEX_HPP
- #define _KIT_INC__MISC_MUTEX_HPP
- #include "commondef.hpp"
- namespace kit {
- //this mutex is non-blocking within the same thread!
- //(that means you can lock multiple times in one thread
- // as long as you unlock it the same number of times)
- class MutexSimple {
- u32 _type;
- u32 _spinCount;
- _GenericOpaquePtr _mutex_ptr = nullptr;
- public:
- MutexSimple(u32 spinCount = -1);
- ~MutexSimple();
- void setSpinCount(u32 spinCount);
- u32 getSpinCount(){ return _spinCount; }
- void lock(bool locked = true);
- void unlock(){ lock(false); }
- bool tryLock(); //returns true if locked successfully
- };
- };
- #endif /* _KIT_INC__MISC_MUTEX_HPP */
- /*-include\kit\_misc_Mutex.hpp-*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement