#38 Obtaining instances from Windows ROT table

open
nobody
5
2009-12-09
2009-12-09
Eduardo
No

Though Jacob supports getting existing objects by using a program id that has a colon in it (CoGetObject) sometimes monikers do not have colons in their names (an unsaved document for instance). Also sometimes CoGetObject did not seem to get the right moniker. This patch allows a user to pass a moniker explicitly, Jacob iterate the windows ROT table looking for that moniker and attaches to it

Discussion

  • Eduardo

    Eduardo - 2009-12-09
     
  • clay_shooter

    clay_shooter - 2009-12-25

    Can you provide a code example that shows how we can use this so we can include that as an example and show how it works?

     
  • Eduardo

    Eduardo - 2010-02-03

    Example on how the patch was used

     
    Attachments
  • Eduardo

    Eduardo - 2010-02-03

    I just attached an example. Sorry for the slow response.

     
  • clay_shooter

    clay_shooter - 2011-10-02

    I'd like to add this to the 1.16 release but I'm not sure what command line arguments to feed the sample program to see how it works. What does the moniker look like?

     
  • Eduardo

    Eduardo - 2011-10-04

    The example is design to invoke the Java program from within Excel with the provided macro. You will need to configure some paths on the Configuration tab to match your Java installation and location of the library and classes. The moniker typically is the path to the Excel file (i.e. C:\path\spreadsheet.xls), but if the file has never been saved it will just be a name. The provided files are templates so try right clicking and select new without saving. You can debug the Excel macro to see the details on how it gets invoked. Here is an example of a command line on a new file that has never been saved:
    C:\Program Files (x86)\Java\jre7\bin\javaw.exe -cp "Y:\JacobROTExample\classes;Y:\JacobROTExample\lib\swt.jar;Y:\JacobROTExample\lib\jacob.jar" -Djava.library.path="Y:\JacobROTExample\lib" jacob_rot_example.Main "jacob-example1" 524916

    The first parameter is the moniker that will be looked in the ROT (jacob-example1). The second is the window ID of Excel. It will be used by the SWT window as a parent to prevent user interaction with Excel while the Java app modifies it (I got COM errors when a user modified the spreadsheet at the same time as the program)

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks