title: WINAPI SendMessage to a hWnd in a specific area
body: <p>So basically I got a Window Handler which is a Pic(rectangular shape) that contains like 16 slots.</p>
  
  <p>Well, so I want to use SendMessage to this hWnd and giving a keyPressed as a message to the first and to the second slot (since they are not individual windows, I can't take each slot window Handle). The problem resides in implementing those offsets to set the area which I want to send those messages.</p>
  
  <p>Basically I am making a trainer for an offline game to practice things with memory management and to learn how WINAPI works. Here is the code (not including the DllMain function).</p>
  
  <pre><code>#include &lt;windows.h&gt;
  #include &lt;stdio.h&gt;
  
  #define VIDAACTUAL 0x70D27E
  #define VIDAMAX 0x70D27C
  #define MANAACTUAL 0x70D282
  #define MANAMAX 0x70D280
  
  void AutoPot(){
      Sleep(5000); //Giving myself time to place the cursor.
      POINT P;
      GetCursorPos(&amp;P);
      HWND hwnd = WindowFromPoint(P);
      Sleep(50);
      while (1){
          WORD hpMax = *(WORD*)(VIDAMAX);
          WORD hpAct= *(WORD*)(VIDAACTUAL);
          WORD mpMax = *(WORD*)(MANAMAX);
          WORD mpAct = *(WORD*)(MANAACTUAL);
          if (hpAct != 0)
          {
              if (hpAct != hpMax)
              {
                  SendMessage(hwnd, WM_LBUTTONUP, 0, 0);
                  //SendMessage(hwnd, WM_LBUTTONDBLCLK, 0, 0);
                  //SendMessage(hwnd, VK_SPACE, 0, 0);
              }
              else if (mpAct!= mpMax &amp;&amp; mpMax != 0){ //Giving priority to red pots.
                  SendMessage(hwnd, WM_LBUTTONUP, 0,0);
                  //SendMessage(hwnd, WM_LBUTTONDBLCLK, 0,0);
                  //SendMessage(hwnd, VK_SPACE, 0, 0);
              }
          }
          Sleep(50);
      }
  }
  </code></pre>
  
  <p>So, is there a way to select a specific area inside a hWnd to send those messages?</p>