473,398 Members | 2,188 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,398 software developers and data experts.

Capturing text in Windows UI controls with C#

Hi,

With C#, is it possible to hover a mouse pointer on the Windows UI controls
and show the UI text? For example, can I hover my mouse over "File" in the
menu bar and show the text "File" on a label?

I've seen a program like this but not sure if it can be done with C#.

Thanks!
TomTom
Nov 16 '05 #1
5 9586
The MenuItem has a Select event that is called when the mouse is over it.
Use this to set the label text.

Chris

"TomTom" <no*****@nospamfordiscussion.com> wrote in message
news:uW*************@TK2MSFTNGP11.phx.gbl...
Hi,

With C#, is it possible to hover a mouse pointer on the Windows UI controls and show the UI text? For example, can I hover my mouse over "File" in the menu bar and show the text "File" on a label?

I've seen a program like this but not sure if it can be done with C#.

Thanks!
TomTom

Nov 16 '05 #2
Sorry, I didn't describe what I wanted to do in more details.

I need to capture the text that's in other programs. The scenario looks
like:

1. I activate MyApp.
2. I hover mouse pointer over some menu text, command bar text, etc. in MS
Word.
3. The pointed text show up in MyApp.

Is this possible?

Thanks,
TomTom

"Christopher Kimbell" <a@b.c> wrote in message
news:40********@news.broadpark.no...
The MenuItem has a Select event that is called when the mouse is over it.
Use this to set the label text.

Chris

"TomTom" <no*****@nospamfordiscussion.com> wrote in message
news:uW*************@TK2MSFTNGP11.phx.gbl...
Hi,

With C#, is it possible to hover a mouse pointer on the Windows UI

controls
and show the UI text? For example, can I hover my mouse over "File" in

the
menu bar and show the text "File" on a label?

I've seen a program like this but not sure if it can be done with C#.

Thanks!
TomTom


Nov 16 '05 #3
I don't know of any way to do it using .NET.
You would probably need functionality similar to Spy++, I tried to select a
MenuItem, but could only get the whole menu.
If it is possible, it would require some interop, try asking in the some of
the win32 api groups, if there are APIs you can use,
these can be wrapped in DllImport for use in .NET.

Chris

"TomTom" <no*****@nospamfordiscussion.com> wrote in message
news:uX**************@TK2MSFTNGP09.phx.gbl...
Sorry, I didn't describe what I wanted to do in more details.

I need to capture the text that's in other programs. The scenario looks
like:

1. I activate MyApp.
2. I hover mouse pointer over some menu text, command bar text, etc. in MS
Word.
3. The pointed text show up in MyApp.

Is this possible?

Thanks,
TomTom

"Christopher Kimbell" <a@b.c> wrote in message
news:40********@news.broadpark.no...
The MenuItem has a Select event that is called when the mouse is over it. Use this to set the label text.

Chris

"TomTom" <no*****@nospamfordiscussion.com> wrote in message
news:uW*************@TK2MSFTNGP11.phx.gbl...
Hi,

With C#, is it possible to hover a mouse pointer on the Windows UI

controls
and show the UI text? For example, can I hover my mouse over "File"
in the
menu bar and show the text "File" on a label?

I've seen a program like this but not sure if it can be done with C#.

Thanks!
TomTom



Nov 16 '05 #4
Thanks for your suggestion. I'll ask around a little more.

Tomtom

"Christopher Kimbell" <a@b.c> wrote in message
news:40********@news.broadpark.no...
I don't know of any way to do it using .NET.
You would probably need functionality similar to Spy++, I tried to select a MenuItem, but could only get the whole menu.
If it is possible, it would require some interop, try asking in the some of the win32 api groups, if there are APIs you can use,
these can be wrapped in DllImport for use in .NET.

Chris

"TomTom" <no*****@nospamfordiscussion.com> wrote in message
news:uX**************@TK2MSFTNGP09.phx.gbl...
Sorry, I didn't describe what I wanted to do in more details.

I need to capture the text that's in other programs. The scenario looks
like:

1. I activate MyApp.
2. I hover mouse pointer over some menu text, command bar text, etc. in MS
Word.
3. The pointed text show up in MyApp.

Is this possible?

Thanks,
TomTom

"Christopher Kimbell" <a@b.c> wrote in message
news:40********@news.broadpark.no...
The MenuItem has a Select event that is called when the mouse is over

it. Use this to set the label text.

Chris

"TomTom" <no*****@nospamfordiscussion.com> wrote in message
news:uW*************@TK2MSFTNGP11.phx.gbl...
> Hi,
>
> With C#, is it possible to hover a mouse pointer on the Windows UI
controls
> and show the UI text? For example, can I hover my mouse over "File" in the
> menu bar and show the text "File" on a label?
>
> I've seen a program like this but not sure if it can be done with C#. >
> Thanks!
> TomTom
>
>



Nov 16 '05 #5
I had a little progress on my search on how I can do this. Below is the step
I gathered on the web, but I am yet to find how I could use this.

1. In Visual Studio by going to Project->Add Reference. In the .NET tab,
choose the Accessibility.dll..

2. Add the following code in the C# program.

[DllImport("oleacc.dll", EntryPoint="AccessibleObjectFromPoint",
SetLastError=true, CharSet=CharSet.Auto,
CallingConvention=CallingConvention.StdCall)]
public static extern int AccessibleObjectFromPoint(Point pt, ref
Accessibility.IAccessible ppacc,ref object pvarChild);//(IntPtr hWnd);

[DllImport("oleacc.dll", EntryPoint="AccessibleObjectFromEvent",
SetLastError=true, CharSet=CharSet.Auto,
CallingConvention=CallingConvention.StdCall)]
public static extern int AccessibleObjectFromEvent(int hwnd, int objid,
int childid, ref Accessibility.IAccessible ppacc, ref object pvarChild);

[DllImport("user32.dll", EntryPoint="SetWinEventHook", SetLastError=true,
CharSet=CharSet.Auto, CallingConvention=CallingConvention.StdCall)]
public static extern int SetWinEventHook(int eventMin, int eventMax, int
hmodWinEventProc, WinEventProc lpfnWinEventProc, int idProcess, int
idThread, int dwflags);

public delegate int WinEventProc(int hWinEventHook, int idEvent, int hwnd,
int idObject, int idChild, int dwEventThread, int dwmsEventTime);
Then, I am stuck.... Basically I don't know how I can create the
IAccessible object in the C# and call the ac.get_accName function as the
mouse pointer moves... I crafted up an experimental code, but this does not
work.

Accessibility.IAccessible ac = new Accessibility.IAccessible();
Point pt = new Point(50,50);
string test = ac.get_accName(pt);
If you know a way to do this, can you please let me know? Even the general
pseudo-code would help.

Thanks.
Tomtom

"TomTom" <no*****@nospamfordiscussion.com> wrote in message
news:un**************@TK2MSFTNGP09.phx.gbl...
Thanks for your suggestion. I'll ask around a little more.

Tomtom

"Christopher Kimbell" <a@b.c> wrote in message
news:40********@news.broadpark.no...
I don't know of any way to do it using .NET.
You would probably need functionality similar to Spy++, I tried to select
a
MenuItem, but could only get the whole menu.
If it is possible, it would require some interop, try asking in the some of
the win32 api groups, if there are APIs you can use,
these can be wrapped in DllImport for use in .NET.

Chris

"TomTom" <no*****@nospamfordiscussion.com> wrote in message
news:uX**************@TK2MSFTNGP09.phx.gbl...
Sorry, I didn't describe what I wanted to do in more details.

I need to capture the text that's in other programs. The scenario looks like:

1. I activate MyApp.
2. I hover mouse pointer over some menu text, command bar text, etc.
in MS Word.
3. The pointed text show up in MyApp.

Is this possible?

Thanks,
TomTom

"Christopher Kimbell" <a@b.c> wrote in message
news:40********@news.broadpark.no...
> The MenuItem has a Select event that is called when the mouse is
over it.
> Use this to set the label text.
>
> Chris
>
> "TomTom" <no*****@nospamfordiscussion.com> wrote in message
> news:uW*************@TK2MSFTNGP11.phx.gbl...
> > Hi,
> >
> > With C#, is it possible to hover a mouse pointer on the Windows UI
> controls
> > and show the UI text? For example, can I hover my mouse over
"File" in
> the
> > menu bar and show the text "File" on a label?
> >
> > I've seen a program like this but not sure if it can be done with

C#. > >
> > Thanks!
> > TomTom
> >
> >
>
>



Nov 16 '05 #6

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

Similar topics

5
by: Moosebumps | last post by:
I have a large set of Python scripts that interface with command line utilities (primarily Perforce). I am currently capturing ALL the text output in order to get results and such. I am using the...
5
by: Earl Eiland | last post by:
Anyone know how to capture text from GUI output? I need to process information returned via a GUI window. Earl
3
by: Chris | last post by:
Hi, I need to get an image of a control (ListView) so i can save it to a file. It's pretty easy to get the Graphics with the CreateGraphics() function on every control, but I don't know how I...
9
by: Pam Ammond | last post by:
I need the code to update the database when Save is clicked and a text field has changed. This should be very easy since I used Microsoft's wizards for the OleDBAdapter and OleDBConnection, and...
4
by: Arif Çimen | last post by:
Hi to everybody, I have chnged a button text in design mode. But After compiling and executing the program the text of the button do not change to new value. Any Ideas? Thaks for helps.
14
by: Brent Burkart | last post by:
I am trying to capture the Windows Authenticated username, but I want to be able to capture the login name that exists in IIS, not Windows. In order to enter my company's intranet through the...
6
by: Lance Geeck | last post by:
I have a simple form where I am using a dataset called Client. On the data entry screen, there are name, address, city state and zip. I have the fields bound to the dataset field. (Properties...
4
by: tneufeld | last post by:
I am using a ListView control to display 2 columns of data that I populate manually. I can get the data in the first column easily enough. its when i try to get the data in the second column...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.