mr_unreliable
Mon Mar 24 17:48:58 CDT 2008
Dan wrote:
> I'm trying to create a modal messagebox that will not allow users to move the
> focus away from the messagebox without first answering the question.
Dan, as the other folks said, you can't get what you want
with vbScript.
If you are absolutely determined to hold the focus (from script),
you are going to have to write some actX object which will do
system hooking -- and the "CBT Hook" should do it for you.
http://msdn2.microsoft.com/en-us/library/ms644977(VS.85).aspx
After you set the hook, the system will notify you when various
events are about to take place. One of the notifications
is: HCBT_SETFOCUS, meaning another window is about to receive
focus. At that point, you take over and "steal" the focus
back to where you want it. And, you keep stealing it back,
until your user answers your question (then UN-hook).
Maybe somebody else will come along with a better answer,
but afaik, using system hooks is the only way.
cheers, jw
____________________________________________________________
You got questions? WE GOT ANSWERS!!! ..(but,
no guarantee the answers will be applicable to the questions)