473,414 Members | 1,622 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,414 software developers and data experts.

how to control another program that is running

Tee
Hi,

Does anyone know how to control another program that is running?

Eg: I would like to control the outlook express and tells it to minimize.

Thanks.
Jul 21 '05 #1
5 1331
Hi,

Use the process class to find outlook express (msimn is
process name) and use setwindowslong to minimize it. Here is an example.
Api declares and constants
Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _

(ByVal hwnd As IntPtr, ByVal nIndex As Integer, _

ByVal dwNewLong As Integer) As Integer

Const WS_MINIMIZE As Integer = &H20000000

Const GWL_STYLE As Integer = (-16)

How to find and minimize

For Each p As Process In Process.GetProcessesByName("msimn")

SetWindowLong(p.MainWindowHandle, GWL_STYLE, WS_MINIMIZE)

Next

Ken

-----------------------

"Tee" <th*@streamyx.com> wrote in message
news:us**************@TK2MSFTNGP11.phx.gbl...
Hi,

Does anyone know how to control another program that is running?

Eg: I would like to control the outlook express and tells it to minimize.

Thanks.

Jul 21 '05 #2
Tee
It changed my outlook express to full screen!
Any idea why?
"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:#9*************@TK2MSFTNGP15.phx.gbl...
Hi,

Use the process class to find outlook express (msimn is
process name) and use setwindowslong to minimize it. Here is an example.
Api declares and constants
Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _

(ByVal hwnd As IntPtr, ByVal nIndex As Integer, _

ByVal dwNewLong As Integer) As Integer

Const WS_MINIMIZE As Integer = &H20000000

Const GWL_STYLE As Integer = (-16)

How to find and minimize

For Each p As Process In Process.GetProcessesByName("msimn")

SetWindowLong(p.MainWindowHandle, GWL_STYLE, WS_MINIMIZE)

Next

Ken

-----------------------

"Tee" <th*@streamyx.com> wrote in message
news:us**************@TK2MSFTNGP11.phx.gbl...
Hi,

Does anyone know how to control another program that is running?

Eg: I would like to control the outlook express and tells it to minimize.

Thanks.

Jul 21 '05 #3
"Tee" <th*@streamyx.com> schrieb:
Does anyone know how to control another program that is running?

Eg: I would like to control the outlook express and tells it to minimize.


\\\
Private Declare Function ShowWindow Lib "user32.dll" ( _
ByVal hwnd As IntPtr, _
ByVal nCmdShow As Int32 _
) As Int32

Private Const SW_MINIMIZE As Int32 = 6
..
..
..
ShowWindow(p.MainWindowHandle, SW_MINIMIZE)
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Jul 21 '05 #4
I want to add a little bit more info to make this work.

Dim curr As Long
curr = GetWindowLong(hWnd, GWL_STYLE)
curr = x Or WS_MINIMIZE
SetWindowLong(hWnd, GWL_STYLE, x)

That should work :)

- Sahil Malik
http://codebetter.com/blogs/sahil.malik/
"Tee" <th*@streamyx.com> wrote in message
news:uq**************@tk2msftngp13.phx.gbl...
It changed my outlook express to full screen!
Any idea why?
"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:#9*************@TK2MSFTNGP15.phx.gbl...
Hi,

Use the process class to find outlook express (msimn is
process name) and use setwindowslong to minimize it. Here is an example.
Api declares and constants
Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _

(ByVal hwnd As IntPtr, ByVal nIndex As Integer, _

ByVal dwNewLong As Integer) As Integer

Const WS_MINIMIZE As Integer = &H20000000

Const GWL_STYLE As Integer = (-16)

How to find and minimize

For Each p As Process In Process.GetProcessesByName("msimn")

SetWindowLong(p.MainWindowHandle, GWL_STYLE, WS_MINIMIZE)

Next

Ken

-----------------------

"Tee" <th*@streamyx.com> wrote in message
news:us**************@TK2MSFTNGP11.phx.gbl...
Hi,

Does anyone know how to control another program that is running?

Eg: I would like to control the outlook express and tells it to minimize.

Thanks.


Jul 21 '05 #5
"Sahil Malik" <co*****************@nospam.com> schrieb:
I want to add a little bit more info to make this work.

Dim curr As Long
'Long' -> 'Int32'.
curr = GetWindowLong(hWnd, GWL_STYLE)
curr = x Or WS_MINIMIZE
SetWindowLong(hWnd, GWL_STYLE, x)


--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Jul 21 '05 #6

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

Similar topics

1
by: Will Stuyvesant | last post by:
I never used the popen or popen2 libraries but it is my understanding that they can capture the output of console based programs. Is it also possible to send keystrokes to console base programs? ...
2
by: zapazap | last post by:
Dear Snake Charming Gurus, (Was: http://mail.python.org/pipermail/python-list/2004-January/204454.html) First, a thank you to Tim Golden, Thomas Heller, and Mark Hammond for your earlier help...
5
by: Charles Law | last post by:
Sorry for reposting this question, but I did not get a single answer last time, and I'm sure you guys must have some thoughts on the matter. I have a user control which can be dragged and dropped...
11
by: Hoku | last post by:
I am using dual monitors on a dual head ATI AGP4x video card. I installed the Nov 11 2005 release of ATI's catalyst control center with Hydravision to manage the dual monitor setup. I recently...
0
by: ChopStickr | last post by:
I have a custom control that is embedded (using the object tag) in an html document. The control takes a path to a local client ini file. Reads the file. Executes the program specified in...
2
by: dragonslayer008 | last post by:
Hello group, I'm making a custom control in C++/CLI. The control builds fine. To test the control, I made a C# Forms application. On the Toolbox, I right clicked and chose "Choose Items". I...
4
by: David | last post by:
I'm using the AxSHDocVw.WebBrowser control to download data from a webpage at work (it's an internal page on my company's intranet). The page produces a runtime error after a while and the...
1
by: adstheman | last post by:
Hi all, I'm testing new versions of our suite of software products on different Windows platforms and found this strange problem the other day. When running the test release on a clean Windows...
3
by: Scott | last post by:
I have a requirement to control a firefox web browser from an external python program. The python program running under linux from a command shell needs to first find all open firefox web browser...
0
by: bruce | last post by:
hi mike.... you might look at/into selenium, or firewatir.... check the spellings! -peace -----Original Message-----
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?
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
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
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.