Hi folks,
I have some serious problems with one of the API calls ...
I try to use :
[DllImport("olea cc.dll",CharSet =CharSet.Auto)]
public static extern long AccessibleObjec tFromWindow (
long hwnd,
long dwId,
[MarshalAs(Unman agedType.Struct )]UUID riid,
[MarshalAs(Unman agedType.Interf ace)]object ppvObject);
public struct UUID
{
public long Data1;
public int Data2;
public int Data3;
[MarshalAs(Unman agedType.ByValA rray,SizeConst= 8)]
public byte[] Data4;
}
public static void TestAA()
{
UUID uid;
uid.Data1 = (long)0x618736e 0;
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 = AccessibleObjec tFromWindow
(wHandle,OBJID_ WINDOW,uid,accO bj);
but always get a E_INVALIDARG return value.
I also tried
[DllImport("olea cc.dll",CharSet =CharSet.Auto)]
public static extern long AccessibleObjec tFromWindow (
long hwnd,
long dwId,
[MarshalAs(Unman agedType.Struct )]UUID riid,
[MarshalAs(Unman agedType.AsAny)]object ppvObject);
could someone give me a hint where I make my mistake ?
thx :)
Sven 4 6495
Hint .... long is 64 bit in .NET
Willy.
"Sven Gnagi" <Sv*******@hotm ail.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("olea cc.dll",CharSet =CharSet.Auto)] public static extern long AccessibleObjec tFromWindow ( long hwnd, long dwId, [MarshalAs(Unman agedType.Struct )]UUID riid, [MarshalAs(Unman agedType.Interf ace)]object ppvObject);
public struct UUID { public long Data1; public int Data2; public int Data3; [MarshalAs(Unman agedType.ByValA rray,SizeConst= 8)] public byte[] Data4; }
public static void TestAA() { UUID uid; uid.Data1 = (long)0x618736e 0; 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 = AccessibleObjec tFromWindow (wHandle,OBJID_ WINDOW,uid,accO bj);
but always get a E_INVALIDARG return value.
I also tried
[DllImport("olea cc.dll",CharSet =CharSet.Auto)] public static extern long AccessibleObjec tFromWindow ( long hwnd, long dwId, [MarshalAs(Unman agedType.Struct )]UUID riid, [MarshalAs(Unman agedType.AsAny)]object ppvObject);
could someone give me a hint where I make my mistake ?
thx :)
Sven
Sven, [DllImport("olea cc.dll",CharSet =CharSet.Auto)] public static extern long AccessibleObjec tFromWindow ( long hwnd, long dwId, [MarshalAs(Unman agedType.Struct )]UUID riid, [MarshalAs(Unman agedType.Interf ace)]object ppvObject);
I would declare it as
[DllImport("olea cc.dll", PreserveSig=fal se)]
[return: MarshalAs(Unman agedType.Interf ace)]
public static extern object AccessibleObjec tFromWindow (
IntPtr hwnd,
uint dwId,
ref Guid riid);
And call it with
Guid uid = new Guid("618736e0-3c3d-11cf-810c-00aa00389b71");
IAccessible accObj = (IAccessible)Ac cessibleObjectF romWindow(wHand le,
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("olea cc.dll",CharSet =CharSet.Auto)] public static extern long AccessibleObjec tFromWindow ( long hwnd, long dwId, [MarshalAs(Unman agedType.Struct )]UUID riid, [MarshalAs(Unman agedType.Interf ace)]object ppvObject); I would declare it as
[DllImport("olea cc.dll", PreserveSig=fal se)] [return: MarshalAs(Unman agedType.Interf ace)] public static extern object AccessibleObjec tFromWindow ( IntPtr hwnd, uint dwId, ref Guid riid);
And call it with
Guid uid = new Guid("618736e0-3c3d-11cf-810c-
00aa00389b71");IAccessible accObj = (IAccessible)
AccessibleObjec tFromWindow(wHa ndle,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("olea cc.dll",CharSet =CharSet.Auto)] public static extern long AccessibleObjec tFromWindow ( long hwnd, long dwId, [MarshalAs(Unman agedType.Struct )]UUID riid, [MarshalAs(Unman agedType.Interf ace)]object ppvObject); I would declare it as
[DllImport("olea cc.dll", PreserveSig=fal se)] [return: MarshalAs(Unman agedType.Interf ace)] public static extern object AccessibleObjec tFromWindow ( IntPtr hwnd, uint dwId, ref Guid riid);
And call it with
Guid uid = new Guid("618736e0-3c3d-11cf-810c-
00aa00389b71");IAccessible accObj = (IAccessible)
AccessibleObjec tFromWindow(wHa ndle,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 has been made.
Whenever I attempt to update my frmProgress, the events
are put placed at the end of the thread's queue and
executed after my algorithm is finished. Using the
frmProgress.Label.Invoke method with delagates, I have
heard would fix...
|
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 exe. The button clicking part is working fine, but I just
cannot get the method call.
Here is my program snippet.
**************************************************************
|
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 thread is aborted by the system.
How is one to keep the background thread from calling form.Invoke after the
form's window handle has been destroyed? This is definitely happening in my
application. I haven't read anything about this problem in...
|
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 with arguments
I need to do this as the method is being called Asynchronously from
elsewhere using delegate's BeginInvoke method.
The form is well created/initialized yet the messages states otherwise.
|
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) periodically calls a function Refresh().
This refresh function runs on its own thread and queries our database for
new jobs.
For each job found this timer invokes a delegate on one of the child thread
objects.
I then get the error "Cannot call...
| |
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 quite tiresome to have to write code to call MyControl.Invoke for each
control on the form, along with the delegates that are required for each.
Is there a better way to do this? What I mean is, if I could marshal the
|
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 thread. so far so good. all contacts r added properly.
now when another login adds me in his contact, i recv a subscription, so i popup a form and ask for accept/reject. this all happens in a separate thread. popup form gets opened and choice is...
|
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 waits
for the worker thread to complete by means of a while t.isAlive,
sleep(0) mechanism. But when my worker thread calls my
UpdateProgressBar routine, which calls Me.Invoke, the invoke call
blocks forever. But I can't figure out why the main...
|
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 ShowRecvdMessage))
|
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 or simple). I am hoping
the description will generate some ideas I can check out.
PROBLEM:
-----------------
Switching to UI thread using Invoke(), everything seems good.
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |