Crashes on any Setfocus in Debug on win98se - any ideas?

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
Baldrik
Junior Coder
Posts: 24
Joined: Mon Feb 14, 2005 11:11 pm
Location: TA7, UK

Crashes on any Setfocus in Debug on win98se - any ideas?

Post by Baldrik » Tue Feb 15, 2005 8:31 pm

I seem to always get...

MSCHED caused an invalid page fault in
module MSCHED.EXE at 0167:00407750.
Registers:
EAX=00408ef4 CS=0167 EIP=00407750 EFLGS=00010213
EBX=007c065c SS=016f ESP=007bf3d0 EBP=007c055c
ECX=00000001 DS=016f ESI=81bf0320 FS=135f
EDX=007c0558 ES=016f EDI=007c065c GS=0000
Bytes at CS:EIP:
50 8b f2 8b d8 85 db 74 3d 81 7b 04 00 00 01 00
Stack dump:

when trying to step through the Setfocus line of this script:

//ifwindowopen>Untitled - Notepad
// wait>1
setfocus>Untitled - Notepad
// wait>2
//else
// wait>1
// run>c:\%win_dir%\notepad.exe
wait>2
//endif
goto>fin
...
label>fin
message>script finished
wait>3


Same error if do Run from within Editor, but it's ok if Run from main window (ie ok from not in the Script Edit).

I want to debug a script that starts off by running or switching to the application (depending on the ifwindowopen result) but always get the Page Fault if I do it on Win98se.

Problem doesn't happen on NT4. I'd be grateful for experiencees with Debug, eg how robust is it meant to be? (I'm a newbie on this product).

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Tue Feb 15, 2005 9:39 pm

The trouble is that script may find the editor while in debug since the editor contains the text in your SetFocus line. This could be causing the problem as the debugger attempts to focus itself? Doesn't surprise me that you get nasties in this case in Windows 98, but it's fine in NT.

You could try adding the following line at the start to prevent it focusing child windows (and hence the editor):

Let>WF_TYPE=0

That should ensure the script only finds the notepad window. This is the problem with debugging a simulation script. The debugger changes the environment and also effects the timing.
MJT Net Support
[email protected]

Guest

Post by Guest » Tue Feb 15, 2005 10:45 pm

Thanks for looking so quickly! Disallowing child windows could be good, but the (child) editor title is "Editor - NetT2" - not the name in the SetFocus. Does setfocus look at the text IN the window as well? (but if it did, then why, when it finishes ok on NT, are we left in the (intended) Notepad window, and not in the Editor?)

I read the manual as saying that a setfocus>abcd looks for the window who's TITLE is EXACTLY abcd, or possibly abc...anything (if d was an asterisk!).

I did see that some of the other window-searching verbs (certainly findwindowwithtext) look at text within, which would permit the it-focussed-the-editor-window explaination, but I thought it should find the right window (or at least one of possibly many notepads), and thought maybe Debug Step/Trace processing messes up somehow on the switching (in a win98-specific way) between the target & the editor windows (before & after each stepped or traced line). Refocus Windows is ticked.

Sorry to go on...

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Tue Feb 15, 2005 10:52 pm

Hmmm. Actually you're right - since you did not specify a wildcard it should only have found the notepad window, so my thoughts on why the error might occur were off base. There is something about the process and the editor window that is causing this error. But we've done many Notepad style test scripts and never seen an issue debugging under Windows 98 so it's certainly not a known problem. Does the problem persist after a reboot?
MJT Net Support
[email protected]

Guest

Post by Guest » Tue Feb 15, 2005 11:47 pm

It seems to be very reproducable here. However, (implied admission:) when I tried the WF_TYPE=0 it made it work!

To answer your question, if WF_TYPE=1 then the error happens every time, after rebooting, on a 2nd win98se pc, etc, and is always ok on NT4sp6 wrkstn (tried on 2 different, anyway). Could be worth a test...

To pursue the well-what-window-did-it-focus-then angle, I looked at all the window/button/etc names using Editor->Tools->ViewSystemWindows, and saw one for something called TSyntaxMemo that CONTAINED the "Untitled - Notepad" as PART of its window title, so could it have found that by mistake (no *) - maybe on win98 the * is implied???

Thanks again, and for now I'll add set the 0 value to force matching only a non-child, but I don't understand it!

Baldrik
Junior Coder
Posts: 24
Joined: Mon Feb 14, 2005 11:11 pm
Location: TA7, UK

Post by Baldrik » Tue Feb 15, 2005 11:57 pm

That was me, I logged on but must have got timed-out. Btw, the admission was I didn't try the =0 until after responding again.
Still a bit puzzled why it needs WF_TYPE=1 on win98 to prevent setfocus crashing when Stepped or Traced from the Editor...

Thanks and Regards.

Baldrik
Junior Coder
Posts: 24
Joined: Mon Feb 14, 2005 11:11 pm
Location: TA7, UK

Post by Baldrik » Tue Feb 15, 2005 11:59 pm

...needs WF_TYPE=0 , I mean...

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts