473,320 Members | 2,111 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,320 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 1329
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
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.