とりあえずプロセス名を調べるスクリプト。
どこかは忘れたけどどっかにあったやつ。
#define TITLENAME "モジュール取得 サンプル"
#uselib "kernel32.dll"
#func CreateToolhelp32Snapshot "CreateToolhelp32Snapshot" int,int
#func Module32First "Module32First" int , sptr
#func Module32Next "Module32Next" int , sptr
#func Process32First "Process32First" int , sptr
#func Process32Next "Process32Next" int , sptr
#func CloseHandle "CloseHandle" int
#uselib "user32.dll"
#func GetWindowLongA "GetWindowLongA" int,int
#func SetWindowLongA "SetWindowLongA" int,int,int
#func SetWindowPos "SetWindowPos" int,int,int,int,int,int,int
#func MoveWindow "MoveWindow" int,int,int,int,int,int
dim er
dim lb1
dim lb2
sdim lbdata , 1024
sdim data , 260
sdim mbdata , 1024
dim hpsnap
dim hmsnap
dim p_entry, 74
dim p_id , 64
dim m_entry, 137
objsize 300 , 20
pos 0 , 0 : button "プロセスの更新" , *get_process
objsize ginfo_winx , 110
pos 0 , 20: listbox lb1 , 10 , lbdata
pos 0 , 130: mesbox mbdata , ginfo_winx , ginfo_winy-130
gosub *get_process
oncmd gosub *WM_SIZE , 0x0005
oncmd gosub *WM_CLOSE , 0x0010
*main
if lb1 != lb2{
gosub *get_module
lb2 = lb1
}
wait 10
goto *main
//////////////////////////////////////////////////////////////
//プロセスの取得
*get_process
CreateToolhelp32Snapshot 0x0f , 0
hpsnap = stat
if hpsnap==-1 : dialog "CreateToolhelp32Snapshot error" : stop
dim p_id , 64
lbdata="" : notesel lbdata
p_entry(0) = 296
Process32First hpsnap , varptr(p_entry)
er = stat
repeat -1
if er == 0 : break
getstr data , p_entry , 36 , '\0'
noteadd data , -1
p_id(cnt) = p_entry(2)
Process32Next hpsnap , varptr(p_entry)
er = stat
loop
objprm 1 , lbdata
objprm 1 , 0
CloseHandle hpsnap
return
//////////////////////////////////////////////////////////////
//モジュールの取得
*get_module
CreateToolhelp32Snapshot 0x0f , p_id(lb1)
hmsnap = stat
if hmsnap==-1{
title TITLENAME +" : error"
objprm 2 , ""
return
}
notesel lbdata : noteget data , lb1
title TITLENAME+" : "+data
mbdata = "" : notesel mbdata
m_entry(0) = 548
Module32First hmsnap , varptr(m_entry) : er = stat
repeat -1
if er == 0 : break
getstr data , m_entry , 288 , '\0'
noteadd data , -1
Module32Next hmsnap , varptr(m_entry) : er = stat
loop
objprm 2 , mbdata
CloseHandle hmsnap
return
*WM_SIZE
MoveWindow objinfo(0,2) , 0 , 0 , ginfo_winx , 20 , 1
MoveWindow objinfo(1,2) , 0 , 20 , ginfo_winx , 110 , 1
MoveWindow objinfo(2,2) , 0 , 130 , ginfo_winx , ginfo_winy-130 , 1
return
*WM_CLOSE
if hsnap!=0 : CloseHandle hpsnap
return