File: w_main.srw
Size: 3239
Date: Fri, 30 May 2025 01:46:34 +0200
$PBExportHeader$w_main.srw
forward
global type w_main from window
end type
type st_2 from statictext within w_main
end type
type cb_process from commandbutton within w_main
end type
type lb_list from listbox within w_main
end type
type cb_cancel from commandbutton within w_main
end type
end forward

global type w_main from window
integer width = 3598
integer height = 2292
boolean titlebar = true
string title = "Process List"
boolean controlmenu = true
long backcolor = 67108864
string icon = "AppIcon!"
boolean center = true
st_2 st_2
cb_process cb_process
lb_list lb_list
cb_cancel cb_cancel
end type
global w_main w_main

on w_main.create
this.st_2=create st_2
this.cb_process=create cb_process
this.lb_list=create lb_list
this.cb_cancel=create cb_cancel
this.Control[]={this.st_2,&
this.cb_process,&
this.lb_list,&
this.cb_cancel}
end on

on w_main.destroy
destroy(this.st_2)
destroy(this.cb_process)
destroy(this.lb_list)
destroy(this.cb_cancel)
end on

event open;Environment le_env

GetEnvironment(le_env)

this.Title = "Process List (x" + String(le_env.ProcessBitness) + ")"

end event

type st_2 from statictext within w_main
integer x = 73
integer y = 2048
integer width = 480
integer height = 100
integer textsize = -10
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Segoe UI"
long textcolor = 33554432
long backcolor = 67108864
string text = "Count: 88"
boolean focusrectangle = false
end type

type cb_process from commandbutton within w_main
integer x = 73
integer y = 64
integer width = 407
integer height = 132
integer taborder = 20
integer textsize = -10
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Segoe UI"
string text = "Process"
end type

event clicked;n_processlist ln_pl
Long ll_idx, ll_max
String ls_ExeFile[], ls_FullExeFile[]
ULong lul_ProcessId[]

lb_list.Reset()
st_2.Text = ""

ll_max = ln_pl.ProcessList(lul_ProcessId, ls_ExeFile, ls_FullExeFile)

For ll_idx = 1 To ll_max
   lb_list.AddItem(String(lul_ProcessId[ll_idx]) + " " + &
                     ls_FullExeFile[ll_idx])
Next

st_2.Text = "Count: " + String(ll_max)

end event

type lb_list from listbox within w_main
integer x = 73
integer y = 256
integer width = 3442
integer height = 1732
integer taborder = 10
integer textsize = -10
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Segoe UI"
long textcolor = 33554432
boolean hscrollbar = true
boolean vscrollbar = true
boolean sorted = false
borderstyle borderstyle = stylelowered!
end type

type cb_cancel from commandbutton within w_main
integer x = 3182
integer y = 2044
integer width = 334
integer height = 112
integer taborder = 10
integer textsize = -10
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Segoe UI"
string text = "Cancel"
boolean cancel = true
end type

event clicked;Close(Parent)

end event