vb.net如何是窗口钉在桌面上呀
vb.net如何是窗口钉在桌面上呀????????????????? --------------------编程问答----------------------------------------编程问答-------------------- 恩老大你的方法确实可以让窗体钉在桌面,但是我想让桌面成为程序窗体的父窗体,应该如何做呢??????????
Public Class Form1
Dim x, y As Integer
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
x = Me.Location.X
y = Me.Location.Y
End Sub
Private Sub Form1_Move(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Move
Me.Left = x
Me.Top = y
End Sub
End Class
在线等!!!!!!!!!!! --------------------编程问答-------------------- 测试一下,看看是否正确.
Public Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Integer, ByVal nIndex As Integer) As Integer
Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Integer, ByVal nIndex As Integer, ByVal dwNewLong As Integer) As Integer
Public Declare Function SetParent Lib "user32" (ByVal hWndChild As IntPtr, ByVal hWndNewParent As IntPtr) As IntPtr
Public Const GWL_STYLE = -16
Public Const WS_BORDER = &H800000
Public Declare Function GetDesktopWindow Lib "user32" () As Long
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim DESK As Int32 = GetDesktopWindow
Try
Dim lStyle As Int32 = GetWindowLong(Me.Handle.ToInt32, GWL_STYLE)
lStyle = lStyle And Not WS_BORDER
SetWindowLong(Me.Handle.ToInt32, GWL_STYLE, lStyle)
SetParent(DESK, Me.Handle.ToInt32)
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub --------------------编程问答-------------------- 诚实男人你好:
你能解释一下你的代码吗?
非常感谢!!!!!!!!!!! --------------------编程问答--------------------
--------------------编程问答-------------------- study
Dim DESK As Int32 = GetDesktopWindow '获得桌面窗体的句柄。
Try
Dim lStyle As Int32 = GetWindowLong(Me.Handle.ToInt32, GWL_STYLE) '获取当前窗体的句柄。
lStyle = lStyle And Not WS_BORDER
SetWindowLong(Me.Handle.ToInt32, GWL_STYLE, lStyle) '设置当前窗体的样式(不大确定)
SetParent(DESK, Me.Handle.ToInt32) '设置当前窗体的父窗体是桌面窗体。
Catch ex As Exception
MsgBox(ex.Message)
End Try
补充:.NET技术 , VB.NET