WndProc Internal Function Window procedure that distributes all window messages for windows of type 'CUH_Control' it then dispatches the messages to the class that is attached to the window Params n/a Return n/a ***********************************/
| 243 | n/a |
| 244 | ***********************************/ |
| 245 | LRESULT CALLBACK CUH_Control::WndProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam){ |
| 246 | |
| 247 | switch(message){ |
| 248 | case WM_NCCREATE:{ |
| 249 | SetWindowLong(hwnd,0,(LPARAM)NULL); |
| 250 | return 1; |
| 251 | } |
| 252 | case UH_SET_THIS_PTR:{ |
| 253 | //store the pointer to the calling class |
| 254 | // CUH_Control *_this = (CUH_Control*)lParam; |
| 255 | SetWindowLong(hwnd,0,(LONG)lParam); |
| 256 | return 1; |
| 257 | } |
| 258 | } |
| 259 | |
| 260 | //get the pointer to the calling class |
| 261 | CUH_Control *_this = (CUH_Control*)GetWindowLongPtr(hwnd,0); |
| 262 | |
| 263 | //call the functions that match in incoming message |
| 264 | if(_this != NULL){ |
| 265 | switch(message){ |
| 266 | case WM_KEYDOWN: |
| 267 | if(_this->OnKeyDown((int)wParam) == TRUE) |
| 268 | return 0; |
| 269 | break; |
| 270 | case WM_PAINT: |
| 271 | _this->OnPaint(); |
| 272 | return 0; |
| 273 | case WM_SIZE: |
| 274 | _this->OnSize(); |
| 275 | return 0; |
| 276 | case WM_NCDESTROY: |
| 277 | _this->m_hWnd = NULL; |
| 278 | return 0; |
| 279 | case WM_HSCROLL: |
| 280 | #ifdef WIN32 |
| 281 | _this->OnHScroll(LOWORD(wParam),HIWORD(wParam)); |
| 282 | #else |
| 283 | _this->OnHScroll(wParam,LOWORD(lParam)); |
| 284 | #endif |
| 285 | return 0; |
| 286 | case WM_VSCROLL: |
| 287 | #ifdef WIN32 |
| 288 | _this->OnVScroll(LOWORD(wParam),HIWORD(wParam)); |
| 289 | #else |
| 290 | _this->OnVScroll(wParam,LOWORD(lParam)); |
| 291 | #endif |
| 292 | return 0; |
| 293 | case WM_MOUSEACTIVATE: |
| 294 | SetFocus(_this->m_hWnd); |
| 295 | break; |
| 296 | case WM_ERASEBKGND: |
| 297 | return 1; |
| 298 | } |
| 299 | } |
| 300 | |
| 301 | return (long)DefWindowProc(hwnd,message,wParam,lParam); |
| 302 | } |