Re: created nvda/experiment_useCompiledMSWordInterface e2aa0cc0: Experiment using a built interface for Office

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

Re: created nvda/experiment_useCompiledMSWordInterface e2aa0cc0: Experiment using a built interface for Office

derek riemer

Hi,

What has come of this experiment? I'm just curious.


On 7/27/2016 5:18 AM, NV Access Git wrote:

commit e2aa0cc0d2d38f6749763ba20dcd67bb36da632b

Author: Reef Turner [hidden email]

Date: Wed 27 Jul 2016 19:14:04 +0800

Experiment using a built interface for Office

Building office headers
Using visual studio 2015
- Create a new C++ console application, no precompiled headers
- add the following to the top of the file:

#import "C:\Program Files (x86)\Common Files\Microsoft Shared\OFFICE15\MSO.DLL"
#import "C:\Program Files (x86)\Common Files\Microsoft Shared\VBA\VBA6\VBE6EXT.OLB"
#import "C:\Program Files (x86)\Microsoft Office\Office15\MSWORD.OLB" \
auto_rename, \
raw_native_types, \
rename("ExitWindows","MsoExitWindows"), \
rename("FindText","MsoFindText"), \
named_guids

See https://msdn.microsoft.com/en-us/library/298h7faa.aspx for these
attributes. Or search for "MSVC #import Attributes"
The attributes we use:
- auto_rename - Renames C++ reserved words by appending two underscores
(__) to the variable name to resolve potential name conflicts.
- raw_native_types - Disables the use of COM support classes in the
high-level wrapper functions and forces the use of low-level data
types instead. To be compatible with existing code we want to use
BSTR rather than _bstr_t
- named_guids - Tells the compiler to define and initialize GUID
variables in old style, of the form LIBID_MyLib, CLSID_MyCoClass,
IID_MyInterface, and DIID_MyDispInterface.

The files created:
- have wrapped functions that emit C++ exceptions in the style:
- long MoveEnd (
- VARIANT * Unit = &vtMissing,
- VARIANT * Count = &vtMissing );
- and have unwrapped functions (no impl) that do not emit
exceptions in the style:
virtual HRESULT __stdcall raw_MoveEnd (
/*[in]*/ VARIANT * Unit,
/*[in]*/ VARIANT * Count,
/*[out,retval]*/ long * prop ) = 0;

Note use _variant_t instead of VARIANT.

Raw diff



------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity planning
reports.http://sdm.link/zohodev2dev


_______________________________________________
Nvda-commits mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/nvda-commits

--

Derek Riemer

  • Department of computer science, third year undergraduate student.
  • Proud user of the NVDA screen reader.
  • Open source enthusiast.
  • Member of Bridge Cu
  • Avid skiier.

Websites:
Honors portfolio
Awesome little hand built weather app!

[hidden email]
Phone: (303) 906-2194


------------------------------------------------------------------------------

_______________________________________________
Nvda-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/nvda-devel
Reply | Threaded
Open this post in threaded view
|

Re: created nvda/experiment_useCompiledMSWordInterface e2aa0cc0: Experiment using a built interface for Office

Reef Turner
Hi Derek, thanks for taking interest!

The scope of this test was fairly small, however from a technical standpoint this was successful. We were able to generate headers for the office API, and these were then able to be used in place of the dispatch calls that we currently have. This makes the code much easier to read, faster to develop, and less error prone.

In terms of where we go from here, there is still the question of multiple office versions. We will need to do some further testing with different versions of office, and will probably need to implement some safety checks around that. There are also some questions around the licensing, and whether or not this is fair use, or would violate any conditions of the Microsoft Word license. One line of thought is that by generating the headers we would only be automating something that we are currently doing anyway.

Regards,
Reef Turner

On Sun, Aug 28, 2016 at 6:02 AM, derek riemer <[hidden email]> wrote:

Hi,

What has come of this experiment? I'm just curious.


On 7/27/2016 5:18 AM, NV Access Git wrote:

commit e2aa0cc0d2d38f6749763ba20dcd67bb36da632b

Author: Reef Turner [hidden email]

Date: Wed 27 Jul 2016 19:14:04 +0800

Experiment using a built interface for Office

Building office headers
Using visual studio 2015
- Create a new C++ console application, no precompiled headers
- add the following to the top of the file:

#import "C:\Program Files (x86)\Common Files\Microsoft Shared\OFFICE15\MSO.DLL"
#import "C:\Program Files (x86)\Common Files\Microsoft Shared\VBA\VBA6\VBE6EXT.OLB"
#import "C:\Program Files (x86)\Microsoft Office\Office15\MSWORD.OLB" \
auto_rename, \
raw_native_types, \
rename("ExitWindows","MsoExitWindows"), \
rename("FindText","MsoFindText"), \
named_guids

See https://msdn.microsoft.com/en-us/library/298h7faa.aspx for these
attributes. Or search for "MSVC #import Attributes"
The attributes we use:
- auto_rename - Renames C++ reserved words by appending two underscores
(__) to the variable name to resolve potential name conflicts.
- raw_native_types - Disables the use of COM support classes in the
high-level wrapper functions and forces the use of low-level data
types instead. To be compatible with existing code we want to use
BSTR rather than _bstr_t
- named_guids - Tells the compiler to define and initialize GUID
variables in old style, of the form LIBID_MyLib, CLSID_MyCoClass,
IID_MyInterface, and DIID_MyDispInterface.

The files created:
- have wrapped functions that emit C++ exceptions in the style:
- long MoveEnd (
- VARIANT * Unit = &vtMissing,
- VARIANT * Count = &vtMissing );
- and have unwrapped functions (no impl) that do not emit
exceptions in the style:
virtual HRESULT __stdcall raw_MoveEnd (
/*[in]*/ VARIANT * Unit,
/*[in]*/ VARIANT * Count,
/*[out,retval]*/ long * prop ) = 0;

Note use _variant_t instead of VARIANT.

Raw diff



------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity planning
reports.http://sdm.link/zohodev2dev


_______________________________________________
Nvda-commits mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/nvda-commits

--

Derek Riemer

  • Department of computer science, third year undergraduate student.
  • Proud user of the NVDA screen reader.
  • Open source enthusiast.
  • Member of Bridge Cu
  • Avid skiier.

Websites:
Honors portfolio
Awesome little hand built weather app!

[hidden email]
Phone: <a href="tel:%28303%29%20906-2194" value="+13039062194" target="_blank">(303) 906-2194


------------------------------------------------------------------------------

_______________________________________________
Nvda-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/nvda-devel




--
Regards,
Reef Turner

------------------------------------------------------------------------------

_______________________________________________
Nvda-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/nvda-devel