473,394 Members | 1,870 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Too many wm_AppActivates spoil the Application ...

I've written my own replacement for MsgBox, that I do all kinds
of wierd things with. So far, it's done everything I need it to.
Until now ...

I'm trying to use it in an application that is "sensitive" to the
difference between the Activate and AppActivate "events" (the former
being handled by overriding OnActivated, the latter by interrogating
the Message argument to WndProc).

For some odd reason, when I use my MsgBox replacement, I'm
getting not one, but /two/, WM_APPActivate messages in the
calling form - values seen in WndProc:

Msg=(28), hWnd=(3081424), LParam=(2004), WParam=(0)
Msg=(28), hWnd=(3081424), LParam=(2004), WParam=(1)

This triggers all kinds of things in the application that I don't want
to happen for an "internal" dialog. Oddly, using the normal
MsgBox instead, I get /no/ wm_appactivate messages at all!

Since my replacement is little more than a Form within which I call
ShowDialog(owner) on itself, can anyone suggest where these
extraneous messages might be coming from?
Surely the CLR can't see every form in a single application as a separate
application... ?

TIA,
Phill W.

Nov 21 '05 #1
4 1205
Phill. W wrote:
For some odd reason, when I use my MsgBox replacement, I'm
getting not one, but /two/, WM_APPActivate messages in the
calling form - values seen in WndProc:

Msg=(28), hWnd=(3081424), LParam=(2004), WParam=(0)
Msg=(28), hWnd=(3081424), LParam=(2004), WParam=(1)


If I'm not mistake, I believe that the WParam indicates what is
happening. If WParam is False, then the window is being de-activated
and if True, the window is being activated.

Could it be that one message is occurring when the main form is no
longer the active form and the other is when the MsgBox is becoming the
active form?

Just a thought

Nov 21 '05 #2
And after a little research, there should be two messages. One to the
app whose window is being deactivated and one to the app whose window
is being activated.

Nov 21 '05 #3
"Chris Dunaway" <du******@gmail.com> wrote in message
news:11*********************@o13g2000cwo.googlegro ups.com...
And after a little research, there should be two messages. One to
the app whose window is being deactivated and one to the app
whose window is being activated.


After some digging, I found the same thing myself - wm_activateapp's
/do/ come in pairs. However, this still belies my [rather more
significant]
problem in that I wasn't expecting to get /any/ of them in the first place!

My replacement form is in a separate, GAC-"registered" assembly
but, even so, that still shouldn't force execution out into a separate
Thread, should it?

Alternatively, since the wm_activateapp includes the ThreadID of the
"other" process, is there any way I can work out what /my/
application's ThreadId is and only call the "OnAppActivate" code if
the ThreadID's differ? (If I'm regaining "focus" from myself, then it's
not a "genuine" Application Activation).

Regards,
Phill W.
Nov 21 '05 #4
Phill. W wrote:
problem in that I wasn't expecting to get /any/ of them in the first place!
That is my understanding as well. Since the forms are being shown from
the same application, I wouldn't think that that particular message
would occur. Did you see them while in the debugger? Perhaps the act
of switching from the debugger might have had something to do with it.

"other" process, is there any way I can work out what /my/
application's ThreadId is and only call the "OnAppActivate" code if


You can get your thread id by calling AppDomain.GetCurrentThreadId

Nov 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

33
by: aa | last post by:
I am migrating to PHP from ASP where there are the Application Scope variables which are accessible from any page on a website and which are used, in particular, for hit counters. Is there a similar...
5
by: The Roys | last post by:
Hi Im doing something wrong in quitting the Word.Application in my VB program. I have General Declarations Dim AppWord As Word.Application Form_Load() Set AppWord =...
6
by: orekin | last post by:
Hi There I have been trying to come to grips with Application.Run(), Application.Exit() and the Message Pump and I would really appreciate some feedback on the following questions .. There are...
146
by: Herr Lucifer | last post by:
As the founder of .NET framework, Microsoft claims that it invention will be the next best platform for programming in a near future. Now it is 2005, ..NET is 5 years old, and can talk and walk for...
20
by: Peter Oliphant | last post by:
How does one launch multiple forms in an application? Using Photoshop as an example, this application seems to be composed of many 'disjoint' forms. Yet, they all seem somewhat 'active' in...
6
by: William Foster | last post by:
Good afternoon all, I want to play around and create a GPS application; I was wondering if anyone knows of a good GPS Receiver that can be used to communicate with Visual Studio .NET. I am by...
22
by: Wildemar Wildenburger | last post by:
To make it short: Is there something like this already? There seem to loads of python frameworks for Web-Apps, but I have a hard time finding one for desktop-apps. I imagine it wouldn't be too...
4
by: pamela fluente | last post by:
I have created and published a precompiled application. If I replace an ASP file, e.g. Default.ASP, with a new copy, by sending it via FTP, do I do something WRONG? Do I spoil the precompiled...
4
by: Dave | last post by:
I have a global.asax file with Application_Start defined and create some static data there and in another module used in the asp.net application and I realize that static data is shared amongst...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.