[Link]
Code: Select all
local function showModalForm(address)
local fW = 400 -- Form width
local lPush = 90 -- Label width
local sX = fW - (lPush + 10) -- Size X
local sY = 23 -- Size Y
local pX = 3 -- Position X
local pY = 3 -- Position Y
local bW = 75 -- Button Width
local bH = 24 -- Button Hight
local padF = 5 -- Form Padding
local pad1 = 3
local pad2 = 1
local row = 0
local frmHookSetup = createForm(false)
frmHookSetup.centerScreen()
frmHookSetup.setSize(fW, fH)
frmHookSetup.Name = 'frmHookSetup'
frmHookSetup.Caption = 'Hook Setup'
local lblHookAddress = createLabel(frmHookSetup)
lblHookAddress.Name = 'lblHookAddress'
lblHookAddress.setPosition(pX, pY + sY * row + pad1)
lblHookAddress.Caption = 'Address' .. ':'
local edHookAddress = createEdit(frmHookSetup)
edHookAddress.Name ='edHookAddress'
edHookAddress.setSize(sX, sY)
edHookAddress.setPosition(pX + lPush, pY + sY * row + pad2)
edHookAddress.Text = addressStr or address
row = row + 1
local lblHookName = createLabel(frmHookSetup)
lblHookName.Name = 'lblHookName'
lblHookName.setPosition(pX, pY + sY * row + pad1)
lblHookName.Caption = 'Hook Name' .. ':'
local edHookName = createEdit(frmHookSetup)
edHookName.Name = 'edHookName'
edHookName.setSize(sX, sY)
edHookName.setPosition(pX + lPush, pY + sY * row + pad2)
edHookName.Text = ''
row = row + 1
local cbxGenerateAob = createCheckBox(frmHookSetup)
cbxGenerateAob.Name = 'cbxGenerateAob'
cbxGenerateAob.setSize(sX, sY)
cbxGenerateAob.setPosition(pX + lPush, pY + sY * row + pad2)
cbxGenerateAob.Caption = 'Generate AOB'
row = row + 1
local btnOk = createButton(frmHookSetup)
btnOk.Name = 'btnOk'
btnOk.Caption = 'OK'
btnOk.setSize(bW, bH)
btnOk.setPosition((fW / 3) - (bW / 2), pY + sY * row + pad2)
btnOk.ModalResult = mrOK
btnOk.Default = true
local btnCancel = createButton(frmHookSetup)
btnCancel.Name = 'btnCancel'
btnCancel.Caption = 'Cancel'
btnCancel.setSize(bW, bH)
btnCancel.setPosition(((fW / 3) * 2) - (bW / 2), pY + sY * row + pad2)
btnCancel.ModalResult = mrCancel
btnCancel.Cancel = true
row = row + 1
frmHookSetup.setSize(fW, pY + sY * row + padF)
local mr = frmHookSetup.showModal()
local dt = {
Result = mr,
HookName = edHookName.Text,
Address = edHookAddress.Text,
GenerateAob = cbxGenerateAob.Checked,
}
return dt
end
local rdt = showModalForm('Game.exe+123ABC')
if rdt.Result == mrOK then
print(rdt.HookName)
print(rdt.Address)
print(tostring(rdt.GenerateAob))
end