473,399 Members | 3,106 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,399 software developers and data experts.

Active Accessibility in C#

I'm trying to utilize the Active Accessibility SDK in order to create a
test automation tool. I've been attempting with no success to utilize

AccessibleObjectFromWindow using PInvoke in C#. I'm no wizard with
PInvoke, in fact this is really the first case where I've had to
utilize it much at all.

I believe what I have is close to working, but I keep receiving an
invalid argument exception when the actual function is called. Any
help would be appreciated.

I'm 90% sure I'm passing a valid hwnd, and I'm passing IID_iACCESSIBLE
as is defined below. and OBJID_WINDOW as defined below. The HWND I'm
using is being obtained through a call to FindWindow.
Thanks,

Andyalmq

Here's the code I currently have:

[DllImport("Oleacc.dll", EntryPoint="AccessibleObjectFromWindow")]
private static extern int _AccessibleObjectFromWindow(int /*HWND*/
hwnd, int /*DWORD*/ dwObjectID, /*REFIID*/ System.Guid riid,
/*[MarshalAs(UnmanagedType.Interface)]*/ out System.IntPtr
ppvObject);
public static Guid IID_IACCESSIBLE = new Guid(0x1ea4dbf0, 0x3c3b,
0x11cf, 0x81, 0x0c, 0x00,0xaa, 0x00, 0x38, 0x9b,0x71);
public static int OBJID_WINDOW = 0x00000000;

public static int AccessibleObjectFromWindow(int hwnd, int dwObjectID,
System.Guid riid, IAccessible ppvObject)
{
IntPtr ptr = Marshal.AllocCoTaskMem(Marshal.SizeOf(typeof(IntPt r)));
Marshal.WriteIntPtr(ptr, IntPtr.Zero);

int result = _AccessibleObjectFromWindow(hwnd, dwObjectID, riid, out
ptr);
if (result == 0)
{
ppvObject =
(IAccessible)Marshal.GetObjectForIUnknown(Marshal. ReadIntPtr(ptr));
}
return result;
}

Nov 16 '05 #1
0 2240

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

Similar topics

12
by: JAMESICUS | last post by:
Refer to ..... http://news.com.com/2100-1032-5063444.html James Pickering Pickering Pages http://www.jp29.org/
9
by: Barbara de Zoete | last post by:
I am getting more and more confused as to the meaning of the words 'accessibility' and 'usability' *in the context of the world wide web*. What do these two words mean? How do they differ from one...
5
by: Dave Henson | last post by:
Hi I am checking a site for accessibility and Dreamweaver suggests making sure that the menu is accessible via keyboard as well as mouse (i.e device-independent). A question has arisen which is...
19
by: lolo | last post by:
Hi, I know how validate a page for CSS or HTML, but I didn't found how validate my page for accessibility Thanx for your help
54
by: richard_quick_uk | last post by:
Hi, If anyone's got the time I'd really appreciate any feedback on the accessibility of this site: http://www.cata.co.uk/_index.a­sp
4
by: waltborders | last post by:
Hi, Because the blind are unable to use a mouse, keyboard navigation is key. A major difficulty is that not all windows forms controls are keyboard 'tab-able' or 'arrow-able' or have "tab...
3
by: Edward Diener | last post by:
According to the CLS specification, the accessibility of the methods for adding, removing, and raising an event must be identical. There appear to be a few problems with this: 1) According to...
8
by: cms-hispano.org | last post by:
i'm building a site about extreme accessibility, i.e.: how (and why) to get sites to become fully accessible, *beyond* W3C Web Accessibility Initiative guidelines. it's far from being completed (i...
3
by: Doug | last post by:
Hi I am trying to find a way to make the mouse cursor move to the keyboard cursor position in an application. For example, I use an application called Enterprise Guide, and I control this...
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.