Hi folks,
I have some serious problems with one of the API calls ...
I try to use :
[DllImport("oleacc.dll",CharSet=CharSet.Auto)]
public static extern long AccessibleObjectFromWindow (
long hwnd,
long dwId,
[MarshalAs(UnmanagedType.Struct)]UUID riid,
[MarshalAs(UnmanagedType.Interface)]object ppvObject);
public struct UUID
{
public long Data1;
public int Data2;
public int Data3;
[MarshalAs(UnmanagedType.ByValArray,SizeConst=8)]
public byte[] Data4;
}
public static void TestAA()
{
UUID uid;
uid.Data1 = (long)0x618736e0;
uid.Data2 = (int)0x3c3d;
uid.Data3 = (int)0x11cf;
uid.Data4 = new Byte[8];
uid.Data4[0] = (byte)0x81;
uid.Data4[1] = (byte)0x0c;
uid.Data4[2] = (byte)0x00;
uid.Data4[3] = (byte)0xaa;
uid.Data4[4] = (byte)0x00;
uid.Data4[5] = (byte)0x38;
uid.Data4[6] = (byte)0x9b;
uid.Data4[7] = (byte)0x71;
IAccessible accObj = null;
long ret = AccessibleObjectFromWindow
(wHandle,OBJID_WINDOW,uid,accObj);
but always get a E_INVALIDARG return value.
I also tried
[DllImport("oleacc.dll",CharSet=CharSet.Auto)]
public static extern long AccessibleObjectFromWindow (
long hwnd,
long dwId,
[MarshalAs(UnmanagedType.Struct)]UUID riid,
[MarshalAs(UnmanagedType.AsAny)]object ppvObject);
could someone give me a hint where I make my mistake ?
thx :)
Sven 4 6450
Hint .... long is 64 bit in .NET
Willy.
"Sven Gnagi" <Sv*******@hotmail.com> wrote in message
news:0b****************************@phx.gbl... Hi folks,
I have some serious problems with one of the API calls ...
I try to use :
[DllImport("oleacc.dll",CharSet=CharSet.Auto)] public static extern long AccessibleObjectFromWindow ( long hwnd, long dwId, [MarshalAs(UnmanagedType.Struct)]UUID riid, [MarshalAs(UnmanagedType.Interface)]object ppvObject);
public struct UUID { public long Data1; public int Data2; public int Data3; [MarshalAs(UnmanagedType.ByValArray,SizeConst=8)] public byte[] Data4; }
public static void TestAA() { UUID uid; uid.Data1 = (long)0x618736e0; uid.Data2 = (int)0x3c3d; uid.Data3 = (int)0x11cf; uid.Data4 = new Byte[8]; uid.Data4[0] = (byte)0x81; uid.Data4[1] = (byte)0x0c; uid.Data4[2] = (byte)0x00; uid.Data4[3] = (byte)0xaa; uid.Data4[4] = (byte)0x00; uid.Data4[5] = (byte)0x38; uid.Data4[6] = (byte)0x9b; uid.Data4[7] = (byte)0x71;
IAccessible accObj = null;
long ret = AccessibleObjectFromWindow (wHandle,OBJID_WINDOW,uid,accObj);
but always get a E_INVALIDARG return value.
I also tried
[DllImport("oleacc.dll",CharSet=CharSet.Auto)] public static extern long AccessibleObjectFromWindow ( long hwnd, long dwId, [MarshalAs(UnmanagedType.Struct)]UUID riid, [MarshalAs(UnmanagedType.AsAny)]object ppvObject);
could someone give me a hint where I make my mistake ?
thx :)
Sven
Sven, [DllImport("oleacc.dll",CharSet=CharSet.Auto)] public static extern long AccessibleObjectFromWindow ( long hwnd, long dwId, [MarshalAs(UnmanagedType.Struct)]UUID riid, [MarshalAs(UnmanagedType.Interface)]object ppvObject);
I would declare it as
[DllImport("oleacc.dll", PreserveSig=false)]
[return: MarshalAs(UnmanagedType.Interface)]
public static extern object AccessibleObjectFromWindow (
IntPtr hwnd,
uint dwId,
ref Guid riid);
And call it with
Guid uid = new Guid("618736e0-3c3d-11cf-810c-00aa00389b71");
IAccessible accObj = (IAccessible)AccessibleObjectFromWindow(wHandle,
OBJID_WINDOW, ref uid);
Mattias
--
Mattias Sjögren [MVP] mattias @ mvps.org http://www.msjogren.net/dotnet/
Please reply only to the newsgroup. -----Original Message----- Sven,
[DllImport("oleacc.dll",CharSet=CharSet.Auto)] public static extern long AccessibleObjectFromWindow ( long hwnd, long dwId, [MarshalAs(UnmanagedType.Struct)]UUID riid, [MarshalAs(UnmanagedType.Interface)]object ppvObject); I would declare it as
[DllImport("oleacc.dll", PreserveSig=false)] [return: MarshalAs(UnmanagedType.Interface)] public static extern object AccessibleObjectFromWindow ( IntPtr hwnd, uint dwId, ref Guid riid);
And call it with
Guid uid = new Guid("618736e0-3c3d-11cf-810c-
00aa00389b71");IAccessible accObj = (IAccessible)
AccessibleObjectFromWindow(wHandle,OBJID_WINDOW, ref uid); Mattias
-- Mattias Sjögren [MVP] mattias @ mvps.org http://www.msjogren.net/dotnet/ Please reply only to the newsgroup. .
Hi Mattias,
what to say...... you just became my personal hero :)
works perfectly...... and I'd never have thought about
Guid uid = new Guid("618736e0-3c3d-11cf-810c-
00aa00389b71") by myself ....
thx a lot :)
Sven -----Original Message----- Sven,
[DllImport("oleacc.dll",CharSet=CharSet.Auto)] public static extern long AccessibleObjectFromWindow ( long hwnd, long dwId, [MarshalAs(UnmanagedType.Struct)]UUID riid, [MarshalAs(UnmanagedType.Interface)]object ppvObject); I would declare it as
[DllImport("oleacc.dll", PreserveSig=false)] [return: MarshalAs(UnmanagedType.Interface)] public static extern object AccessibleObjectFromWindow ( IntPtr hwnd, uint dwId, ref Guid riid);
And call it with
Guid uid = new Guid("618736e0-3c3d-11cf-810c-
00aa00389b71");IAccessible accObj = (IAccessible)
AccessibleObjectFromWindow(wHandle,OBJID_WINDOW, ref uid); Mattias
-- Mattias Sjögren [MVP] mattias @ mvps.org http://www.msjogren.net/dotnet/ Please reply only to the newsgroup. .
Hi Mattias,
what to say...... you just became my personal hero :)
works perfectly...... and I'd never have thought about
Guid uid = new Guid("618736e0-3c3d-11cf-810c-
00aa00389b71") by myself ....
thx a lot :)
Sven This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: John Altland |
last post by:
Here is my basic problem. I have a form that executes a
cpu instensive algorithm occupying the first thread. When
the algorithm is executed another form pops up telling the
user the progress that...
|
by: RickDee |
last post by:
Please help, anybody.
I am trying to write a program so that it can launch an exe file ( which is
also genereated in C# ) and then simulate the button clicking and invoke the
methods inside the...
|
by: Stephen Lamb |
last post by:
I have a background worker thread which I start from a form's HandleCreated
event that makes calls back to the form using Invoke. During shutdown the
form is disposed and the background worker...
|
by: rawCoder |
last post by:
Hi
I am having this InvalidOperationException with message Cannot call Invoke
or InvokeAsync on a control until the window handle has been created
This is raised when i try to invoke a method...
|
by: Paul Tomlinson |
last post by:
Morning all. Let me describe my problem.
Main thread creates child objects and threads and starts them
Timer on the main thread (which only gets activated after the child threads
have started)...
|
by: Charles Law |
last post by:
Hi guys.
I have two threads: a main thread and a background thread. Lots of stuff
happens in the background thread that means I have to update several (lots)
of controls on a form.
It is...
|
by: Pawan Narula via DotNetMonster.com |
last post by:
hi all,
i'm using VB.NET and trying to code for contact management in a tree. all my contacts r saved in a text file and my C dll reads them one by one and sends to VB callback in a sync mode...
|
by: Jeff Stewart |
last post by:
I need a thread to run a subroutine which updates my main form's
progress bar. I've properly marshaled all UI updates to the main UI
thread, and after the main thread starts the worker thread, it...
|
by: m.posseth |
last post by:
Hello
does someone know how i can invoke a method in the underlying thread without
the usage of a window handle ??
This works perfect in a form
Me.Invoke(New MethodInvoker(AddressOf...
|
by: =?Utf-8?B?a2VubmV0aG1Abm9zcGFtLm5vc3BhbQ==?= |
last post by:
vs2005, c#
Trying to understand why one way works but the other doesnt.
I have not tried to create a simpler mdi/child/showdialog app for posting
purposes (I think even this would not be so small...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
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
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
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...
| |