I'm wondering if MSAA is COM-based, then one should be able to use CreateObject("Accessibility") to create an instance and call its methods. I had no success doing that. I have "OLEACC.DLL" in SYSTEM32 and it's registered with Windows. But the CreateObject fails.
Any thoughts?
I would like to use functions like AccessibleObjectFromPoint() to get the IAccessible object of the control at the given point.
Has anybody had such an experience?
Any input would be highly appreciated,
Thanks,
Kamil
MSAA is COM based. However, there is no co-creatable class exposed, it exposes only interfaces. That's the reason you can't do CreateObject().
The MSAA-exposed APIs, like AccessibleObjectFromPoint and AccessibleObjectFromWindow are dll-exported C++ methods. You can use them from C++ by linking the proper lib or doing LoadLibrary/GetProcAddress with the function name. From C#, you can get the P/nvoke declaration for these from Pinvoke.net. For example, here's the DllImport for AccessibleObjectFromWindow.
Related
While using Revit API and browsing the "RevitAPI.chm" file (and browsing examples on the internet), I have noticed that some methods exist while not being listed neither in the "RevitAPI.chm" file nor suggested when using RevitPythonShell.
I explain. Let's say for instance that I have a "Space" Object, obtained with
s = FilteredElementCollector(doc).OfClass(SpatialElement).ToElements()
If I do, let's say (assuming s[0] is a valid Space object):
s[0].Geometry
I got an 'indexer object':
<indexer# object at 0x0000000000000049>
But if I do:
s[0].get_Geometry(Options())
Then I got my GeometryElement object. The same behavior goes with get_BoundingBox, for instance.
Now, that's fine, but the only way I could know about these get_something methods is by seeing examples (either on the "RevitAPI.chm", or on forums etc.). So that's kind of strange, isn't it? In the sense that these methods aren't actually listed.
So I guess my questions would be:
Is it the normal behavior? (or should I normally just get a GeometryElement object by using s[0].Geometry, for instance?)
If yes, ... why ? :D
What are these 'indexers' ?
Thanks!
Arnaud.
PS: Using Revit 2017, tests made with RevitPythonShell and pyRevit
The methods prefixed by a lowercase get_ are automatically generated getter methods. The official Revit API provides and documents the BoundingBox property on the Element class. Rather inelegantly, this so-called property takes an argument. Therefore, the C# .NET implementation generates a property getter function for it.
In IntelliJ IDEA, is there a way to see usages of a method nested in other usages?
I have a symfony2 app that has a class MyClass with method myMethod() this method is used in a bunch of services and controllers. I would like to trace all usages of this method all the way up to controllers that are linked to the app's routes. As a result, I would have a list of routes and corresponding controllers/methods that directly or indirectly use myMethod(). Is it possible?
In Java, it's Cmd-Alt-H (Ctrl-Alt-H on Windows), so I assume it's the same in PHP.
It's called "Call hierarchy". So you can use Cmd-shift-A (resp. Ctrl-shift-A and type "Call hierarchy" to find it.
I am new to the usage of reflection in Java/scala. It is not quite clear to me why we need to instantiate a type at runtime. An example would be the best. Thanks a lot.
I will give you a general example of where runtime type instantiation or in general inspection of a types is useful. Think of the Plugin Pattern. Assume you want to create an application that allows users to create plugins. You don't have the plugins the users are going to make in the future, at hand. How are you able to use their plugins after you have released your application? You need to be able to inspect their plugins for a method your application requires and then call said method.
In order to enable this, language designers create a platform in which you are able to query a module (jar in java, assemblies in .net) for the types it defines and the methods, fields, etc it contains. You can then call any method, instantiate any type you want and basically interact with the module as if you had the module at compile time and you were referencing it(well not exactly but you get the point).
Here's and example of a method call that happens at runtime. You can assume that we have already created foo from a string we get from a configuration file at runtime. foo was specified as the name of the jar file containing the plugin types. I don't want to provide the instantiation code as it would make this too bloated, but here is the method:
Method method = foo.getClass().getMethod("doSomething", null);
method.invoke(foo, null);
As you see, we basically got the type of the class foo, we queried it for a method using the method's name and then called it. By doing so we extended the functionality of our program with the plugin at runtime.
Flash builder lets me insert metadata for events fired by a class, example:
[Event("myEvent", "flash.events.Event")]
public class MyClass() {
}
Is there any way to do the same for Exceptions?
Currently I have checked here, and can't see it documented. Perhaps it's not even worthwhile, what are your thoughts.
There are ways to create your own metadata; and add that into your app at compile time. Use the keep-as3-metadata compiler argument.
It will be up to you to write code to do something with it at runtime; or to build IDE extensions to make use of the code while writing the code.
To access such metadata at runtime, you'll need to perform some type of introspection. Here are some docs and another StackOverflow Question about this.
Many Flex Frameworks make use of custom metadata.
Following up from my last question does anyone know how I can use a dictionary object in application scope in Classic ASP? You cannot use Scripting.Dictionary - if you try you will see something similar to the following:
Application object error 'ASP 0197 : 80004005'
Disallowed object use /xxx.asp, line 2. Cannot add object with apartment model behavior to the application intrinsic object.
I found this article on (good ol') 4GuysFromRolla but it points to Microsoft's free Lookup Component and a free Dictionary Component from Caprock Consulting - both of which are dead links.
The article clearly explains why you can't use the Scripting.Dictionary in application scope, but I was wondering if anyone knew of a free alternative or where I might find a copy of the old components that 4GuysFromRolla mentioned?
I was able to download the Dictionary Component from Caprock Consulting using this link: http://web.archive.org/web/20000619122506/http://www.caprockconsulting.com/data/CaprockDCT.zip
I have the LookupTable-component and can provide it to you if interested.
However, I have notived that you can use .NET HashTable in application-scope which might be useful for you.
just do this:
<object id="YOUR_VAR_NAME" progid="System.Collections.HashTable" runat="Server" scope="Application"></object>
this will give you a global, application-wide HashTable-object.
Beware of modifying this to heavily though, I have problems with memoryleaks where eventually the applications session-handling gets unreliable (doesn't invoke SessionStart properly)
i had the same issue and ended up feeding the application variable with the content of my dictionary and added
for each obj in application.Contents
if Left(obj,6) = "urlLog" then
application.Contents.Remove(obj)
end if
next
to kill all the application variables in the global.asa on application.end ( you could also use the Application.Contents.RemoveAll but i heard there was som issue with it leaving some variable up and causing memory leak even tho i could net find any solid source to prove it ...
anyway is the Caprock dictionary working for you ?