Problem with AccessibleObjectFromWindow

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem with AccessibleObjectFromWindow

Aaron Cohen
Please let me know if this email is sent more than once. I am following the MSDN Guidelines for AccessibleObjectFromWindow (http://msdn.microsoft.com/en-us/library/ms696137(VS.85).aspx). Which is the following:

Parameters

hwnd
[in] Specifies the handle of a window for which an object is to be retrieved. To retrieve an interface pointer to the cursor or caret object, specify NULL and use the appropriate object ID in dwObjectID.
dwObjectID
[in] Specifies the object ID. This value is one of the standard <a id="ctl00_rs1_mainContentContainer_ctl03" onclick="javascript:Track('ctl00_rs1_mainContentContainer_ctl00|ctl00_rs1_mainContentContainer_ctl03',this);" href="http://msdn.microsoft.com/en-us/library/ms696115(VS.85).aspx" style="text-decoration: none; color: rgb(128, 0, 128); ">object identifier constants or a custom object ID such as OBJID_NATIVEOM, which is the object ID for the Microsoft Office native object model. For more information about OBJID_NATIVEOM, see the Remarks section in this topic.
riid
[in] Specifies the reference identifier of the requested interface. This value is either IID_IAccessible or IID_IDispatch.
ppvObject
[out] Address of a pointer variable that receives the address of the specified interface.
For some reason MingW GCC does not like IID_IAccessible as a 3rd argument. Any help would be much appreciated. Here is a sample of the code:

#include <windows.h>
#include <winuser.h>
#include <winable.h>
#include <oleacc.h>
#include <stdio.h>

int main(int argc, char **argv) {
HWND desktop=GetDesktopWindow();
IAccessible *AccessibleObject = 0;
AccessibleObjectFromWindow(desktop,OBJID_WINDOW, IID_IAccessible,(void **)&AccessibleObject);
return 1;
}

Compilation:

gcc -O0 -g3 -Wall -c -fmessage-length=0 -otest.o ..\test.c
..\test.c: In function `main':
..\test.c:17: error: incompatible type for argument 3 of `AccessibleObjectFromWindow'
Build error occurred, build is stopped
Time consumed: 719  ms.  


Thank You!

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
MinGW-users mailing list
[hidden email]

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Reply | Threaded
Open this post in threaded view
|

Re: Problem with AccessibleObjectFromWindow

Роман Донченко
> Please let me know if this email is sent more than once. I am
> following the MSDN Guidelines for AccessibleObjectFromWindow
> (http://msdn.microsoft.com/en-us/library/ms696137(VS.85).aspx

<...>

> ).> ..\test.c:17: error: incompatible type for argument 3 of
> `AccessibleObjectFromWindow'

That is because they are indeed incompatible: IID_IAccessible is IID, while
the argument is REFIID (that is, IID *). Use "&IID_IAccessible".

Also, you are not supposed to include winuser.h directly (at least MS says
so), and ditto for winable.h (the latter was even removed from Platform
SDK).

> Thank You!

Hope this helps.
Roman.

--
Manually typed signature.



-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
MinGW-users mailing list
[hidden email]

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Reply | Threaded
Open this post in threaded view
|

Re: Problem with AccessibleObjectFromWindow

Aaron Cohen
Thanks! I included winable.h in order to get the declaration of  
OBJID_WINDOW. My apologies, I am new to developing for the windows  
platform.


On Oct 11, 2008, at 1:16 PM, Роман Донченко wrote:

>> Please let me know if this email is sent more than once. I am
>> following the MSDN Guidelines for AccessibleObjectFromWindow
>> (http://msdn.microsoft.com/en-us/library/ms696137(VS.85).aspx
>
> <...>
>
>> ).> ..\test.c:17: error: incompatible type for argument 3 of
>> `AccessibleObjectFromWindow'
>
> That is because they are indeed incompatible: IID_IAccessible is  
> IID, while
> the argument is REFIID (that is, IID *). Use "&IID_IAccessible".
>
> Also, you are not supposed to include winuser.h directly (at least  
> MS says
> so), and ditto for winable.h (the latter was even removed from  
> Platform
> SDK).
>
>> Thank You!
>
> Hope this helps.
> Roman.
>
> --
> Manually typed signature.
>
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's  
> challenge
> Build the coolest Linux based applications with Moblin SDK & win  
> great prizes
> Grand prize is a trip for two to an Open Source event anywhere in  
> the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> MinGW-users mailing list
> [hidden email]
>
> You may change your MinGW Account Options or unsubscribe at:
> https://lists.sourceforge.net/lists/listinfo/mingw-users


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
MinGW-users mailing list
[hidden email]

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Reply | Threaded
Open this post in threaded view
|

Re: Problem with AccessibleObjectFromWindow

Роман Донченко
> Thanks! I included winable.h in order to get the declaration of
> OBJID_WINDOW. My apologies, I am new to developing for the windows
> platform.

You will get OBJID_WINDOW (indirectly) from <windows.h> if you define WINVER
to be 0x0500 or higher before including it.

Interestingly enough, Windows SDK does not require this, and it appears to
be righter [sp?], since AccessibleObjectFromWindow exists in Windows 98, as
well.

Roman.

--
Manually typed signature.



-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
MinGW-users mailing list
[hidden email]

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Reply | Threaded
Open this post in threaded view
|

Re: Problem with AccessibleObjectFromWindow

Aaron Cohen
Thank you for your insight. Unforutunately after declaring winver to 0x0500, I got an similar error:

gcc -O0 -g3 -Wall -c -fmessage-length=0 -otest.o ..\test.c
..\test.c:11:1: warning: "WINVER" redefined
In file included from C:/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/windows.h:48,
                 from ..\test.c:8:
C:/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/windef.h:12:1: warning: this is the location of the previous definition
..\test.c: In function `main':
..\test.c:16: error: `OBJID_CLIENT' undeclared (first use in this function)
..\test.c:16: error: (Each undeclared identifier is reported only once
..\test.c:16: error: for each function it appears in.)
..\test.c:16: warning: unused variable `hr'

Using this code:

/*
 * test.c
 *
 *  Created on: Oct 4, 2008
 *      Author: amcohen
 */

#include <windows.h>
#include <oleacc.h>
#include <stdio.h>
#define WINVER 0x0500
#define winver 0x0500
int main(int argc, char **argv) {
HWND desktop=GetDesktopWindow();
IAccessible *AccessibleObject = 0;
HRESULT hr =  AccessibleObjectFromWindow(desktop,OBJID_CLIENT, &IID_IAccessible,(void **)&AccessibleObject);
return 1;
}

Could the problem be I declared 0x0500 and I am compiling it under winVista?

Thanks!

On Oct 12, 2008, at 10:38 AM, Роман Донченко wrote:

Thanks! I included winable.h in order to get the declaration of
OBJID_WINDOW. My apologies, I am new to developing for the windows
platform.

You will get OBJID_WINDOW (indirectly) from <windows.h> if you define WINVER
to be 0x0500 or higher before including it.

Interestingly enough, Windows SDK does not require this, and it appears to
be righter [sp?], since AccessibleObjectFromWindow exists in Windows 98, as
well.

Roman.

--
Manually typed signature.



-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
MinGW-users mailing list
[hidden email]

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
MinGW-users mailing list
[hidden email]

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Reply | Threaded
Open this post in threaded view
|

Re: Problem with AccessibleObjectFromWindow

John Brown


________________________________
> From: [hidden email]
> To: [hidden email]
> Date: Sun, 12 Oct 2008 17:51:47 -0400
> Subject: Re: [Mingw-users] Problem with AccessibleObjectFromWindow
>
> Thank you for your insight. Unforutunately after declaring winver to 0x0500, I got an similar error:
>
/* error message snipped */
>

You need to set WINVER *before* your #includes.
_________________________________________________________________
Stay up to date on your PC, the Web, and your mobile phone with Windows Live.
http://clk.atdmt.com/MRT/go/msnnkwxp1020093185mrt/direct/01/
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
MinGW-users mailing list
[hidden email]

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Reply | Threaded
Open this post in threaded view
|

Re: Problem with AccessibleObjectFromWindow

Aaron Cohen
...Right! Thank you for your help!
On Oct 12, 2008, at 6:35 PM, John Brown wrote:

>
>
> ________________________________
>> From: [hidden email]
>> To: [hidden email]
>> Date: Sun, 12 Oct 2008 17:51:47 -0400
>> Subject: Re: [Mingw-users] Problem with AccessibleObjectFromWindow
>>
>> Thank you for your insight. Unforutunately after declaring winver  
>> to 0x0500, I got an similar error:
>>
> /* error message snipped */
>>
>
> You need to set WINVER *before* your #includes.
> _________________________________________________________________
> Stay up to date on your PC, the Web, and your mobile phone with  
> Windows Live.
> http://clk.atdmt.com/MRT/go/msnnkwxp1020093185mrt/direct/01/
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's  
> challenge
> Build the coolest Linux based applications with Moblin SDK & win  
> great prizes
> Grand prize is a trip for two to an Open Source event anywhere in  
> the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> MinGW-users mailing list
> [hidden email]
>
> You may change your MinGW Account Options or unsubscribe at:
> https://lists.sourceforge.net/lists/listinfo/mingw-users


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
MinGW-users mailing list
[hidden email]

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users