Help me understand ComObject()
Help me understand ComObject()
I want to translate a code from AHK to VB6. I have managed to understand and translate all the commands but one: ComObject(9, <xxx>, 1) where <xxx> is a ComObjQuery() statement. What exactly ComObject() does and what is the equivalent for Microsoft?
Re: Help me understand ComObject()
ComObj(9, ComObjQuery(Acc,"{618736e0-3c3d-11cf-810c-00aa00389b71}"), 1)
Can anyone tell me what this command does exactly? What exactly is retrieved from the registry with ComObjQuery() and what exactly does ComObj()?
Can anyone tell me what this command does exactly? What exactly is retrieved from the registry with ComObjQuery() and what exactly does ComObj()?
- Blackholyman
- Posts: 1293
- Joined: 29 Sep 2013, 22:57
- Location: Denmark
- Contact:
Re: Help me understand ComObject()
What script are you trying to convert?
You may not need this function
The inner is querying for a raw interface pointer and the outer is then getting a script usable com object from that pointer
You may not need this function
The inner is querying for a raw interface pointer and the outer is then getting a script usable com object from that pointer
Courses on AutoHotkey
My Autohotkey Blog
Re: Help me understand ComObject()
I am trying to translate this: https://autohotkey.com/boards/viewtopic ... rowser+tabBlackholyman wrote:What script are you trying to convert?
You may not need this function
The inner is querying for a raw interface pointer and the outer is then getting a script usable com object from that pointer
I think I know how to translate the inner with objectIa.QueryInterface() but I have no idea for the outer.
- Blackholyman
- Posts: 1293
- Joined: 29 Sep 2013, 22:57
- Location: Denmark
- Contact:
Re: Help me understand ComObject()
I don't know vba that well so can't really tell you where to find that info
Courses on AutoHotkey
My Autohotkey Blog
Re: Help me understand ComObject()
I haven't touched VB6 in over a decade, and never had to do the equivalent of QueryInterface, but don't think you actually call QueryInterface. Just add the right type library as a reference, declare a variable of the right interface type, and assign the object to it.
ComObject() is highly specific to AutoHotkey. VB6 is a COM-based language; you typically don't deal with the pointers directly in VB6, just references to objects.
I would suggest looking for resources on the topic of using Active Accessibility in VB6.
@Blackholyman: VBA is not VB6.
ComObject() is highly specific to AutoHotkey. VB6 is a COM-based language; you typically don't deal with the pointers directly in VB6, just references to objects.
I would suggest looking for resources on the topic of using Active Accessibility in VB6.
@Blackholyman: VBA is not VB6.
Re: Help me understand ComObject()
To be honest, I use another type of Basic which is VB with some extra abilities. Do not worry about that. The only thing is to understand what ComObj does. For example, I understood that ComObjQuery retrieves something from the IAccessible interface from Windows Registry. The acc variable indicates what to retrieve. I want to understand something like that for ComObj too.
Re: Help me understand ComObject()
If you want my description of it, look in the manual. If that's not good enough, you'll need to ask a more specific question (or wait for someone else to answer).
No, it does nothing like that.For example, I understood that ComObjQuery retrieves something from the IAccessible interface from Windows Registry. The acc variable indicates what to retrieve.
Re: Help me understand ComObject()
I have already read it but it didn't help. I don't want to get rude, but, what more should I ask? I have posted the initial code that I want to translate, I ask what exactly these commands do, what more should I say? The only thing that I should say now, is that I want to translate these two lines in C++. Forget VB6.lexikos wrote:If you want my description of it, look in the manual. If that's not good enough, you'll need to ask a more specific question (or wait for someone else to answer).
Are you referring to ComObj or ComObjQuery?lexikos wrote:No, it does nothing like that.
Re: Help me understand ComObject()
This is my version of Acc_Query():
For ComObject() see ComObjActive()
Code: Select all
; ----------------------------------------------------------------------------------------------------------------------------------
; Retrieves the IAccessible interface from an IDispatch interface, if any, and releases the IDispatch interface on success.
; Thanks Lexikos - www.autohotkey.com/forum/viewtopic.php?t=81731&p=509530#509530
; ----------------------------------------------------------------------------------------------------------------------------------
Acc_Query(Acc) {
Try
IA := ComObjQuery(Acc, "{618736e0-3c3d-11cf-810c-00aa00389b71}")
Catch E
Return Acc_Error(A_ThisFunc, E)
ObjRelease(Acc)
Return ComObj(9, IA, 1)
}
Re: Help me understand ComObject()
I have already read it and didn't help. Why do you need ComObj()? What does it do for you? What does parameter 9 do? What does parameter 1 do? What's the point?just me wrote:This is my version of Acc_Query():For ComObject() see ComObjActive()Code: Select all
; ---------------------------------------------------------------------------------------------------------------------------------- ; Retrieves the IAccessible interface from an IDispatch interface, if any, and releases the IDispatch interface on success. ; Thanks Lexikos - www.autohotkey.com/forum/viewtopic.php?t=81731&p=509530#509530 ; ---------------------------------------------------------------------------------------------------------------------------------- Acc_Query(Acc) { Try IA := ComObjQuery(Acc, "{618736e0-3c3d-11cf-810c-00aa00389b71}") Catch E Return Acc_Error(A_ThisFunc, E) ObjRelease(Acc) Return ComObj(9, IA, 1) }
Re: Help me understand ComObject()
Wraps ... a raw IDispatch pointer in a usable object ...
Re: Help me understand ComObject()
ComObject() is highly specific to AutoHotkey. Just use the pointer directly in C++.doctorMe wrote:The only thing that I should say now, is that I want to translate these two lines in C++. Forget VB6.
As for the C++ equivalent of ComObjQuery, see 'General Remarks' in the documentation.
I was referring to the part of your post that I quoted, hence the quote; i.e. ComObjQuery.Are you referring to ComObj or ComObjQuery?lexikos wrote:No, it does nothing like that.
Re: Help me understand ComObject()
Just for the record, it can be inferred from @JustMe's code snippet that ComObj() appears to be a functional, but (to-date) undocumented equivalent to ComObject().
itros "ylbbub eht tuO kaerB" a ni kcuts m'I pleH
Re: Help me understand ComObject()
Wouldn't this applylmstearn wrote: ↑31 May 2020, 10:29Just for the record, it can be inferred from @JustMe's code snippet that ComObj() appears to be a functional, but (to-date) undocumented equivalent to ComObject().
https://www.autohotkey.com/docs/commands/ComObjActive.htm#Remarks wrote:In current versions, any function-call beginning with "ComObj" that does not match one of the other COM functions actually calls ComObjActive.
Re: Help me understand ComObject()
Missed the remarks section, sorry. Given that, all the possible alternatives should be explicitly listed in (the header area of, if not, at least in bold or code) the docs for ComObjActive, or else there would be no reason to suppose why any random functions Foo like ComObjFoo won't work.
Googling something like ComObj brings up the ComObjActive page, and the Google search hit sample includes the remarks section with the highlighted ComObj, Unfortunately. I've been in the habit of Googling things like "ComObj AHK" where ComObj is not highlighted in the search hit sample for ComObjActive as it should.
Googling something like ComObj brings up the ComObjActive page, and the Google search hit sample includes the remarks section with the highlighted ComObj, Unfortunately. I've been in the habit of Googling things like "ComObj AHK" where ComObj is not highlighted in the search hit sample for ComObjActive as it should.
itros "ylbbub eht tuO kaerB" a ni kcuts m'I pleH
Re: Help me understand ComObject()
I think you missed the implication of any function-call beginning with "ComObj" . I can't be bothered to do the math to calculate how many alternatives are possible; it is too many to list in the documentation, unless you want the documentation to include a script to generate all possible combinations.lmstearn wrote:Given that, all the possible alternatives should be explicitly listed
Just use one of the two listed at the top of the page.
However, this behaviour will be unavailable in a future release, so it is best to use only ComObject() and ComObjActive() as shown on this page.