Thanks Ralph,
That helped me a bit on the way. Also, I made a discovery. Not sure, exactly what was going on, but I'd leave it here, in case it might prove helpful to others. Sorry, I can't bring the full code here, since it is more like 450 lines.

Thing is, I called the ConnectEvent, and more or less right after that, I defined my personal sub for the Event. Further down, I had some more code, that would not necessarily have affected this set of lines - from what I can see. Still, out of some reason, the app insisted on hanging on me, throwing the same low-explanatory error message on me.

In the end, I moved the ConnectEvent line, to the very bottom of my code. And, guess what - all the sudden, everything works flawlessly.

So, for the rest of you, it seems to be an idea, to place your ConnectEvent lines, at the bottom of the code. Don't know, if this would be a general suggestion, or why my app did not behave until this had been done. But at least, if anyone experience a similar case - where you cannot get the ConectEvent to work - it might be worth a try to move it to the end of your code.

Well, just wanted to let you all know, in case it would benefit anyone.

Thanks for all assistance.

----- Original Message ----- From: "Ralf Kefferpuetz" <[email protected]>
To: <[email protected]>
Sent: Saturday, March 10, 2012 7:51 PM
Subject: RE: How to know - setfile questions


David, in the sub section you might need a variable like:
Sub MyOnChildActivate(Variable)
' some more code.
End Sub

Ralf Heinrich Kefferpuetz
Web: http://www.keffi.eu
Facebook: http://www.facebook.com/Keffi.eu
Germany

-----Original Message-----
From: David [mailto:[email protected]]
Sent: Saturday, March 10, 2012 2:04 PM
To: [email protected]
Subject: Re: How to know - setfile questions

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 <mailto:[email protected]>
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