-
September 6th, 2002, 05:48 PM
#1
About message-only windows
I'm surprised how little information there is about message-only windows and the HWND_MESSAGE constant. I don't have Windows 2000 or XP, so I want someone to do the following.
- List the steps necessary to reliably determine whether a window is a message-only window. (GetWindow, GetParent, etc.?)
- Determine whether message-only windows can be enumerated using the EnumChildWindows function with HWND_MESSAGE as the first parameter.
-
September 8th, 2002, 12:18 AM
#2
You cannot enumerate message-only windows. Such a window does not receive broadcast messages, has no Z order and is not visible.
Since you create a message-only window by specifying HWND_MESSAGE as parent parameter in CreateWindowEx you can use FindWindowEx passing HWND_MESSAGE as parent handle for FindWindowEx parameter.
GetParent should return HWND_MESSAGE
There are only 10 types of people in the world:
Those who understand binary and those who do not.
-
September 8th, 2002, 08:50 AM
#3
FindWindowEx does not fit my needs because it assumes that I know the classes of the windows beforehand. Assume that I have no idea what message-only windows there are.
So,would a function like this work for enumerating message-only windows? If not, I don't see how FindWindowEx is able to search message-only windows quickly.
Code:
void DebugOut(const char *fmt, ...){
va_list a=NULL;
char szDebugString[1024];
if(lstrlenA(fmt)==0)return;
va_start(a,fmt);
vsprintf(szDebugString,fmt,a);
va_end(a);
if(lstrlenA(szDebugString)==0)return;
OutputDebugString(szDebugString);
OutputDebugString("\r\n");
}
BOOL EnumMessageOnlyWindows(WNDENUMPROC wep, LPARAM lParam){
HWND hwnd;
DWORD i;
DebugOut("EnumMessageOnlyWindows start %d",GetTickCount());
for(i=0;;i+=4){
hwnd=(HWND)i;
if(!IsWindow(hwnd))continue;
#ifdef DEBUGWINDOWS
DebugOut("%08X %08X %08X",GetWindow(hwnd,GW_HWNDFIRST)
,GetWindow(hwnd,GW_HWNDPREV)
,GetWindow(hwnd,GW_HWNDNEXT));
#endif
if(GetParent(hwnd)!=HWND_MESSAGE)
continue;
#ifdef DEBUGWINDOWS
DebugOut("%08X is a message-only window",hwnd);
#endif
wep(hwnd,lParam);
if(i==0xFFFFFFFC)break;
}
DebugOut("EnumMessageOnlyWindows end %d",GetTickCount());
return TRUE;
}
Last edited by poccil; September 8th, 2002 at 08:58 AM.
-
September 8th, 2002, 10:12 AM
#4
In your post you have mentioned that you do not have Windows 2K nor XP.
What operating system are you using?
There are only 10 types of people in the world:
Those who understand binary and those who do not.
-
September 8th, 2002, 10:23 AM
#5
I use Windows 98 Second Edition. I'm writing a window spy program.
-
September 8th, 2002, 05:42 PM
#6
-
September 9th, 2002, 02:07 PM
#7
-
September 12th, 2002, 04:09 PM
#8
You have posted several of "…" and several days I was under impression that somebody else resolved your problem already.
Just out of curiosity I looked at your thread and found that you were posting yourself triple dots. That does not help to show urgency, it rather shows that you have gotten many answers.
I could not get back to you any earlier I have to make bread money too. I was away on some errands away from any computer I could use to access code guru.
Anyway I had a little chance to experiment (you were right documentation is kind of quiet about message only windows). Did you try to do anything?
Unfortunately I could not find anything else beyond my experience.
The only way I found is following:
Code:
void CTestWnd::EnummerateMessageOnlyWindows()
{
HWND hWndFound = ::FindWindowEx(HWND_MESSAGE, NULL, NULL, NULL); //will find first message only window
while(hWndFound)
{
hWndFound = ::GetNextWindow(hWndFound, GW_HWNDNEXT);
}
}
I have confirmed that this is reliable method using Windows 2K, but if newer SDK on your system you will be able to achieve the same results since I am not using 2K specific calls.
I will try this code on ME at home. Let me know how are you doing.
There are only 10 types of people in the world:
Those who understand binary and those who do not.
-
September 12th, 2002, 08:02 PM
#9
Thanks for your function. I never realized that the parameter for the class name can be NULL.
By the way, I did find a Windows 2000 computer to test, but since it doesn't have any other software on it yet, I cannot use it much for now. During the time I could use it, I discovered that the function I posted does not work.
I'll definitely try your suggestion in the morning, if I can.
-
September 13th, 2002, 09:23 AM
#10
FindWindowEx and FindWindow as well can have all formal parameters set to NULL.
In this case both will find top level window – all windows’ classes and window names will match.
There are only 10 types of people in the world:
Those who understand binary and those who do not.
-
September 13th, 2002, 03:54 PM
#11
Thanks, JohnCz, for your help. I've confirmed that the function works successfully. Now my window spy can do what Spy++ failed to do.
-
September 13th, 2002, 04:01 PM
#12
You are welcome.
How did you get the idea any way? It is interesting idea.
Besides message only windows is fairly new concept and I think SPY was written before that and never updated.
There are only 10 types of people in the world:
Those who understand binary and those who do not.
-
September 13th, 2002, 07:09 PM
#13
I created the Window Viewer both as a way to improve on Spy++ and as a personal programming exercise. Today, In fact, I released a new version if anyone's interested.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|