|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Execute on FocusI started this off in the wrong group, so I'm moving to here. I need to tell
when my application has received focus. I'd like to hook the Windows subclass and look for WM_ACTIVATEAPP. There is a VB6 demonstration of how to do this at; http://vbnet.mvps.org/code/subclass/activation.htm Unfortunately I'm still struggling up the learning curve of VB.net. Has anyone seen or have a chunk of code that does this in VB.net? I'd like an example to at least get me started in the right direction. Thanks, Bernie Bernie,
Did you know that this is a VBNet newsgroup for some of us VB6 is more than three years behind. Can you tell what you want to achieve instead that we have to examine some VB6 code? What do you want to say with received focus (probably is therefore a simple activated event in VBNet) and what do you than want to do? Cor "Cor Ligthert" <notmyfirstn***@planet.nl> schrieb Umm.. I think he is looking for a VB.Net equivalent of the VB6 code, not a > Bernie, > > Did you know that this is a VBNet newsgroup for some of us VB6 is > more than three years behind. Can you tell what you want to achieve > instead that we have to examine some VB6 code? VB6 solution. This is possible in this group. :-) > What do you want to say with received focus (probably is therefore a WM_ACTIVATEAPP is send to an application if the application got or lost the > simple activated event in VBNet) and what do you than want to do? focus (from a different application). The activated event also fires when the active window within your own applicaton changes. Armin Armin,
You are right, however luckily more and more less people are giving us some VB6 code and say than how do I need to do that in VBNet. The way you wrote it (the problem) is much easier to help in my opinion. It tells direct what is wanted (If you are right). :-) CorI'm lumping together a bunch of responses all together here.
I haven't written the code yet. I know that hooking the subclass is dangerous territory, so I was hoping to get some roadmap to follow. The application needs to know when it has been selected and this the foreground application. Normally it will live in the task bar minimized. When clicked in the task bar, I want to run some routines. The application is glueing some other apps together for interfacing. It will be used in a touch screen environment and makes up for some very small icons compared to some peoples finger sizes, but that's not relivant to my current issue. The overall application is simple. All is does is lock the workstation using an API call. Currently it does the locking, but it's a two step process, select the app, then click the lock button. If I watch for the application activation state, then I can run the lock routine and save the user an additional click. The best example I have of code already is here; http://vbnet.mvps.org/code/subclass/activation.htm but it's VB6 code and I'd rather write my app in newer VB.net code. Bernie Show quoteHide quote "Cor Ligthert" <notmyfirstn***@planet.nl> wrote in message news:uHZYYF0eFHA.1456@TK2MSFTNGP15.phx.gbl... > Bernie, > > Did you know that this is a VBNet newsgroup for some of us VB6 is more > than three years behind. Can you tell what you want to achieve instead > that we have to examine some VB6 code? > > What do you want to say with received focus (probably is therefore a > simple activated event in VBNet) and what do you than want to do? > > > Cor > "Bernie Hunt" <bh***@optonline.net> schrieb Sub classing is not needed anymore. You can overwrite the Form's WndProc > I started this off in the wrong group, so I'm moving to here. I need > to tell when my application has received focus. I'd like to hook the > Windows subclass and look for WM_ACTIVATEAPP. There is a VB6 > demonstration of how to do this at; > http://vbnet.mvps.org/code/subclass/activation.htm > > Unfortunately I'm still struggling up the learning curve of VB.net. > Has anyone seen or have a chunk of code that does this in VB.net? > I'd like an example to at least get me started in the right > direction. procedure and check for m.message for WM_ACTIVATEAPP. Armin Can anyone point me to a resource that shows how this is done? I know it's a
sensitive area and I don't want to mess it up. Bernie Show quoteHide quote "Armin Zingler" <az.nospam@freenet.de> wrote in message news:OR6B9k0eFHA.132@TK2MSFTNGP10.phx.gbl... > Sub classing is not needed anymore. You can overwrite the Form's WndProc > procedure and check for m.message for WM_ACTIVATEAPP. > > Armin |
|||||||||||||||||||||||