VB 窗口置顶 20
让VB的程序窗口保持在顶层,注意不是SetWindowPos,是要在登录时输入密码的那个界面前面,类似于瑞星的那个狮子头,很有难度哦。。。。...
让VB的程序窗口保持在顶层,注意不是SetWindowPos,是要在登录时输入密码的那个界面前面,类似于瑞星的那个狮子头,很有难度哦。。。。
展开
4个回答
展开全部
你说的是保持在最前面吧!你再说明白点!
Private Declare Function SetWindowPos& Lib "user32" (ByVal hwnd As Long, _
ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, _
ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long)
Private Sub Form_Load()
Call SetWindowPos(Me.hwnd, -1, 0, 0, 0, 0, 3)
'其它代码
End Sub
将下面的代码复制到记事本中,并将其保持为Form1.frm
VERSION 5.00
Begin VB.Form Form1
BorderStyle = 0 'None
ClientHeight = 4695
ClientLeft = 0
ClientTop = 0
ClientWidth = 6975
LinkTopic = "Form1"
ScaleHeight = 4695
ScaleWidth = 6975
ShowInTaskbar = 0 'False
StartUpPosition = 3 '窗口缺省
Begin VB.Shape Shape3
BackColor = &H000080FF&
BackStyle = 1 'Opaque
BorderStyle = 0 'Transparent
Height = 855
Left = 3480
Shape = 3 'Circle
Top = 960
Width = 975
End
Begin VB.Shape Shape2
BackColor = &H000080FF&
BackStyle = 1 'Opaque
BorderStyle = 0 'Transparent
Height = 855
Left = 1560
Shape = 3 'Circle
Top = 960
Width = 975
End
Begin VB.Shape Shape1
BackColor = &H000080FF&
BackStyle = 1 'Opaque
BorderStyle = 0 'Transparent
Height = 1095
Left = 1920
Shape = 2 'Oval
Top = 1320
Width = 2055
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Declare Function SetWindowPos& Lib "user32" (ByVal hwnd As Long, _
ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, _
ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long)
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hwnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
Dim mouse_x As Single
Dim mouse_y As Single
Private Sub Form_Load()
Call SetWindowPos(Me.hwnd, -1, 0, 0, 0, 0, 3)
Me.BackColor = &HFF0000
Dim rtn As Long
BorderStyler = 0
rtn = GetWindowLong(hwnd, -20)
rtn = rtn Or &H80000
SetWindowLong hwnd, -20, rtn
SetLayeredWindowAttributes hwnd, &HFF0000, 0, &H1
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
mouse_x = 0
mouse_y = 0
If Button = 1 Then
mouse_x = X
mouse_y = Y
End If
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
Form1.Left = Form1.Left + (X - mouse_x)
Form1.Top = Form1.Top + (Y - mouse_y)
End If
End Sub
Private Declare Function SetWindowPos& Lib "user32" (ByVal hwnd As Long, _
ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, _
ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long)
Private Sub Form_Load()
Call SetWindowPos(Me.hwnd, -1, 0, 0, 0, 0, 3)
'其它代码
End Sub
将下面的代码复制到记事本中,并将其保持为Form1.frm
VERSION 5.00
Begin VB.Form Form1
BorderStyle = 0 'None
ClientHeight = 4695
ClientLeft = 0
ClientTop = 0
ClientWidth = 6975
LinkTopic = "Form1"
ScaleHeight = 4695
ScaleWidth = 6975
ShowInTaskbar = 0 'False
StartUpPosition = 3 '窗口缺省
Begin VB.Shape Shape3
BackColor = &H000080FF&
BackStyle = 1 'Opaque
BorderStyle = 0 'Transparent
Height = 855
Left = 3480
Shape = 3 'Circle
Top = 960
Width = 975
End
Begin VB.Shape Shape2
BackColor = &H000080FF&
BackStyle = 1 'Opaque
BorderStyle = 0 'Transparent
Height = 855
Left = 1560
Shape = 3 'Circle
Top = 960
Width = 975
End
Begin VB.Shape Shape1
BackColor = &H000080FF&
BackStyle = 1 'Opaque
BorderStyle = 0 'Transparent
Height = 1095
Left = 1920
Shape = 2 'Oval
Top = 1320
Width = 2055
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Declare Function SetWindowPos& Lib "user32" (ByVal hwnd As Long, _
ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, _
ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long)
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hwnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
Dim mouse_x As Single
Dim mouse_y As Single
Private Sub Form_Load()
Call SetWindowPos(Me.hwnd, -1, 0, 0, 0, 0, 3)
Me.BackColor = &HFF0000
Dim rtn As Long
BorderStyler = 0
rtn = GetWindowLong(hwnd, -20)
rtn = rtn Or &H80000
SetWindowLong hwnd, -20, rtn
SetLayeredWindowAttributes hwnd, &HFF0000, 0, &H1
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
mouse_x = 0
mouse_y = 0
If Button = 1 Then
mouse_x = X
mouse_y = Y
End If
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
Form1.Left = Form1.Left + (X - mouse_x)
Form1.Top = Form1.Top + (Y - mouse_y)
End If
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
窗体置顶,VB.NET的话窗体倒是有个TopMost属性控制这个,VB6的话只能用API。
在登录界面前,楼主只能修改系统本身的文件才可能达到你的目的,用C试一下吧,也许有用,VB不修改注册表,或者修改某个系统应用程序或类库是做不到这个。
在登录界面前,楼主只能修改系统本身的文件才可能达到你的目的,用C试一下吧,也许有用,VB不修改注册表,或者修改某个系统应用程序或类库是做不到这个。
追问
Topmost跟setwindowpos没有什么区别,这个函数只能保持窗口再顶层,就像QQ一样,但是还是不能在登录界面上显示
追答
在登录界面前出现就要求程序能开机自启,而且是无视用户帐号的开机自启(你又没登录系统不会运行你设置的普通开机自启程序),程序还没运行当然不会出现在登录界面了,你要解决的是这个问题,而不是单纯的怎么让窗口置顶,你搞错方向了。你现在在向黑客的领域迈进,加油吧楼主。
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
画狮子?跳出窗口的思维,直接在桌面上draw
用GetDesktopWindow()和GetDC()获得桌面的设备场景句柄,
GetDesktopWindow()获得句柄,GetDC()获得场景
然后画吧,自由度高。
还有就是用DirectX画窗口也比价靠谱
注:WIN7的AERO下有可能会出问题
用GetDesktopWindow()和GetDC()获得桌面的设备场景句柄,
GetDesktopWindow()获得句柄,GetDC()获得场景
然后画吧,自由度高。
还有就是用DirectX画窗口也比价靠谱
注:WIN7的AERO下有可能会出问题
追问
其实我的真正目的是让我的窗口显示出来,电脑在锁定的情况下显示出来,这个一般的置顶是没有任何效果的
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
D L L 注 入 可 以 实 现 。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询