Advertisement
Guest User

Untitled

a guest
May 22nd, 2017
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
D 0.96 KB | None | 0 0
  1.     extern(Windows) private static LRESULT msgRouter(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
  2.     {      
  3.         if(msg == WM_NCCREATE)
  4.         {
  5.             /*
  6.              * TRICK: Id == hWnd
  7.              * ---
  8.              * Inizializzazione Componente
  9.              */
  10.        
  11.             CREATESTRUCT* pCreateStruct = cast(CREATESTRUCT*)lParam;
  12.             LONG param = cast(LONG)pCreateStruct.lpCreateParams;
  13.             SetWindowLongW(hWnd, GWL_USERDATA, param);
  14.             SetWindowLongW(hWnd, GWL_ID, cast(LONG)hWnd);
  15.  
  16.             Control theThis = winCast!(Control)(param);
  17.             theThis._handle = hWnd;        
  18.             theThis.onHandleCreated(EventArgs.empty);
  19.         }
  20.  
  21.         Control theThis = winCast!(Control)((GetWindowLongW(hWnd, GWL_USERDATA)));
  22.  
  23.         if(msg == WM_CREATE)
  24.         {
  25.             // Aggiornamento Font, rimuove FIXED SYS           
  26.             theThis.originalWndProc(WM_SETFONT, cast(WPARAM)SystemFonts.activeFont.handle, MAKELPARAM(1, 0));
  27.         }
  28.  
  29.         if(theThis)
  30.         {
  31.             return theThis.wndProc(msg, wParam, lParam);
  32.         }
  33.  
  34.         return Control.defWindowProc(hWnd, msg, wParam, lParam);
  35.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement