知道句柄,怎样改变窗口大小.

解决方案 »

  1.   

    http://www.dapha.net/api/SetWindowPos.htm
      

  2.   

    MoveWindow也可以Declare Function MoveWindow Lib "user32" Alias "MoveWindow" (ByVal hwnd As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal bRepaint As Long) As Long
      

  3.   

    一个例子:
    Private Declare Function DestroyWindow Lib "user32" (ByVal hwnd As Long) As Long
    Private Declare Function IsWindowEnabled Lib "user32" (ByVal hwnd As Long) As Long
    Private Declare Function MoveWindow Lib "user32" (ByVal hwnd As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal bRepaint As Long) As LongPrivate Sub Command1_Click()
     Dim bl As Boolean
        'Is the window enabled?
        bl = IsWindowEnabled(Me.hwnd)
        MsgBox "Is the form enabled? " + Str$(bl)
        'Move the window
        MoveWindow Me.hwnd, 0, 0, 200, 200, 1
        'Show the window
        Me.Show
        'Wait 5 seconds
        t = Timer
        Do
            'Show the remaining time in the form's caption
            Me.Caption = 5 - Int(Timer - t)
            DoEvents
        Loop Until Timer > t + 5
        'Destroy the window
        DestroyWindow Me.hwnd
    End Sub
      

  4.   

    Declare Function MoveWindow Lib "user32" Alias "MoveWindow" (ByVal hwnd As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal bRepaint As Long) As Long
      

  5.   

    Private Declare Function MoveWindow Lib "user32" (ByVal hwnd As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal bRepaint As Long) As LongPrivate Sub Command1_Click()
        MoveWindow Me.hwnd, 0, 0, 200, 200, 1
    End Sub
      

  6.   

    Private Declare Function SetWindowPos Lib "user32.dll" (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 Longsetwindowpos hwnd,l,0,0,200,200,l(l为默认的long变量)