473,403 Members | 2,359 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

Moving windows

How do I move windows in vb.net?
Aug 2 '06 #1
7 1219
Change the value of Location on your Form.

Nathaniel wrote:
How do I move windows in vb.net?
Aug 3 '06 #2
How about other apps besides my own?

"Nathaniel" <De******@yahoo.comwrote in message
news:fG**************@fe09.lga...
How do I move windows in vb.net?

Aug 3 '06 #3
I am new to VB but I have done something simillar.
Hopefully this will get you on the right track if it isnt what you are
looking for.

You can do stuff to windows through their process... so

'Declare your processes array
Dim myProcesses() As System.Diagnostics.Process

'retrieve your processes ( lets say TextBox1.Text has a value of
"Notepad" ( do not put "Notepad.exe" )
myProcesses = Process.GetProcessesByName(Trim(TextBox1.Text))

'You can do a loop, but lets just work with the first instance of notepad. -
so it will be array pointer ( 0 )
If myProcesses.Length 0 Then

'Use any one of these commands
ShowWindow(myProcesses(0).MainWindowHandle, SW_MAXIMIZE) 'show Maximized
ShowWindow(myProcesses(0).MainWindowHandle, SW_MINIMIZE) 'show Minimized
ShowWindow(myProcesses(0).MainWindowHandle, SW_SHOW) 'Show
ShowWindow(myProcesses(0).MainWindowHandle, 9) 'Restore
End If

'Now you are probably wondering where the SW_Maximize and SW_Minimze come
from... declare them on top
Private Const SW_RESTORE As Int32 = 9
Private Const SW_MAXIMIZE As Int32 = 3
Private Const SW_MINIMIZE As Int32 = 6
Private Const SW_SHOW As Int32 = 5

To find out what these values i cant re-find the website, but search google
groups for sw_restore or sw_maximize and in a
post somewhere, someone took the time to give you all the values.

Hope that helps

Miro

"Nathaniel" <De******@yahoo.comwrote in message
news:LX*************@fe11.lga...
How about other apps besides my own?

"Nathaniel" <De******@yahoo.comwrote in message
news:fG**************@fe09.lga...
>How do I move windows in vb.net?


Aug 3 '06 #4
Im having a little trouble writting this code. ShowWindow() is not declared.

"Nathaniel" <De******@yahoo.comwrote in message
news:LX*************@fe11.lga...
How about other apps besides my own?

"Nathaniel" <De******@yahoo.comwrote in message
news:fG**************@fe09.lga...
>How do I move windows in vb.net?


Aug 4 '06 #5
Sorry I forgot to add one important portion

Private Declare Function ShowWindow Lib "user32.dll" ( _
ByVal hWnd As IntPtr, _
ByVal nCmdShow As SHOW_WINDOW _
) As Boolean

I have also found the website with all the numerical values of the SW
variables.
http://groups.google.ca/group/micros...0e393f06a7cd0e

Hope this helps.

Sorry

Miro
"Nathaniel" <De******@yahoo.comwrote in message
news:VP************@fe08.lga...
Im having a little trouble writting this code. ShowWindow() is not
declared.

"Nathaniel" <De******@yahoo.comwrote in message
news:LX*************@fe11.lga...
>How about other apps besides my own?

"Nathaniel" <De******@yahoo.comwrote in message
news:fG**************@fe09.lga...
>>How do I move windows in vb.net?



Aug 4 '06 #6
Ok, thanks for the help, but I have 2 more qustions;

1) How can I retrive a system process by the title, for example "Untitled -
Notpad"?

2)With this code I can Maximize, and minimize, how can I change the
position. There is no;

MyProcess.location...
Aug 4 '06 #7
To get a process by title, you will have to loop through it and search for

IF myProcesses(nCount).MainWindowTitle = "Untitled - Notepad"

I probably would "Upper" both sides just to be sure.

as for 2... I havnt learned that yet. Ive only been using vb.net for only a
couple weeks.
So thats why I mentioned that hopefully this will get you on the right
track.

We are probably very close, but I dont really know what to search for
online. - Sorry

I was hoping someone would add to this conversation as well. Perhaps start
a new thread
in the newsgroup? I would also Post it in 2 newsgroups at the same time.
Try to post it to
microsoft.public.dotnet.general ; microsoft.public.dotnet.languages.vb

Sorry,

Miro

"Nathaniel" <De******@yahoo.comwrote in message
news:Gb*************@fe10.lga...
Ok, thanks for the help, but I have 2 more qustions;

1) How can I retrive a system process by the title, for example
"Untitled - Notpad"?

2)With this code I can Maximize, and minimize, how can I change the
position. There is no;

MyProcess.location...

Aug 4 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: KalleD | last post by:
Why can I not move the windows taskbar with the SHAppBarMessage function? I am able to use the function for hiding it and other things, but not moving it (I have unchecked the lock). The code is...
4
by: Ron Mexico | last post by:
Hi, Currently have an app that maintain that is written in VB6 and uses an access db (backend db only used as a data store not writing to the db). This app is a client app not server multi-teir...
0
by: Michael Johnson Sr. | last post by:
I have an application which I developed in C# ASP.NET. It uses SQL Server which is on a Virtual PC using Virtual PC 2004. It works great, no problems. I moved the user controls, aspx files,...
6
by: Woody Splawn | last post by:
I have been using SQL Server 2000 on my stand-alone machine as a back-end to a VS.net application. It is time to switch environments and take the application to the customer. I need to install...
3
by: Just Me | last post by:
If I move the mouse cursor over a control and stop moving I get a MouseHover event. If I then move the cursor while staying within the control and then stop moving I do not get another...
2
by: Carl Gilbert | last post by:
Hi I have a math kinda problem where I'm trying to split some lines when two or more lines connect two shapes. The reason I am doing this is to make it clear that there are multiple lines...
2
by: 63q2o4i02 | last post by:
Hi, I'm using python 2.4 and windows XP. I have two packages in the windows version of python in site-packages. They are PyVisa and ctypes, and both live in c:\python24\lib\site-packages ...
7
by: =?Utf-8?B?TW9iaWxlTWFu?= | last post by:
Hello everyone: I am looking for everyone's thoughts on moving large amounts (actually, not very large, but large enough that I'm throwing exceptions using the default configurations). We're...
1
by: rsteph | last post by:
I bought a book to help me learn to use DirectX with windows programming. It's first trying to walk me through some basic windows programming and graphics before getting into DirectX. I'm trying to...
0
by: Studlyami | last post by:
I am trying to find how windows translate the input from a HID device to an actual windows message; specifically, the mouse. I am trying to figure out how when the mouse moves the process windows...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.