JWorld@TW the best professional Java site in Taiwan
      註冊 | 登入 | 全文檢索 | 排行榜  

» JWorld@TW » Java 技巧文件  

按列印兼容模式列印這個話題 列印話題    把這個話題寄給朋友 寄給朋友    訂閱主題
reply to topicthreaded modego to previous topicgo to next topic
本主題所含的標籤
無標籤
作者 如何get到電腦正在運行的task? [精華]
peterabcd





發文: 13
積分: 0
於 2003-10-02 20:13 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list

如何get到紅圈部分的list?
THX!


reply to postreply to post
作者 Re:如何get到電腦正在運行的task? [Re:peterabcd]
Dream

Hope has a place



發文: 31
積分: 1
於 2003-10-05 02:22 user profilesend a private message to usersend email to Dreamreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
No sure if I understand your question Wink but here is my answer
1) check processes tab which is right next to Applications
- or -
2) use Process View which come with Norton System Work


reply to postreply to post
I'm old enough to run against the wind and chase after my dream ...
作者 Re:如何get到電腦正在運行的task? [Re:peterabcd]
jini

SoftLeader Taiwan

版主

發文: 1266
積分: 23
於 2003-10-06 01:30 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
這是個麻煩的問題

目前唯一的解決方法, 大概要透過 JNI 去呼叫了

我沒記錯的話

應該是 psapi.dll ,, try to read the MSDN for this 吧


reply to postreply to post
作者 Re:如何get到電腦正在運行的task? [Re:jini]
jini

SoftLeader Taiwan

版主

發文: 1266
積分: 23
於 2003-10-06 01:51 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/perfmon/base/enumerating_all_processes.asp
這是 psapi 的 c++ sample code

in JNI 應該是
1
2
3
4
5
6
7
8
hInstLib = LoadLibraryA("PSAPI.DLL");
if(hInstLib == NULL)
{
env->ReleaseStringUTFChars(_szToTerminate, szToTerminate);
return NULL;
}
lpfEnumProcessesModules = (BOOL(WINAPI *)(DWORD *,DWORD,DWORD*)) GetProcAddress( hInstLib, " EnumProcessModules" ) ;
 


好久沒看到 c++, 看了之後發現好陌生...
這是我曾經寫過的程式嗎 >"<


reply to postreply to post
作者 Re:如何get到電腦正在運行的task? [Re:jini]
im1000



版主

發文: 149
積分: 7
於 2003-11-02 15:26 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
意外發現的...

http://sourceforge.net/projects/jntservices/

不過這個是處理服務( Service ) 的,
但是可以參考原始碼.. u could crete jntprocess project !


reply to postreply to post
作者 Re:如何get到電腦正在運行的task? [Re:im1000]
yuezhong





發文: 2
積分: 1
於 2004-11-06 04:27 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
我有个方法,在winxp 下有个工具是 tasklist.exe

你使用

Runtime.exec("tasklist.ext");

getInputStream();

会返回来文字,然后在parse it。。。。


reply to postreply to post
作者 Re:如何get到電腦正在運行的task? [Re:yuezhong]
battle





發文: 2
積分: 0
於 2004-11-20 23:30 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
yuezhong wrote:
我有个方法,在winxp 下有个工具是 tasklist.exe

你使用

Runtime.exec("tasklist.ext");

getInputStream();

会返回来文字,然后在parse it。。。。


不過只有xp的才可以,2000的就不行了


reply to postreply to post
作者 Re:如何get到電腦正在運行的task? [Re:yuezhong]
funy





發文: 78
積分: 0
於 2005-01-03 02:40 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import java.io.*;
 
/**
* Demonstrates how to run a program and read it"s output
***/
public class ProcessDemo
{
     public static void main(String args[]) throws Exception
     {
           Process process = Runtime.getRuntime().exec("tasklist.exe");
           InputStream standardOutput = process.getInputStream(),
                             standardError   = process.getErrorStream();
 
           int c;
           System.out.println(" [ Standard Output ]");
           while ((c = standardOutput.read()) != -1)
              System.out.print((char)c);
 
           System.out.println(" [ Standard Error ]");
           while ((c = standardError.read()) != -1)
              System.out.print((char)c);
 
           standardOutput.close();
           standardError.close();
     }
}//


browser edited on 2005-01-03 08:44
reply to postreply to post
作者 Re:如何get到電腦正在運行的task? [Re:battle]
Fily





發文: 2
積分: 0
於 2005-10-10 18:48 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
battle wrote:
不過只有xp的才可以,2000的就不行了


的確是如此 Angry


reply to postreply to post
作者 Re:如何get到電腦正在運行的task? [Re:peterabcd]
bybsky





發文: 3
積分: 0
於 2005-10-13 09:17 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
very good

reply to postreply to post
╭⌒╮打雷了下雨了╭⌒╮ ╭⌒╮~⌒╮
╭⌒╭⌒╮╭⌒╮~╭⌒╮ ~︶︶、︶︶
~︶︶︶︶、︶~~ 、 ︶︶ 、 、、 、
   、 、、  、 、 、 、
        大家快收衣服啊......
» JWorld@TW »  Java 技巧文件

reply to topicthreaded modego to previous topicgo to next topic
  已讀文章
  新的文章
  被刪除的文章
Jump to the top of page

JWorld@TW 本站商標資訊

Powered by Powerful JuteForum® Version Jute 1.5.8