先问你是不是用SendMessage 来实现的???我要确定一下

解决方案 »

  1.   

    Private Declare Function SendMessage Lib "User32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
    Private Declare Sub ReleaseCapture Lib "User32" ()
    Const WM_NCLBUTTONDOWN = &HA1
    Const HTCAPTION = 2
    Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
        'KPD-Team 1999
        'URL: http://www.allapi.net/
        'E-Mail: [email protected]
        Dim lngReturnValue As Long
        If Button = 1 Then
            'Release capture
            Call ReleaseCapture
            'Send a 'left mouse button down on caption'-message to our form
            lngReturnValue = SendMessage(Me.hWnd, WM_NCLBUTTONDOWN, HTCAPTION, 0&)
        End If
    End Sub
    Private Sub Form_Paint()
        Me.Print "Click on the form, hold the mouse button and drag it"
    End Sub以上代码2000通过
      

  2.   

    ....
    ReleaseCapture
      
    SendMessage Me.hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0&
    ....
    给分呀!!!!!!!!!!!
      

  3.   

    SendMessage(Me.hWnd, WM_NCLBUTTONDOWN, HTCAPTION, 0&)
      

  4.   

    SendMessage(Form1.hwnd, &H112, &HF010, 0&)
      

  5.   

    哈!我的方法最菜,用windowmove的方法跟着鼠标的坐标跑,不敢献丑了。
      

  6.   

    QQRN这种方法,是为第一次用VB时用的方法,是有一点用,不过也太那个了吧
    我在win98用的是SendMessage时通过,在win2000时却不能通过。
    对了,tg123的代码,我也用过的。只是我俩写的程序是相同的,但是我那里却不能通过,哎…
      

  7.   

    看这个 对你有没有 启发:
    ===============================================================Private Type POINTAPI
        X As Long
        Y As Long
    End Type
    Private Declare Function SetCapture Lib "user32" (ByVal hwnd As Long) As Long
    Private Declare Function ReleaseCapture Lib "user32" () As Long
    Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
    Dim Pt As POINTAPI
    Private Sub Form_Load()
        'KPD-Team 1999
        'URL: http://www.allapi.net/
        'E-Mail: [email protected]
        'redirect all mouse input to this form
        SetCapture Me.hwnd
    End Sub
    Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
        ReleaseCapture
        SetCapture Me.hwnd
    End Sub
    Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
        'Get the current cursor position
        GetCursorPos Pt
        Me.CurrentX = 0
        Me.CurrentY = 0
        'Clear the screen
        Me.Cls
        Me.Print "Cursor position:"
        'Print the mouse co鰎dinates to the form
        Me.Print "X:" + Str$(Pt.X) + " Y:" + Str$(Pt.Y)
        Me.Print " (Press ALT-F4 to unload this form)"
        SetCapture Me.hwnd
    End Sub
    Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
        ReleaseCapture
        SetCapture Me.hwnd
    End Sub
      

  8.   

    看这个 对你有没有 启发:
    ===============================================================Private Type POINTAPI
        X As Long
        Y As Long
    End Type
    Private Declare Function SetCapture Lib "user32" (ByVal hwnd As Long) As Long
    Private Declare Function ReleaseCapture Lib "user32" () As Long
    Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
    Dim Pt As POINTAPI
    Private Sub Form_Load()
        SetCapture Me.hwnd
    End Sub
    Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
        ReleaseCapture
        SetCapture Me.hwnd
    End Sub
    Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
        'Get the current cursor position
        GetCursorPos Pt
        Me.CurrentX = 0
        Me.CurrentY = 0
        'Clear the screen
        Me.Cls
        Me.Print "Cursor position:"
        'Print the mouse co鰎dinates to the form
        Me.Print "X:" + Str$(Pt.X) + " Y:" + Str$(Pt.Y)
        Me.Print " (Press ALT-F4 to unload this form)"
        SetCapture Me.hwnd
    End Sub
    Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
        ReleaseCapture
        SetCapture Me.hwnd
    End Sub
      

  9.   

    为什么要用API,直接修改窗体的LEFT、TOP属性,再REFRESH
      

  10.   

    算了算了,我还是把分散了吧。反正win2000里用api时和win98里很多地方都不同。
    win2000连bitblt都要出现问题。(不是出问题而是,方法和结果不同)。
    惨哦。