Advertisement
wuuyi123

NCHITTEST

Oct 11th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.12 KB | None | 0 0
  1. INT WINAPI NCHITTEST(HWND hWnd, LPARAM lParam)
  2. {
  3.     int iSide = 0; int iTopBot = 0; int cur = 0;
  4.     int Set = 0x10003; int bMarg = 6; int HT = 2;
  5.     WINDOWPLACEMENT wlcmt; POINT curPos;
  6.     GetWindowPlacement(hWnd, &wlcmt);
  7.     GetCursorPos(&curPos);
  8.     ScreenToClient(hWnd, &curPos);
  9.     if (curPos.x < bMarg) { iSide = 1; };
  10.     if (curPos.x > (wlcmt.rcNormalPosition.right - bMarg)) { iSide = 2; };
  11.     if (curPos.y < bMarg) { iTopBot = 3; };
  12.     if (curPos.y > (wlcmt.rcNormalPosition.bottom -  bMarg)) { iTopBot = 6; };
  13.     cur = iSide + iTopBot;
  14.     if (wlcmt.showCmd != 3)
  15.     {
  16.         switch(cur) {  
  17.             case 1: { Set = 0x10010; HT = 10; }
  18.             case 2: { Set = 0x10010; HT = 11; }
  19.             case 3: { Set = 0x10013; HT = 12; }
  20.             case 4: {
  21.                 Set = 0x1000D;
  22.                 HT = 13;
  23.             }
  24.             case 5: {
  25.                 Set = 0x1000F;
  26.                 HT = 14;
  27.             }
  28.             case 6: {
  29.                 Set = 0x10013;
  30.                 HT = 15;
  31.             }
  32.             case 7: {
  33.                 Set = 0x1000F;
  34.                 HT = 16;
  35.             }
  36.             case 8: {
  37.                 Set = 0x1000D;
  38.                 HT = 17;
  39.             }
  40.         if (HT != 2) return HT;
  41.     }
  42.     if ((abs((lParam >> 16) & 0xFFFF) - wlcmt.rcNormalPosition.top) < 30) return 2;
  43.     SetClassLong(hWnd, -12, Set);
  44.     return 1;
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement