Graphicobject which_cont//控件名称变量
commandbutton cb_which //cb变量
which_cont=GetFocus()//得出当前具有焦点的控件名称。
if key = keyenter! then
if typeof(which_cont)=commandbutton! then//如果是cb得到焦点时,执行单击事件。
cb_which=which_cont
cb_which.triggerevent(clicked!)
else
keybd_event(9,0,0,0)
keybd_event(9,0,2,0)
end if
end if
首先要定义keybd_event()这个api函数