From: Nobody on
"Rick Raisley" <heavymetal-A-T-bellsouth-D-O-Tnet> wrote in message
news:eO8b8HgcKHA.612(a)TK2MSFTNGP06.phx.gbl...
> <shudder>subclassing</shudder>
>
> I think I'm subclassing challenged. I avoid it like the plague, probably
> because of the IDE crashing problems when breaking to change code (which I
> do /all/ the time).
>
> If that's the only way, I'm afraid I'll have to leave this feature out.
> :-(

Experiment with GetWindowInfo(). It returns dwWindowStatus in a structure
that indicates WS_ACTIVECAPTION.


From: Bob Butler on

"Rick Raisley" <heavymetal-A-T-bellsouth-D-O-Tnet> wrote in message
news:exfBVUgcKHA.5568(a)TK2MSFTNGP02.phx.gbl...
> "Bob Butler" <noway(a)nospam.ever> wrote in message
> news:%23kMWFOgcKHA.4884(a)TK2MSFTNGP04.phx.gbl...
>>
>> "Rick Raisley" <heavymetal-A-T-bellsouth-D-O-Tnet> wrote in message
>> news:eO8b8HgcKHA.612(a)TK2MSFTNGP06.phx.gbl...
>>> <shudder>subclassing</shudder>
>>>
>>> I think I'm subclassing challenged. I avoid it like the plague, probably
>>> because of the IDE crashing problems when breaking to change code (which
>>> I do /all/ the time).
>>>
>>> If that's the only way, I'm afraid I'll have to leave this feature out.
>>> :-(
>>
>> Code it so the subclassing is only done when the app is not running in
>> the IDE and/or get used to saving often!
>>
>
> Then I won't be able to implement and debug in the IDE, so that's not so
> desirable. Aw shucks!

you can always subclass in the IDE just to debug that part

> I thought this would be doable (without subclassing).

well.... you COULD check frequently to see if your form is the foreground
window; it'd be a real hack but wouldn't need subclassing


From: mayayana on
> Then I won't be able to implement and debug in the IDE, so that's not so
> desirable. Aw shucks! I thought this would be doable (without
subclassing).

I use the code from Paul Caton and it works fine.
You can break in the IDE as long as you don't leave
bad code running. In other words, when it breaks on
an error, you have to fix the error or comment out
the offending line(s) before stopping altogether.

Karl Peterson has an easier way to subclass, using
the until-recently undocumented APIs, but I don't know
whether you can break with that method.

And I think vbAccelerator also has a DLL that can
do the same thing. The only catch with using their
code is that you have to use their DLL with the IDE.
I avoid vbAccel. in general for that reason. Their
code tends to come with a lot of dependencies
like DLLs and TLBs that are specific to their code.

I don't want to pester you if you really don't
want to subclass. :) But you should know that it
doesn't have to be tedious.


From: Karl E. Peterson on
mayayana explained :
> Karl Peterson has an easier way to subclass, using
> the until-recently undocumented APIs, but I don't know
> whether you can break with that method.

You can, yes, although messages may still arrive at will. It can get a
little interesting, needless to say. I just save first, and remember
what I was doing. "Works here!" :-)

--
[.NET: It's About Trust!]


From: DanS on
"Rick Raisley" <heavymetal-A-T-bellsouth-D-O-Tnet> wrote in
news:u9sJyHfcKHA.5796(a)TK2MSFTNGP06.phx.gbl:

> I'm embarrassed to ask this, but things aren't working quite as I
> expected. I want to run some non-trivial code (non-trivial here means
> it can take a bit of time to do) whenever a user goes back to my
> running program. Basically, he could have changed the document loaded
> in another (non-VB) program, and I want to see if that has happened,
> and if so, get information on the active document from that program.
>
> Anyhow, I thought that the Form_Activate event might work, or
> Form_GotFocus, but both of those don't fire when the form isn't
> changed (this simple program only has one form). Form_Paint works, but
> fires hundreds of times, so is not what I want.
>
> What can I use to determine that the user has gone back to my running
> app, and as he/she may have changed the document in the other app, I
> would then do a check to see if it's changed?
>

I've seen several ways offered here, by noone mentioned using a hook.

You can set a hook on your apps own window, and intercept wnd messages.

http://www.vbaccelerator.com/home/Vb/Code/Libraries/Hooks/vbAccelerator_H
ook_Library/article.asp

I wouldn't use their library, but this is a decent article. The WH_CBT
hook is what you would use....and this message may be the one to look
for:

HCBT_SETFOCUS

Windows calls the WH_CBT hook with this hook code when Windows is about
to set the focus to any window. In the case of thread-specific hooks, the
window must belong to the thread. If the filter function returns TRUE,
the focus does not change.

The wParam parameter contains the handle to the window that receives the
focus. The lParam parameter contains the handle to the window that loses
the focus.
------------------------------------------------------------

Most of, if not all, of the CBT hooks seem to happen just prior to the
event.
First  |  Prev  |  Next  |  Last
Pages: 1 2 3 4 5
Prev: dhSqliteDemo
Next: Scientific to Decimal