Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Move window without resize

Posted on 2008-06-16
3
Medium Priority
?
1,470 Views
Last Modified: 2008-10-03
Hi. I am trying to move a window to the upper left corner of my screen. I seem to have no problem moving the window to the corner , but it becomes very very small no matter what I set as nWidth & nHeight. The window i am moving is a "no resizeable" window, and i simply want it in the corner and nothing else.

    Declare Function MoveWindow Lib "user32.dll" 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

0
Comment
Question by:soriega
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 27

Expert Comment

by:planocz
ID: 21797614
try something like this...

Dim frm As New Form1
        frm.Location = New Point(Me.Left + 200, Me.Top + 100)
        frm.Show()
0
 

Author Comment

by:soriega
ID: 21797716
Not really, i want to move another window, Not the Form of my application. Is there some way of using this method with the hwnd ?
I thought this was useful
Declare Function MoveWindow Lib "user32.dll" 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
This one seem to work, but it becomes very small, and it can after then only be closed
0
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 600 total points
ID: 21798122
Use SetWindowPos() with the SWP_NOSIZE flag:
    Private Const SWP_NOSIZE As Integer = &H1
 
    Private Declare Function SetWindowPos Lib "user32" Alias "SetWindowPos" (ByVal hwnd As IntPtr, ByVal hWndInsertAfter As Integer, ByVal x As Integer, ByVal y As Integer, ByVal cx As Integer, ByVal cy As Integer, ByVal wFlags As Integer) As Integer
    
    ...
        SetWindowPos(someWindowHandleHere, 0, 0, 0, 0, 0, SWP_NOSIZE)

Open in new window

0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question