Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow calling COM methods/getters requirering hybrid calling (METHOD+PROPERTYGET convention) #595

Conversation

matthiasblaesing
Copy link
Member

It was found, that calling InchesToPoints method from word type library
failed. Research lead to

https://www.delphitools.info/2013/04/30/gaining-visual-basic-ole-super-powers/
https://msdn.microsoft.com/en-us/library/windows/desktop/ms221486(v=vs.85).aspx

Summary: there are methods in the word typelibrary that require both
PROPERTYGET and METHOD to be set. With only one of these set the call
fails.

The article from delphitools argues, that automation compatible libraries
need to be compatible with VisualBasic which does not distingish methods
and property getters and will set both flags always.

The MSDN article advises this behaviour: "[...] Some languages cannot
distinguish between retrieving a property and calling a method. In this
case, you should set the flags DISPATCH_PROPERTYGET and DISPATCH_METHOD.
[...]"

This further support the advised way from delphitools and was implemented.

@@ -35,6 +35,7 @@ Features
* [#569](https://github.com/java-native-access/jna/pull/569): Added `com.sun.jna.platform.win32.Winspool.PRINTER_INFO_2` support. Added GetPrinter and ClosePrinter functions in `com.sun.jna.platform.win32.Winspool` - [@IvanRF](https://github.com/IvanRF).
* [#583](https://github.com/java-native-access/jna/pull/583): Added printer attributes and status - [@IvanRF](https://github.com/IvanRF).
* [#589](https://github.com/java-native-access/jna/pull/589): Use MethodResultContext in direct mapping (as done in interface mapping) - [@marco2357](https://github.com/marco2357).
* [#595](https://github.com/java-native-access/jna/pull/595): Allow calling COM methods/getters requirering hybrid calling (METHOD+PROPERTYGET) [@matthiasblaesing](https://github.com/matthiasblaesing).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing - before your name :(

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks - was corrected.

…PROPERTYGET convention)

It was found, that calling InchesToPoints method from word type library
failed. Research lead to 

https://www.delphitools.info/2013/04/30/gaining-visual-basic-ole-super-powers/
https://msdn.microsoft.com/en-us/library/windows/desktop/ms221486(v=vs.85).aspx

Summary: there are methods in the word typelibrary that require both
PROPERTYGET _and_ METHOD to be set. With only one of these set the call
fails.

The article from delphitools argues, that automation compatible libraries
need to be compatible with VisualBasic which does not distingish methods
and property getters and will set both flags always.

The MSDN article advises this behaviour: "[...] Some languages cannot 
distinguish between retrieving a property and calling a method. In this 
case, you should set the flags DISPATCH_PROPERTYGET and DISPATCH_METHOD.
[...]"

This further support the advised way from delphitools and was implemented.
dblock added a commit that referenced this pull request Feb 16, 2016
…ention

Allow calling COM methods/getters requirering hybrid calling (METHOD+PROPERTYGET convention)
@dblock dblock merged commit 0864d49 into java-native-access:master Feb 16, 2016
@dblock
Copy link
Member

dblock commented Feb 16, 2016

Merged this.

@matthiasblaesing matthiasblaesing deleted the com_hybrid_calling_convention branch February 18, 2016 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants