窗口句柄会找吧?

Try
DwmExtendFrameIntoClientArea(
Me.Handle, New Margins() With {.Bottom = -1, .Left = -1, .Right = -1, .Top = -1})
Catch ex As Exception
End Try

为啥要用Try嵌套呢?
因为在没有 DwmApi.dll 时会引发 DllNotFoundException,
在找不到入口点时会引发 EntryPointNotFoundException,
在返回非 0 的HRESULT 时会 Marshal.ThrowForHR。
添加了Try嵌套会使代码灵活性更强。
当然,使用Declare的同学们不用担心~

 

在测试之前,
需把 BackColor 属性设为 Color.Black,或者把TranspancyKey和BackColor设为一体~
然后,运行测试。

等待第三篇吧~