Hello Chip, and rest of gang.
Thanks Chip, for your ideas. I think you are right, and I will try hooking my 
script to the ModuleName of the Window object, as you suggested.

I ran into a snake here though - it seems. You suggested for me, to look out 
for the OnChildActivate event of the DesktopWindow - if I got you right. So, I 
tried the following line in my code, but got the message that the 
    object doesn't support this property or method.
Not sure, which property or method it is referring to, but have a clear feeling 
I am missing an important step. Any corrections will be greatly appriciated.

---Code snip----
  ConnectEvent DesktopWindow, "OnChildActivate", "MyOnChildActivate"
  'Yep, this is the line that throws the error.


  Sub MyOnChildActivate
  ' some more code.
  End Sub
  ---End of snip---

  From: Chip Orange 
  To: [email protected] 
  Sent: Monday, February 20, 2012 12:34 AM
  Subject: RE: How to know - setfile questions


  Hi David,

  You asked how to make your global app act differently depending on which 
program had the active window at the moment?  Looking at the active set file 
isn't a bad idea, however, because some programs are so complex, they can end 
up having many set files, any of which might be in use at the moment (I think I 
recall MS Word maybe having around 10?).  So, if you just test on the name of 
the primary set file, and one of these secondary ones is active, your app may 
not work as you want.

  There is something else you can test on: that would be the name of the 
program associated with the active window.  The way I do this, and the one I've 
seen used most often, is to test on the moduleName property of the activeWindow 
object.  I think for MS Word, or any other program, this module name should 
always remain constant, regardless of which of it's set files is loaded.

  Unfortunately, there is no event to tell you when the module has changed, so 
you would need to capture the window event for when a new window becomes the 
activeWindow, and when that happens see if the module name has changed (you 
would have to use the desktopWindow object, and the onChildActivate event to 
know when a new window has become active).

  I think this is better than testing on set file names, but if it's not, I'm 
sure you'll hear back from GW or someone.

  hth,

  Chip





----------------------------------------------------------------------------
    From: David [mailto:[email protected]] 
    Sent: Friday, February 17, 2012 10:57 PM
    To: [email protected]
    Subject: How to know - setfile questions


    I am in the planning process of a new app. Since this is all on the slate, 
I am not sure exactly what info to give, so my questions would be all in 
general. I did have a scroll look in the App-reference, but without luck; hence 
my questions go to the listers.

    1. Is there a way for my app, to retrieve info, as to which setfile is 
currently active? Something like an 
        ActiveSetFile 
    method?

    2. Is there any event, that fires whenever the setfile changes? I.e, if I 
am in the Explorer window, and I alt-tab to Firefox. Or, will I have to 
retrieve the activeSetfile at any given point, making my system loaded with a 
watching routine.

    At the planning state, where I am right now, I thought hooking on to the 
currently active setfile - at any given moment - might be the best way of 
handling my project. Specially so, since it will be behaving slightly 
differently from one application to the other. Is there any other method, that 
might be easier, if one wants to have a global app act differently in Explorer, 
than what it does in Firefox, or Outlook, or any other application?

    Thanks for any tips. Since I still am in a basic line of app developing for 
WE, I'd greatly appreciate if you could try to be as simple as possible in your 
reply. Thanks alot!

Reply via email to