473,399 Members | 3,401 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,399 software developers and data experts.

Using the process window - getting its size etc.

Hi, another newbie question on my slow-paced learning curve. :)

I've got this code that's pretty cool in that it gets the title of all
currently running apps and populates a combobox.

Dim objProcess As Process

cboProcessesList.Items.Clear()
For Each objProcess In System.Diagnostics.Process.GetProcesses
If objProcess.MainWindowTitle <> "" Then
cboProcessesList.Items.Add(objProcess.MainWindowTi tle)
End If
Next

So far so good. I want to be able to use the selected app from the
combobox to get the screen location of the app and also its height and
width. So basically I want to know the bounding box for the app and its
screen location, and to track it if the user moves it while running my app.

First one to reply gets a free copy of the finished product! :)

Hogan out.

Nov 20 '05 #1
3 983
Hi,

You can use the getwindowrect or getwindowplacement api call.

Ken
----------------
"Hogan's Goat" <ye**@right.com> wrote in message
news:Xn****************************@63.223.5.254.. .
Hi, another newbie question on my slow-paced learning curve. :)

I've got this code that's pretty cool in that it gets the title of all
currently running apps and populates a combobox.

Dim objProcess As Process

cboProcessesList.Items.Clear()
For Each objProcess In System.Diagnostics.Process.GetProcesses
If objProcess.MainWindowTitle <> "" Then
cboProcessesList.Items.Add(objProcess.MainWindowTi tle)
End If
Next

So far so good. I want to be able to use the selected app from the
combobox to get the screen location of the app and also its height and
width. So basically I want to know the bounding box for the app and its
screen location, and to track it if the user moves it while running my app.
First one to reply gets a free copy of the finished product! :)

Hogan out.

Nov 20 '05 #2
Can you show me an example of how I'd do this?
Hi,

You can use the getwindowrect or getwindowplacement api call.

Ken
----------------
"Hogan's Goat" <ye**@right.com> wrote in message
news:Xn****************************@63.223.5.254.. .
Hi, another newbie question on my slow-paced learning curve. :)

I've got this code that's pretty cool in that it gets the title of all
currently running apps and populates a combobox.

Dim objProcess As Process

cboProcessesList.Items.Clear()
For Each objProcess In System.Diagnostics.Process.GetProcesses
If objProcess.MainWindowTitle <> "" Then
cboProcessesList.Items.Add(objProcess.MainWindowTi tle)
End If
Next

So far so good. I want to be able to use the selected app from the
combobox to get the screen location of the app and also its height and
width. So basically I want to know the bounding box for the app and its
screen location, and to track it if the user moves it while running my

app.

First one to reply gets a free copy of the finished product! :)

Hogan out.


Nov 20 '05 #3
* "Hogan's Goat" <ye**@right.com> scripsit:
Can you show me an example of how I'd do this?


Quick and Dirty:

\\\
<StructLayout(LayoutKind.Sequential)> _
Private Structure RECT
Public Left, Top, Right, Bottom As Int32
End Structure

Private Declare Auto Function GetWindowRect Lib "user32.dll" ( _
ByVal hwnd As IntPtr, _
ByRef lpRect As RECT _
) As Int32
..
..
..
Dim r As New RECT
If GetWindowRect(<handle>, r) <> 0 Then
MsgBox(r.Left.ToString & ...)
End If
///

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #4

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

Similar topics

3
by: Random Person | last post by:
Does anyone know how to use VBA to relink tables between two MS Access databases? We have two databases, one with VBA code and the other with data tables. The tables are referenced by linked...
11
by: Grasshopper | last post by:
Hi, I am automating Access reports to PDF using PDF Writer 6.0. I've created a DTS package to run the reports and schedule a job to run this DTS package. If I PC Anywhere into the server on...
1
by: Daveyk0 | last post by:
Hello there, I have a front end database that I have recently made very many changes to to allow off-line use. I keep copies of the databases on my hard drive and link to them rather than the...
3
by: Rob | last post by:
Hi all, I am having trouble converting the code below (found on http://vbnet.mvps.org/index.html?code/core/sendmessage.htm) into a format that will work using vb .NET. Can anyone have a look...
3
by: anthonybrough | last post by:
I have an asp page that has a form to collect user data in a form. when the user clicks submit the input is validated. If any fields are not acceptable the user clicks on a button to go back to...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
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.