■掲示板に戻る■ 全部 1- 最新50

【コンソール】udstat2txt【コマンドライン】

1: 名無しのtester : 04/02/20 19:37 ID:aVovqg76
UDAgentの処理状況をコンソール画面で取得するツール
udstat2txt のスレです

udstat2txt.exe
で進行度を数値で
udstat2txt.exe detail
で詳細なデータを取得

タスクトレイのアイコンを消している場合(青豆等使用時)は値を取得できない可能性有り

http://f99aq.hp.infoseek.co.jp/udstat2txt.zip
ソース >2-
UDの詳細は http://ud-team2ch.net:8080/

2: 名無しのtester : 04/02/20 19:44 ID:aVovqg76
const int TIPBUFFERSIZE = 1024;

using namespace std;

int main(int argc, char* argv[]){
 HWND trayWnd = FindWindowEx(NULL, NULL, "Shell_TrayWnd", NULL);
 trayWnd = FindWindowEx(trayWnd, NULL, "TrayNotifyWnd", NULL);
 HWND xpTrayWnd = FindWindowEx(trayWnd, NULL, "SysPager", NULL);
 if(xpTrayWnd){
  trayWnd = xpTrayWnd;
 }
 trayWnd = FindWindowEx(trayWnd, NULL, TOOLBARCLASSNAME, NULL);

 //--------------------------------------------------
 DWORD PID;
 GetWindowThreadProcessId(trayWnd, &PID);
 HANDLE hProcess = OpenProcess(PROCESS_VM_OPERATION | PROCESS_VM_READ | PROCESS_VM_WRITE, FALSE, PID);
 if(!hProcess){
  MessageBox(NULL, "取得失敗", NULL, MB_OK);
 }

3: 名無しのtester : 04/02/20 19:44 ID:aVovqg76
 TBBUTTON *pSysTBButton = static_cast<TBBUTTON *>(
  VirtualAllocEx(hProcess, NULL, sizeof TBBUTTON, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE));

 char tiptext[TIPBUFFERSIZE];
 char *pTiptext = static_cast<char *>(
  VirtualAllocEx(hProcess, NULL, sizeof tiptext, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE));

 TBBUTTONINFO *pSysTBButtonInfo = static_cast<TBBUTTONINFO *>(
  VirtualAllocEx(hProcess, NULL, sizeof TBBUTTONINFO, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE));

 TBBUTTON TBButton;
 TBBUTTONINFO TBButtonInfo;

 TBButtonInfo.cbSize = sizeof TBBUTTONINFO;
 TBButtonInfo.dwMask = TBIF_TEXT;
 TBButtonInfo.pszText = pTiptext;
 TBButtonInfo.cchText = sizeof tiptext;

 long btnCount = static_cast<long>(SendMessage(trayWnd, TB_BUTTONCOUNT, 0, 0));

4: 名無しのtester : 04/02/20 19:45 ID:aVovqg76
 for(int i = 0; i < btnCount; ++i){
  SendMessage(trayWnd, TB_GETBUTTON, i, (LPARAM)pSysTBButton);
  ReadProcessMemory(hProcess, pSysTBButton, &TBButton, sizeof TBBUTTON, NULL);

  WriteProcessMemory(hProcess, pSysTBButtonInfo, &TBButtonInfo, sizeof TBBUTTONINFO, NULL);
  SendMessage(trayWnd, TB_GETBUTTONINFO, TBButton.idCommand, (LPARAM)pSysTBButtonInfo);
  ReadProcessMemory(hProcess, pTiptext, &tiptext, sizeof tiptext, NULL);

  const char *target = "UD Agent - ";
  if(_tcsstr(tiptext, target)){
   if(argc == 2 && _tcsstr(argv[1], "detail")){
    cout << tiptext + _tcslen(target) << endl;
   }else{
    int progress = 0;
    _stscanf(tiptext, "UD Agent - Primary task is executing (%d%% done)...", &progress);
    stringstream buf;
    buf << progress;
    string buf2 = buf.str();
    cout << buf2 << endl;
   }
   break;
  }
 }

5: 名無しのtester : 04/02/20 19:45 ID:aVovqg76
 VirtualFreeEx(hProcess, pSysTBButton, 0, MEM_RELEASE);
 VirtualFreeEx(hProcess, pTiptext, 0, MEM_RELEASE);
 VirtualFreeEx(hProcess, pSysTBButtonInfo, 0, MEM_RELEASE);

 CloseHandle(hProcess);

 return 0;
}

6: 名無しのtester : 04/02/21 15:41 ID:3i9Zl1ZA
scanfあたりが適当でスマソ

7: 名無しのtester : 04/02/24 12:03 ID:vgiR0ou6
http://f99aq.hp.infoseek.co.jp/readme.txt
暫定私を読んで

8: 名無しのtester : 04/02/24 14:46 ID:vgiR0ou6
udstat2txt2

コマンドプロンプトにて
udstat2txt2.exe
で進行度を数値を取得

http://f99aq.hp.infoseek.co.jp/udstat2txt2.zip

詳細情報は取れませんがwin98(もしかしたら95)でも動きます。
UDのアイコンをタスクトレイから消していても動きます。
と思います。。。
2なのに退化…
以下ソース

9: 名無しのtester : 04/02/24 14:48 ID:vgiR0ou6
#define WIN32_LEAN_AND_MEAN

#include <windows.h>
#include <tchar.h>
#include <iostream>

using namespace std;

BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam);
BOOL CALLBACK EnumChildProc(HWND hWnd, LPARAM lParam);

const int  BUFSIZE = 256;
bool  finish = false;

int main(int argc, char* argv[]){
  //列挙開始
  int  progress(0);
  EnumWindows(EnumWindowsProc, (LPARAM)&progress);

  if(progress){
    cout << progress * 100 / 228 << endl;
  }

  return 0;

10: 名無しのtester : 04/02/24 14:49 ID:vgiR0ou6
}

BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam){
  //Window Classが一致するか
  TCHAR  *UDclassName = "ThunderRT6FormDC";
  TCHAR  ClassName[BUFSIZE];
  GetClassName(hWnd, ClassName, sizeof ClassName - 1);
  if(!_tcsstr(ClassName, UDclassName)){
    return TRUE;
  }
  EnumChildWindows(hWnd, EnumChildProc, lParam);

  if(finish){
    return FALSE;
  }
  return TRUE;
}

BOOL CALLBACK EnumChildProc(HWND hWnd, LPARAM lParam){
  int  *progress = (int *)lParam;

  //Window Classが一致するか
  TCHAR  *UDclassName = "ThunderRT6PictureBoxDC";
  TCHAR  ClassName[BUFSIZE];

11: 名無しのtester : 04/02/24 14:49 ID:vgiR0ou6
  GetClassName(hWnd, ClassName, sizeof ClassName - 1);
  if(!_tcsstr(ClassName, UDclassName)){
    return TRUE;
  }

  RECT  rect = {0};
  GetWindowRect(hWnd, &rect);

  //(227,7)
  if(rect.right - rect.left == 227 && rect.bottom - rect.top == 7){
    HWND  child = FindWindowEx(hWnd, NULL, "ThunderRT6PictureBoxDC", NULL);
    if(child){
      RECT  crect = {0};
      GetWindowRect(child, &crect);
      *progress = crect.right - crect.left + 1;
    }

    finish = true;
    return FALSE;
  }

  return TRUE;
}

12: 名無しのtester : 04/04/08 15:56 ID:Tph4pbUU
Samurizeへの組み込み方

13: 名無しのtester : 04/04/08 15:57 ID:Tph4pbUU
[Project]
FileVersion=v1.15
OffsetX=10
OffsetY=10
Width=240
Height=150
Interval=1200
ReloadKey=
PauseKey=
LoadMBMStarter=0
TrayIcon=MAINICON

[Source 0]
Type=TConsoleCollector
Command=C:\Program Files\Samurize\Scripts\udstat2txt.exe detail
UpdateInterval=1

[Output 0]
Type=TTextOutput
Text=%v
Color=FFFFFFFF
Align=0
AlignVertical=0
FontName=Tahoma

14: 名無しのtester : 04/04/08 15:57 ID:Tph4pbUU
FontSize=10
FontStyle=[]
LineSpacing=1
NrOfDecimals=0
TabSize=8
Left=10
Top=140
Right=250
Bottom=160
AllowLink=0
Link=
AllowAlertValue=0
AlertValue=
AlertColor=FF0000FF
AlertColor2=FFFF0000
AlertWhen=0

[Source 1]
Type=TConsoleCollector
Command=C:\Program Files\Samurize\Scripts\udstat2txt.exe
UpdateInterval=1

[Output 1]
Type=TPieOutput

15: 名無しのtester : 04/04/08 15:58 ID:Tph4pbUU
Color1=2CFFFFFF
Sweep=360
StartAngle=90
Min=0
Max=100
InnerRadius=81
BGColor=55000000
AllowBGColor=0
Left=70
Top=10
Right=220
Bottom=160
AllowLink=0
Link=
AllowAlertValue=0
AlertValue=
AlertColor=FF0000FF
AlertColor2=FFFF0000
AlertWhen=0

16: 名無しのtester : 04/04/08 16:02 ID:Tph4pbUU
>>13-15をhoge.iniなどと名前をつけて
C:\Program Files\Samurize\Configs
に保存する

C:\Program Files\Samurize\Scripts

udstat2txt.exe
を入れる

侍zを起動してタスクトレイアイコンから[Select Config File]で
さっき保存したiniを選択する。
後は好みでタスクトレイアイコンの[Edit Config File...]で
配置や色サイズ等を調節する

17: 名無しのtester : 06/01/03 00:29 ID:GJ0d6E0U
偶然見つけました。感謝です。

ついでに細かいところを。
*progress = crect.right - crect.left + 1 でなくて、
*progress = crect.right - crect.left   で、

%値は progress * 100 / 228 でなくて、
if (progress==1) %値は 0;
else %値は int(progress * 100.0 / 227.0 + 0.5);
ではないかと。

18: あぼーん : あぼーん
あぼーん

19: あぼーん : あぼーん
あぼーん

20: あぼーん : あぼーん
あぼーん

21: あぼーん : あぼーん
あぼーん

22: 名無しのtester : 07/03/09 17:52 ID:MbGgBdtU
http://www.f99aq8ove.net/udstat2txt2.zip
に上げなおしてみました。
>17 さんの修正を入れて、コンパイルしようとしたらコンパイラが異常終了したので止めました。
windows を再インストールしないといけない予感です。

23: あぼーん : あぼーん
あぼーん

24: 名無しのtester : 07/10/13 16:37 ID:2GF2H5Gk
spam

8 KB
続きを読む

掲示板に戻る 全部 次100 最新50
名前: E-mail (省略可) :
read.cgi ver1.20aβ (Apr 16, 2004) by ◆F99a.q8oVE.
Processing time 0.000 sec.