在线求助编译错误:在End Sub,End Function或End属性后面只能出现注释

2024-12-28 19:15:29
推荐回答(1个)
回答1:

你的
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)
As
Long
只能写(定义)在所有程序的最前面,也就是以下程序可以运行
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)
As
Long
Dim
ctX
As
Single,
ctY
As
Single
Private
Sub
Form_MouseDown(Button
As
Integer,
Shift
As
Integer,
X
As
Single,
Y
As
Single)
ctX
=
X:
ctY
=
Y
End
Sub
Private
Sub
Form_MouseMove(Button
As
Integer,
Shift
As
Integer,
X
As
Single,
Y
As
Single)
If
Button
=
1
Then
Me.Move
Me.Left
-
ctX
+
X,
Me.Top
-
ctY
+
Y
End
Sub
'拖动Form窗口
Private
Sub
Form_Load()
SetWindowPos
Me.HWnd,
-1,
0,
0,
0,
0,
2
Or
1
End
Sub