Reputation: 330862
I use this function:
[DllImport ( "user32.dll" )]
static extern int SetWindowLong ( IntPtr hWnd, int nIndex, uint dwNewLong );
and pass values from these:
http://pinvoke.net/default.aspx/Constants/Window%20styles.html
enum WindowLongFlags : int
{
GWL_EXSTYLE = -20,
GWLP_HINSTANCE = -6,
GWLP_HWNDPARENT = -8,
GWL_ID = -12,
GWL_STYLE = -16,
GWL_USERDATA = -21,
GWL_WNDPROC = -4,
DWLP_USER = 0x8,
DWLP_MSGRESULT = 0x0,
DWLP_DLGPROC = 0x4
}
So when I call it as:
SetWindowLong ( c, WindowLongFlags.GWL_STYLE, WindowStyles.WS_OVERLAPPED );
I get these errors:
Argument 2: cannot convert from 'timoti.WindowLongFlags' to 'int'
Argument 3: cannot convert from 'timoti.WindowStyles' to 'uint'
Is the pinvoke signature wrong as I have seen different ones online or am I missing something else?
Upvotes: 2
Views: 17188
Reputation: 20565
this should fix it
SetWindowLong ( c, (int)WindowLongFlags.GWL_STYLE,
(uint) WindowStyles.WS_OVERLAPPED);
Upvotes: 3