# 如何利用工作区移动视窗?

Posted by 阿强 on June 02, 1998 at 17:28:13:

请问小吴:
我想作无标题区, 而能够在工作区移动视窗的动作,
就是以工作区模拟标题区的移动,
但是发生了问题, 底下是我写的程式, 烦请指点

vb6.0 中文企业版
Win95 4.00.950B

1.当程式执行时, 有时候马上就会移动了,
有时候就毫无动作( 这是作测试的)

在 Module1 的内容
Public Const WM_NCLBUTTONDOWN = &HA1
Public Const HTCAPTION = 2

Public Declare Function DefWindowProc _
Lib "user32" Alias "DefWindowProcA" ( _
ByVal hWnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
ByVal lParam As Long _
) As Long

Public Declare Function GetActiveWindow _
Lib "user32" () As Long

Sub main()
Dim hWnd As Long
Dim lReturn As Long
Form1.Show
hWnd = GetActiveWindow()
lReturn = DefWindowProc(hWnd, _
WM_NCLBUTTONDOWN, HTCAPTION, 0)
End Sub

在 Form1 的内容
无

2.程式执行毫无动作

在 Module1 的内容
Public Const WM_NCLBUTTONDOWN = &HA1
Public Const HTCAPTION = 2

Public Declare Function DefWindowProc _
Lib "user32" Alias "DefWindowProcA" ( _
ByVal hWnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
ByVal lParam As Long _
) As Long

Public Declare Function GetActiveWindow _
Lib "user32" () As Long

Sub main()
Form1.Show
End Sub

在 Form1 的内容
Private Sub Form_MouseDown(Button As Integer, _
Shift As Integer, X As Single, Y As Single)
Dim hWnd As Long
Dim lReturn As Long

hWnd = GetActiveWindow()
lReturn = DefWindowProc(hWnd, _
WM_NCLBUTTONDOWN, HTCAPTION, 0)
End Sub

其次还有一个问题, 就是在贵站下载之 QACOMMAND.DLL 之
qaShell "C:\WIN\DESKTOP\捷径 - 我的电脑.LNK"
qaShell "C:\WIN\DESKTOP\捷径 - 网路上的芳邻.LNK"
qaShell "C:\WIN\DESKTOP\捷径 - 资源回收筒.LNK"
qaShell "C:\WIN\DESKTOP\捷径 - 控制台.LNK"
捷径 - 我的电脑 与 捷径 - 网路上的芳邻执行无效,
不知为何?

Follow Ups:

- 没这么难吧! 小吴 00:26:01 6/03/98 (0)