title: How to pass uint in Java?
body: <p>I'm trying to call SendMessage with an uint parameter from Java, but I can't convert int to uint. I can't change the uint parameter in SendMessage because it is a windows function. Is there some way of doing this?</p>
  
  <p>Background:
  I'm actually using Processing, and I'm following the following tutorials to access user32.dll: <a href="http://processing.org/hacks/hacks:jnative" rel="nofollow noreferrer">http://processing.org/hacks/hacks:jnative</a></p>
  
  <p>and <a href="http://jnative.free.fr/SPIP-v1-8-3/article.php3?id_article=8" rel="nofollow noreferrer">http://jnative.free.fr/SPIP-v1-8-3/article.php3?id_article=8</a></p>
  
  <p>And I'm following this to call SendMessage
  <a href="http://www.codeproject.com/KB/cs/Monitor_management_guide.aspx" rel="nofollow noreferrer">http://www.codeproject.com/KB/cs/Monitor_management_guide.aspx</a></p>
  
  <p>Here's my code, GetActiveWindow works fine, it's from the second link above.</p>
  
  <pre><code> int SC_MONITORPOWER = 0xF170;
   int WM_SYSCOMMAND = 0x0112;
   int MONITOR_ON = -1;
   int MONITOR_OFF = 2;
   int MONITOR_STANDBY = 1;
  
  HWND ValidHWND = org.xvolks.jnative.util.User32.GetActiveWindow(); 
  org.xvolks.jnative.util.User32.SendMessage(ValidHWND, (UINT)WM_SYSCOMMAND, 
            (WPARAM)SC_MONITORPOWER, (LPARAM)MONITOR_STANDBY);
  </code></pre>
  
  <p>last line is where the error happens, it says the expected UINT in type User32 is not applicable to the LONG I provided. I can't modify SendMessage either</p>
  
  <p>Here's the corresponding java file the call above invokes, the GetActiveWindow part works fine since it's from a tutorial. I'm trying to tailor Sendmessage to follow it, but I haven't figured it all out yet. However, I don't think it matters to the error I'm getting, since changing the parameters to SendMessage here doesn't change what the compiler expects. I've tried changing int Msg to uint Msg to long Msg, the compiler still expects uint from the code above.</p>
  
  <pre><code>public class Paul_s_User32 extends User32 {
  public HANDLE GetActiveWindow() {
      JNative GetActiveWindow = new JNative(DLL_NAME, "GetActiveWindow");
      GetActiveWindow.setRetVal(Type.INT);
      GetActiveWindow.invoke();
      HWND handle = new HWND(GetActiveWindow.getRetValAsInt());
      GetActiveWindow.dispose();
      return handle;
  }
  public IntPtr SendMessage(IntPtr hWnd, int Msg, 
            IntPtr wParam, IntPtr lParam) {
      JNative SendMessage = new JNative(DLL_NAME, "SendMessage");
      //SendMessage.setRetVal(Type.long);
      SendMessage.invoke();
  
      SendMessage(ValidHWND, WM_SYSCOMMAND, SC_MONITORPOWER, MONITOR_STANDBY);
  }
  </code></pre>