how to pass process to wait state

mrpatil
mrpatil used Ask the Experts™
on
i want to transfer the process from running state to wait state how i can perform this using vb.net
e.g
i want to transfer the" windows media player " running state to wait state for 5sec.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Kamaraj SubramanianApplication Support Analyst

Commented:
try WaitForInputIdle method
Most Valuable Expert 2012
Top Expert 2014

Commented:

Commented:
threading.currentthread.sleep(5000) ?
Become a CompTIA Certified Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

Most Valuable Expert 2012
Top Expert 2014

Commented:
>i want to transfer the" windows media player " running state to wait state for 5sec.
Do you want to pause the playback?
It would be helpful if you comeback and answer our comments!

Author

Commented:
sorry for late comment
no i don't want pause only playback
i want to wait/stop  working of media player for 5sec
Most Valuable Expert 2012
Top Expert 2014

Commented:
>i want to wait/stop  working of media player for 5sec
The work media player does is to play movies/songs. Do you want to pause it but keep the track playing?

Author

Commented:
media player it just for example
i want to wait/stop working of application select by user for seconds

Commented:
Make function that passes the time and add this :

 Threading.Thread.Sleep(5000)
 Threading.Thread.Resume()

This will freeze the program for 5sec, so if you want your program to be active, make sure you start a different thread to do your task and use the function above to freeze hold it for an amount of seconds..

Hope this helps...
Most Valuable Expert 2012
Top Expert 2014

Commented:
>Hope this helps...
It wont! If you read again that the discussion is about freezing a third party application such as a standalone media player not our own application!

Commented:
CodeCruiser you're right, overlooked that part...

Well then the answer is simple, you can't just suspend/resume a processes
(to my knowing that is, CodeCruiser what's your view on this ?)

For media player you could try API calls (sending keys to the application or something), but this will be different for each application.

Author

Commented:
can i set priority of that process to low
Most Valuable Expert 2012
Top Expert 2014

Commented:
Commented:
Yes can do this :
(CodeCruiser your example is for VB6, it will work because it's using API calls, but this function is build in .NET)

More information on processes :
http://www.codeproject.com/KB/shell/ManageProcessShellAPI.aspx

Dim p1 As System.Diagnostics.Process() = System.Diagnostics.Process.GetProcessesByName("NOTEPAD")
p1.PriorityClass = ProcessPriorityClass.Low

Open in new window

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial