I want to disable the form fade-in effect for a window.
I think I found the right function
<DllImport("dwmapi.dll", PreserveSig:=True)> _
Private Shared Function DwmSetWindowAttribute(ByVal hwnd As IntPtr, ByVal attr As Integer, ByRef attrValue As Integer, ByVal attrSize As Integer) As Integer
End Function
and the flag should be
DWMWA_TRANSITIONS_FORCEDISABLED
But I don't know how to call it from VB.NET. This is what I have so far:
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
<DllImport("dwmapi.dll", PreserveSig:=True)> _
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 >= 6 Then
DwmSetWindowAttribute Me.Handle, 'here I don't know how to go on...
End If
End Sub
End Class
Thank you very much for the help!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…