title: VB.NET disable fade-in for forms
body: <p>I want to disable the form fade-in effect for a window. 
  I think I found the right function</p>
  
  <pre><code>&lt;DllImport("dwmapi.dll", PreserveSig:=True)&gt; _
  Private Shared Function DwmSetWindowAttribute(ByVal hwnd As IntPtr, ByVal attr As Integer, ByRef attrValue As Integer, ByVal attrSize As Integer) As Integer
  End Function
  </code></pre>
  
  <p>and the flag should be </p>
  
  <pre><code>DWMWA_TRANSITIONS_FORCEDISABLED
  </code></pre>
  
  <p>But I don't know how to call it from VB.NET. This is what I have so far:</p>
  
  <pre><code>Imports System.Runtime.InteropServices
  
  Public Class Form1
  
  Public Enum DWMWINDOWATTRIBUTE
      DWMWA_ALLOW_NCPAINT = 4
      DWMWA_CAPTION_BUTTON_BOUNDS = 5
      DWMWA_FLIP3D_POLICY = 8
      DWMWA_FORCE_ICONIC_REPRESENTATION = 7
      DWMWA_LAST = 9
      DWMWA_NCRENDERING_ENABLED = 1
      DWMWA_NCRENDERING_POLICY = 2
      DWMWA_NONCLIENT_RTL_LAYOUT = 6
      DWMWA_TRANSITIONS_FORCEDISABLED = 3
  End Enum
  
  &lt;DllImport("dwmapi.dll", PreserveSig:=True)&gt; _
  Private Shared Function DwmSetWindowAttribute(ByVal hwnd As IntPtr, ByVal attr As Integer, ByRef attrValue As Integer, ByVal attrSize As Integer) As Integer
  End Function
  
  Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  
      If Environment.OSVersion.Version.Major &gt;= 6 Then
          DwmSetWindowAttribute Me.Handle, 'here I don't know how to go on...
      End If
  End Sub
  End Class
  </code></pre>
  
  <p>Thank you very much for the help!</p>