title: using modulus to find out if number is divisible by variable not working
body: <p>I have a problem with using the % operator. This is hard to explain, so I'll just show my code first.</p>
  
  <pre><code>#include &lt;windows.h&gt;
  const char ClassName[] = "WindowClass";
  int divisible = 1;
  LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
  {
      switch (msg)
      {
      case WM_CREATE:
          SetTimer(hwnd, 1, 50, NULL);
          break;
      case WM_TIMER:
      {
          if (divisible % 15 == 0) {
              MessageBox(hwnd, "a", "a", MB_ABORTRETRYIGNORE | MB_ICONASTERISK);
          }
          divisible++;
          break;
      }
      case WM_CLOSE:
          DestroyWindow(hwnd);
          break;
      case WM_DESTROY:
          PostQuitMessage(0);
          break;
      default:
          return DefWindowProc(hwnd, msg, wParam, lParam);
      }
      return 0;
  }
  int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
  {
      WNDCLASSEX wc;
      HWND hwnd;
      MSG Msg;
  
      wc.cbSize = sizeof(WNDCLASSEX);
      wc.style = 0;
      wc.lpfnWndProc = WndProc;
      wc.cbClsExtra = 0;
      wc.cbWndExtra = 0;
      wc.hInstance = hInstance;
      wc.hIcon = LoadIcon(NULL, IDI_SHIELD);
      wc.hCursor = LoadCursor(NULL, IDC_ARROW);
      wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
      wc.lpszMenuName = NULL;
      wc.lpszClassName = ClassName;
      wc.hIconSm = LoadIcon(NULL, IDI_SHIELD);
  
      RegisterClassEx(&amp;wc);
  
      hwnd = CreateWindowEx(
          WS_EX_CLIENTEDGE,
          ClassName,
          "Tank Survival",
          WS_OVERLAPPEDWINDOW,
          CW_USEDEFAULT, CW_USEDEFAULT, 820, 642,
          NULL, NULL, hInstance, NULL);
  
      ShowWindow(hwnd, nCmdShow);
      UpdateWindow(hwnd);
  
      while (GetMessage(&amp;Msg, NULL, 0, 0) &gt; 0)
      {
          TranslateMessage(&amp;Msg);
          DispatchMessage(&amp;Msg);
      }
      return Msg.wParam;
  }
  </code></pre>
  
  <p>So what happens is that the messagebox in WM_TIMER repeats every time WM_TIMER is called although it should only run every 15 times WM_TIMER is called.
  Any help would be appreciated.
  Thanks!</p>