Killing the proper messenger

new topic     » topic index » view thread      » older message » newer message

I’m working on some code to automatically close down console error windows
caused by faulty EU programs (e.g. a client app calls ?1/0 produces a 
console error window). Using PatRat’s window functions, window.ew, I can
easily find the console windows. I already know the windows handle of the
offending client application. How can I tell if the console window I’ve
located really belongs to my offending app?

I’ve tried the following, which always returns 0 for console windows. 
Can somebody spot my error or point me in the proper direction? Thanks!

Reproduced Code Fragment Follows - you'll get the idea:
atom kill_console kill_console = True
sequence console_class console_class = "ConsoleWindowClass"

if kill_console then
   window_list = window_GetHwnds(crash_junk[pulse_app_name])
   if length(window_list) then
      for i = 1 to length(window_list) do
         if equal(GetClassName(window_list[i]), console_class) then

            -- tried this but doesn't work for apps outside of itself
            -- win_parent = sprint(getHandle(findParentWindow(window_list[i])))

            -- problem exists here -- always returns 0
             win_parent = w32Func(xGetWindow,{ window_list[i], GW_OWNER})
             
            if win_parent = crash_junk[pulse_handle_main] then
               pulse_message("found console window matching " &
                  crash_junk[pulse_app_name] & " attempting to force close " &
                  sprint(window_list[i]))
               window_PostCloseMessage(window_list[i])
            end if
         end if
      end for
   end if
end if


Yours, OtterDad

Don't sweat it -- it's not real life. It's only ones and zeroes. Gene Spafford

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu