Results 1 to 6 of 6

Thread: [RESOLVED] Movewindow API

  1. #1

    Thread Starter
    PowerPoster Fazi's Avatar
    Join Date
    Aug 2005
    Location
    Underworld
    Posts
    2,525

    Resolved [RESOLVED] Movewindow API

    MoveWindow Me.hwnd, (Me.Left / Screen.TwipsPerPixelX) - 20, Me.Top / Screen.TwipsPerPixelY, form1.?, form1.?, 1

    Parameters
    ---------

    hWnd

    Handle to the window.

    X
    Specifies the new position of the left side of the window.

    Y
    Specifies the new position of the top of the window.

    nWidth
    Specifies the new width of the window.

    nHeight
    Specifies the new height of the window.

    bRepaint

    my question is for nwidth (4th) argument should i specify form1.scalewidth or form1.width ?
    assume i am going to move form1

  2. #2
    VB6, XHTML & CSS hobbyist Merri's Avatar
    Join Date
    Oct 2002
    Location
    Finland
    Posts
    6,654

    Re: Movewindow API

    VB Code:
    1. Me.Move 0, 0, Me.Width, Me.Height

  3. #3
    Frenzied Member Andrew G's Avatar
    Join Date
    Nov 2005
    Location
    Sydney
    Posts
    1,587

    Re: Movewindow API

    If its your own window then as Merri used, me.Move is best, but to answer your question anyway... If you use scaleheight and scalewidth it will only include the form part of the window, so it will not include the frame around the window or the top bar, hence you will lose some height and width.

    If you need the exact window size then you will need to use the 'GetWindowRect' API (usually used for other windows)
    Last edited by Andrew G; Jan 3rd, 2007 at 03:16 AM. Reason: Thanks Merri :o

  4. #4
    VB6, XHTML & CSS hobbyist Merri's Avatar
    Join Date
    Oct 2002
    Location
    Finland
    Posts
    6,654

    Re: Movewindow API

    ScaleWidth and ScaleHeight return the internal portion of the window where controls can be placed, not the actual size of the window. So Width and Height would be what you want to use.

  5. #5
    Frenzied Member Andrew G's Avatar
    Join Date
    Nov 2005
    Location
    Sydney
    Posts
    1,587

    Re: Movewindow API

    Quote Originally Posted by Merri
    ScaleWidth and ScaleHeight return the internal portion of the window where controls can be placed, not the actual size of the window. So Width and Height would be what you want to use.
    I'm obviously half asleep today... Just to add a bit more, if your going to use width and height, you will need to divide them by 15 (screen.TwipsPerPixelX and screen.TwipsPerPixelY) to convert twips to pixels

  6. #6

    Thread Starter
    PowerPoster Fazi's Avatar
    Join Date
    Aug 2005
    Location
    Underworld
    Posts
    2,525

    Re: Movewindow API

    Andrew and Marrie.

    Thank you and i undestand. i really had a sligh problem with form after moving. it just jump back and forth coz i have used form1.scaleheight & form1.scalewidth.
    after changing the above to form1.width & form1.height the problem is solved.

    Thank you all.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width