<p>How can I cast long to HWND (C++ visual studio 8)?</p>

<pre><code>Long lWindowHandler;
HWND oHwnd = (HWND)lWindowHandler;
</code></pre>

<p>But I got the following warning:</p>

<blockquote>
  <p>warning C4312: 'type cast' : conversion from 'LONG' to 'HWND' of greater size</p>
</blockquote>

<p>Thanks.</p>

As long as you're sure that the LONG you have is really an HWND, then it's as simple as:
```
```
HWND hWnd = (HWND)(LONG_PTR)lParam;
```
```