I have an existing piece of code that can read standard Windows status
bars (class: msctls_statusbar32) fine. This piece uses SendMessage
(SB_GETTEXT) as follows:
- Length=SendMessage(hStatusbar, SB_GETTEXTLENGTH, Index, 0); // Get
the length of the text
- Allocate the buffer based on Length
- SendMessage(hStatusbar, SB_GETTEXT, Index, (LPARAM) Buffer);
// Index = the pane number of the status bar to retrieve the text
// Buffer = the place to store the text
(I've omitted all details about allocating memory in the remote
process and copy data back and forth).
However, it doesn't seem to work with the Afx:StatusBar (as said
earlier, it worked for msctls_statusbar32).
I would really appreciate it if someone could tell me how to get the
text in CStatusBar.
Thanks a lot
try to enmuerate the Windows Child Forms and
Controls and try to determine which one is what
you are looking for: Use these functions for that:
EnumChildWindows / FindWindowEx
GetClassName / GetClassInfo
Check the class nam and make a decision by
properties like e.g class name itself, position,
objects paren, etc.,...this is up to you!
Regards
Kerem
--
-----------------------
Beste Gr�sse / Best regards / Votre bien devoue
Kerem G�mr�kc�
Latest Project: http://www.pro-it-education.de/software/deviceremover
Latest Open-Source Projects: http://entwicklung.junetz.de
-----------------------
"Tom" <nt72...@yahoo.com> schrieb im Newsbeitrag
news:3d1fd5ac-db31-41f7...@s31g2000yqs.googlegroups.com...
I'm currently facing the same issue. Did someone knows a way to solve this problem ?
Thanks !
Tom wrote:
How to read text from a status bar (CStatus) of another application ?
13-Nov-09
I need to read the text in the status bar of another application. The
status bar class is Afx:StatusBar:400000.xxxx, so I guess it is the MFC
CStatusBar object.
I have an existing piece of code that can read standard Windows status
bars (class: msctls_statusbar32) fine. This piece uses SendMessage
(SB_GETTEXT) as follows:
- Length=SendMessage(hStatusbar, SB_GETTEXTLENGTH, Index, 0); // Get
the length of the text
- Allocate the buffer based on Length
- SendMessage(hStatusbar, SB_GETTEXT, Index, (LPARAM) Buffer);
// Index = the pane number of the status bar to retrieve the text
// Buffer = the place to store the text
(I have omitted all details about allocating memory in the remote
process and copy data back and forth).
However, it does not seem to work with the Afx:StatusBar (as said
earlier, it worked for msctls_statusbar32).
I would really appreciate it if someone could tell me how to get the
text in CStatusBar.
Thanks a lot
Previous Posts In This Thread:
On Friday, November 13, 2009 7:05 PM
Tom wrote:
How to read text from a status bar (CStatus) of another application ?
I need to read the text in the status bar of another application. The
status bar class is Afx:StatusBar:400000.xxxx, so I guess it is the MFC
CStatusBar object.
I have an existing piece of code that can read standard Windows status
bars (class: msctls_statusbar32) fine. This piece uses SendMessage
(SB_GETTEXT) as follows:
- Length=SendMessage(hStatusbar, SB_GETTEXTLENGTH, Index, 0); // Get
the length of the text
- Allocate the buffer based on Length
- SendMessage(hStatusbar, SB_GETTEXT, Index, (LPARAM) Buffer);
// Index = the pane number of the status bar to retrieve the text
// Buffer = the place to store the text
(I have omitted all details about allocating memory in the remote
process and copy data back and forth).
However, it does not seem to work with the Afx:StatusBar (as said
earlier, it worked for msctls_statusbar32).
I would really appreciate it if someone could tell me how to get the
text in CStatusBar.
Thanks a lot
On Monday, November 16, 2009 12:46 AM
Kerem G?mr?kc? wrote:
Hi Tom,try to enmuerate the Windows Child Forms andControls and try to
Hi Tom,
try to enmuerate the Windows Child Forms and
Controls and try to determine which one is what
you are looking for: Use these functions for that:
EnumChildWindows / FindWindowEx
GetClassName / GetClassInfo
Check the class nam and make a decision by
properties like e.g class name itself, position,
objects paren, etc.,...this is up to you!
Regards
Kerem
--
-----------------------
Beste Gr?sse / Best regards / Votre bien devoue
Kerem G?mr?kc?
Latest Project: http://www.pro-it-education.de/software/deviceremover
Latest Open-Source Projects: http://entwicklung.junetz.de
-----------------------
Submitted via EggHeadCafe - Software Developer Portal of Choice
WPF Control?s Default Style or Template by Extending the WPF Designer in Visual Studio 2010
http://www.eggheadcafe.com/tutorials/aspnet/d1ad0a33-d815-4083-8e97-c234fd661095/wpf-controls-default-style-or-template-by-extending-the-wpf-designer-in-visual-studio-2010.aspx
That said, David Ching posted, in the last couple years, a means of processing messages in
the context of a remote window. Look in the archives for a reference.
joe
Joseph M. Newcomer [MVP]
email: newc...@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
Thanks for the explanation about messages & threads: I just discovered the sendmessage/postmessage API a few days ago and not everythings is yet clear for me. Well, for SB_GETTEX, I hope I wrote the code in the right way: I did as Tom explained, i.e. allocating memory in the remote process and copy data back and forth ( using VirtualAllocEx(), VirtualFreeEx(), WriteProcessMemory() and ReadProcessMemory() ).
But the problem is that, if it works well for objects from statusbar32 class (as wordpad or paint), it does not work for some other classes whose name is "afx... something". This IS the problem. And I don't know if it is possible to solve it (did not found anything about it on the net except that message). That's why I posted the message.
PS
I do this because I try to control a software that drives a test equipement: it's for automating a test sequence in the lab I am (it's not really mandatory, but it would be really more comfortable for me :) )
Simon
Joseph M. Newcomer wrote:
It is pretty meaningless to send a message to another process that has a
02-Aug-10
It is pretty meaningless to send a message to another process that has a pointer to the
current process in it. This will not work. It should not be expected to work. It should
be obvious WHY it does not work. In fact, the only reason WM_GETTEXT works is that there
is a lot of effort put into the internal code to make it work, so it is backward
compatible with 16-bit Windows. No other SendMessage has code that does this.
That said, David Ching posted, in the last couple years, a means of processing messages in
the context of a remote window. Look in the archives for a reference.
joe
Joseph M. Newcomer [MVP]
email: newc...@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
Previous Posts In This Thread:
Submitted via EggHeadCafe - Software Developer Portal of Choice
Custom Favorites Web Site with MongoDb and NoRM
http://www.eggheadcafe.com/tutorials/aspnet/7fbc7a01-5d30-4cd3-b373-51d4a0e1afa8/custom-favorites-web-site-with-mongodb-and-norm.aspx