You're allowing the message to pass through to the normal windows routines which are therefore undoing any changes you make.

vb.net Code:
  1. Protected Overrides Sub WndProc(ByRef m As Message)
  2.  Dim AllowNormalProcessing As Boolean = True
  3.  
  4.         If m.Msg = WM_TABLET_QUERYSYSTEMGESTURESTATUS Then
  5.             'Call the GlobalAdd atom Function
  6.             Dim atom As String = GlobalAddAtom("MICROSOFT_TABLETPENSERVICE_PROPERTY")
  7.             'Call the setProc function
  8.             SetProp(WindowHAndle, atom, TABLET_DISABLE_PRESSANDHOLD)
  9.             GlobalDeleteAtom(atom)
  10.  
  11.             AllowNormalProcessing = False
  12.  
  13.         End If
  14.  
  15.         If m.Msg = WM_SYSCOMMAND And m.WParam.ToInt32 = SC_RESTORE Then
  16.             SetWindowPos(taskBar, 0&, 0&, 0&, 0&, 0&, SWP_HIDEWINDOW)
  17.  
  18.            AllowNormalProcessing = False
  19.  
  20.         End If
  21.  
  22.         If AllowNormalProcessing Then MyBase.WndProc(m)
  23.  
  24.     End Sub