Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
DotNet
acad.assignment.mngr
academic
adonet
aspnet
aspnet.announcements
aspnet.build.controls
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
clr
compactframework
component_services
datatools
distributed_apps
drawing
faqs
framework
framework.wmi
general
internationalization
interop
languages.csharp
languages.jscript
languages.vb
languages.vb.controls
languages.vb.data
languages.vb.upgrade
languages.vc
languages.vc.libraries
myservices
odbcnet
performance
remoting
scripting
sdk
security
setup
vjsharp
vsa
webservi.enhancements
webservices
windowsforms
windowsforms.controls
winforms.databinding
winforms.designtime
xml
  
 
date: Sun, 13 Apr 2008 23:29:17 -0600,    group: microsoft.public.dotnet.framework.interop        back       


WM_GETTEXTLENGTH   
I have a need to enumerate all the windows found by the external method 
GetWindows() and retrieve the various caption text from each window.  As I 
enumerate each window I call GetWindowTextLength to retreive the length of 
the text before calling GetWindowText.  I am faced with catch 22:

1) If I use SendMessage to send the GetWindowTextLength message many windows 
do not process the message and my C# app hangs.
2) If I use SendNotifyMessage or PostMessage to send the GetWindowTextLength 
message my app does not hang but the value never returns a valid length 
(always zero).  This causes GetWindowText to always return an empty string.

I have found that in most cases the windows that do not process the message 
fall into one of these categories:
1) The window has the WS_EX_TOOLWINDOW extended style (which I can 
successfully detect).  For example most "tooltips_class32" class windows.
-OR-
2) In Spy++ the "Window Proc" field on the "General" tab of the Window 
Properties dialog has "(Unavailable)" for a value for that window. (The 
window does not have the WS_EX_TOOLWINDOW ex style).  It is important to 
note that the "Window Proc" field on the "Class" tab does show a handle 
value.

It is ok to skip these types of windows in my enumeration, the trouble I am 
having though is that I do not know how to determine in C# whether the 
Window Proc in item 2 above is set to "Unavailable" or not.  I have tried 
using GetWindowLong with an index of GWL_WNDPROC = -4 but this does not 
return a value reliably and I am not sure if that is really the function 
that Spy++ is calling anyway.

Is my assumption that items 1 and 2 are the cause of the hang up correct? 
If so how do you determine if the Window Proc is available or not? (so I can 
skip that window)

Thanks,

Matt
date: Sun, 13 Apr 2008 23:29:17 -0600   author:   ME EMOVETHIS

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us