473,396 Members | 1,852 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,396 software developers and data experts.

Any idea how to get this API to work?

Private Declare Function AccessibleChildren Lib "oleacc" (ByVal
paccContainer As IAccessible, _
ByVal iChildStart As Integer, _
ByVal cChildren As Integer, _
ByVal rgvarChildren() As Object, _
ByVal pcObtained As Integer) As UInteger

Dim iTMP As Accessibility.IAccessible
Dim lngTMP2 As Integer
iTMP = lngTMP
Dim lngCount As Integer
lngCount = iTMP.accChildCount
Dim Children(lngCount - 1) As Object

Call AccessibleChildren(iTMP, 0, (lngCount - 1), Children(0), lngTMP2)

I can't get the 'rgvarChildren' parameter correct.

My code's translated from the following C# code:

[DllImport("Oleacc.dll")]
public static extern int AccessibleChildren(
Accessibility.IAccessible paccContainer,
int iChildStart,
int cChildren,
[Out] object[] rgvarChildren,
out int pcObtained);

int _ChildCount = IACurrent.accChildCount;
object[] _Children = new object[_ChildCount];
int _out;

AccessibleChildren(IACurrent,0,_ChildCount-1,_Children,out _out);
Thanks in advance

Sep 3 '07 #1
4 2140
Private Declare Function AccessibleChildren Lib "oleacc" (ByVal
paccContainer As IAccessible, _
ByVal iChildStart As Integer, _
ByVal cChildren As Integer, _
ByVal rgvarChildren() As Object, _
ByVal pcObtained As Integer) As UInteger

Dim iTMP As Accessibility.IAccessible
Dim lngTMP2 As Integer
iTMP = lngTMP
Dim lngCount As Integer
lngCount = iTMP.accChildCount
Dim Children(lngCount - 1) As Object

Call AccessibleChildren(iTMP, 0, (lngCount - 1), Children(0), lngTMP2)

I can't get the 'rgvarChildren' parameter correct.
Pass in Children rather than Children(0).

You should also change the pcObtained parameter to ByRef.
Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Sep 3 '07 #2
On Sep 4, 2:51 am, Mattias Sjögren <mattias.dont.want.s...@mvps.org>
wrote:
Private Declare Function AccessibleChildren Lib "oleacc" (ByVal
paccContainer As IAccessible, _
ByVal iChildStart As Integer, _
ByVal cChildren As Integer, _
ByVal rgvarChildren() As Object, _
ByVal pcObtained As Integer) As UInteger
Dim iTMP As Accessibility.IAccessible
Dim lngTMP2 As Integer
iTMP = lngTMP
Dim lngCount As Integer
lngCount = iTMP.accChildCount
Dim Children(lngCount - 1) As Object
Call AccessibleChildren(iTMP, 0, (lngCount - 1), Children(0), lngTMP2)
I can't get the 'rgvarChildren' parameter correct.

Pass in Children rather than Children(0).

You should also change the pcObtained parameter to ByRef.

Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.orghttp://www.msjogren.net/dotnet/|http://www.dotnetinterop.com
Please reply only to the newsgroup.
It still doesn't work on VB 2005. An empty Children is returned.
However, it does work on VB6 by declaring Children as a Variant. Any
ideas?

Sep 4 '07 #3
>It still doesn't work on VB 2005. An empty Children is returned.
>However, it does work on VB6 by declaring Children as a Variant. Any
ideas?
Try declaring the parameter like this then

<[Out], MarshalAs(UnmanagedType.LPArray,
ArraySubType:=UnmanagedType.Struct)ByVal rgvarChildren() As Object
Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Sep 4 '07 #4
On Sep 5, 3:10 am, Mattias Sjögren <mattias.dont.want.s...@mvps.org>
wrote:
It still doesn't work on VB 2005. An empty Children is returned.
However, it does work on VB6 by declaring Children as a Variant. Any
ideas?

Try declaring the parameter like this then

<[Out], MarshalAs(UnmanagedType.LPArray,
ArraySubType:=UnmanagedType.Struct)ByVal rgvarChildren() As Object

Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.orghttp://www.msjogren.net/dotnet/|http://www.dotnetinterop.com
Please reply only to the newsgroup.
Thanks a lot Mattias. It's working perfectly!! Thank you!!

Sep 6 '07 #5

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

Similar topics

29
by: Jim Hubbard | last post by:
Yet another hotfix alert (http://www.kbalertz.com/Feedback_823535.aspx) that states "To resolve this problem immediately, contact Microsoft Product Support Services to obtain the hotfix." ...
1
by: Lipei | last post by:
I have once try IntelliJ IDEA.And I can refactor easily,I can add try and catch just by a few clicks.It also can help me analazy the program's error.(e.g It warned me that I did't initialize the...
5
by: Hugo Elias | last post by:
Hi all, I have an idea for a better IDE. Though I don't have the skills required to write such a thing, if anyone's looking for a killer app, maybe this is it. If I'm typing at a rate of 10...
12
by: Generic Usenet Account | last post by:
I am going through some legacy code that has an "isNull()" method defined on certain classes. I can see that this can be a good way to eliminate certain types of crashes, by making this the first...
0
by: John Crowley | last post by:
I keep running into this over and over again... I want a block server control that renders a header and footer, and child controls in between. But I don't want a templated control, for the...
2
by: Nathan | last post by:
I've spent a good part of the afternoon searching Google and the newsgroups for some sort of answer - so I apologize if I'm asking something that has already been asked and answered. I'm using...
54
by: sam.s.kong | last post by:
Hi! I've been programming ASP for 5 years and am now learning PHP. In ASP, you can use GetRows function which returns 2 by 2 array of Recordset. Actually, it's a recommended way in ASP when you...
12
by: Paul H | last post by:
A little off topic this one because the database may not be written in Access. I am just looking for some advice.. I have an idea to help prevent a particular type of crime, a database will be...
32
by: Matias Jansson | last post by:
I come from a background of Java and C# where it is common practise to have one class per file in the file/project structure. As I have understood it, it is more common practice to have many...
28
by: onkar | last post by:
This idea might be vey crazy. But I hope to get answers to this .. from comp.lang.c If a compiler is designed such that it automatically adds a free() matching every malloc() then is it not a...
0
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...
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
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
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
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
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
tracyyun
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...
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.