tags:

views:

102

answers:

1

I'm having trouble converting this piece of code (originally in VB) to C#. In particular, how does one apply a negative to an int.

Private Declare Function GetWindowLong Lib "user32" Alias _
  "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Const GWL_STYLE = (-16)
Private Const WS_MAXIMIZEBOX = &H10000
dim lStyle as long

lStyle = GetWindowLong(Lhwnd, GWL_STYLE)
lStyle = lStyle And Not WS_MAXIMIZEBOX
+7  A: 

In particular, how does one apply a negative to an int.

I guess the line you are stuck on is the last one. The code seems to be clearing a bit. In C# you can do it like this:

lStyle &= ~WS_MAXIMIZEBOX
Mark Byers