I have a hex value to a window i found using Spy++.
the value is: 00010010
Thanks to an answer to a question i asked earlier, i have this code:
IntPtr hwndf = this.Handle;
IntPtr hwndParent = FindWindow("WINDOW HERE", null); ;
SetParent(hwndf, hwndParent);
this.TopMost = false;
Now, as far as i understand it, IntPtr hwndParent will contain the handle to the window WINDOW HERE. How can i rewrite that line to use my hex handle? I tried:
IntPtr hwndParent = (IntPtr) 0x00010010
But it didnt work. Any ideas?
Well, the hex equivalent of 00010010 is 0x12. So you could theoretically use
IntPtr hwndParent = (IntPtr) 0x12
The Windows calculator can do that conversion. That value doesn't sound correct, though. Can you explain in more detail how you got that value?
EDIT: Your comment mentions that you're trying to get a handle to the desktop window. There's a function for that: GetDesktopWindow, which returns an IntPtr. If all you're ever interested in is the desktop window, use that.
Here's the P/Invoke for that function:
[DllImport("user32.dll", CharSet=CharSet.Auto, ExactSpelling=true)]
public static extern IntPtr GetDesktopWindow();