vb问题?请各位高手进!

来源:百度知道 编辑:UC知道 时间:2024/05/25 06:58:52
请各位看这段代码如下:

Private Declare Function SetWindowPos Lib "user32" ()

Private Sub Command1_Click()
i = SetWindowPos(Form1.hWnd, -1, 234, 0, 56767, 234)
Print "窗体总在最前面"
End Sub
当我运行时提示出错:Dll调用约定出错,这是什么意思呀?如何解决这个问题呢?

你的api声明不完整
private Declare Function SetWindowPos Lib "user32" Alias "SetWindowPos" (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

另外如果你只是想要窗体最前,应该这么写

SetWindowPos Form1.hWnd,-1,0,0,0,0,3