views:

660

answers:

1

Friends,

In testing our Oracle Forms application on Vista I have found a interesting "challenge".

The application can invoke the Microsoft Word spell checker to perform a spell check on a field. When invoked, the user is shown the standard Microsoft Word spell checker dialog window. Word itself is invisble to the user.

The Spell Checker is invoked from Forms using Automation and the method used is based on the metalink note: 295449.1 How To Integrate The MS Word Spell Checker With Forms Using WebUtil.

This has worked well when invoked using Windows XP and Office 2003.

However when this same (unchanged) functionality is run on Vista, the Microsoft Word Spell Checker dialog window appears behind the browser window so to the user it appears that nothing has happened and the functionality isn't working(There is no indication on the Vista taskbar that spell checker has been invoked)

The problem occurs on Vista with Office 2007 and Office 2003. I can see that the problem is caused by Vista because if I use the same url used to launch the Forms application on WindowsXP, the Microsoft Word Spell Checker dialog window appears as expected, which is in front.

Within Vista I have tried setting the compatability mode for Office to Windows XP SP2 but the problem remains.

I have also tried explicitly setting ACTIVATE (as you can see from the sample code below) but without success.

Has anyone else run in to this? Any help or pointers to where others have experienced this problem would be gratefully received!

My environment details are:

Environment Details

Oracle Forms: 10.1.2.3 JRE: Sun JRE 1.6.0_14 Database: 10.2.0.3 Vista: Business Edition with Service Pack 1 Office: 2003 or 2007

The code (which needs to go in a client side Oracle) used to invoke the spell checker is:

PROCEDURE SPELL_CHECK (ITEM_NAME IN VARCHAR2) IS 

 MY_APPLICATION  CLIENT_OLE2.OBJ_TYPE; 
 MY_DOCUMENTS   CLIENT_OLE2.OBJ_TYPE; 
 MY_DOCUMENT   CLIENT_OLE2.OBJ_TYPE; 
 MY_SELECTION   CLIENT_OLE2.OBJ_TYPE; 
 GET_SPELL    CLIENT_OLE2.OBJ_TYPE; 
 MY_SPELL     CLIENT_OLE2.OBJ_TYPE; 
 ARGS      CLIENT_OLE2.LIST_TYPE; 
 SPELL_CHECKED  VARCHAR2(4000); 
 ORIG_TEXT    VARCHAR2(4000); 

BEGIN 
  ORIG_TEXT := ITEM_NAME; 

-- CREATE WORD.APPLICATION OBJECT 
  MY_APPLICATION := CLIENT_OLE2.CREATE_OBJ('WORD.APPLICATION');  
  --CLIENT_OLE2.SET_PROPERTY(MY_APPLICATION, 'VISIBLE', FALSE);
  CLIENT_OLE2.SET_PROPERTY(MY_APPLICATION, 'VISIBLE', TRUE);  

  --CLIENT_OLE2.INVOKE(MY_APPLICATION, 'ACTIVATE');  


-- GET HANDLE FOR DOCUMENTS COLLECTION 
  MY_DOCUMENTS := CLIENT_OLE2.GET_OBJ_PROPERTY(MY_APPLICATION, 'DOCUMENTS'); 

-- ADD A NEW DOCUMENT TO THE DOCUMENTS COLLECTION 
  MY_DOCUMENT := CLIENT_OLE2.INVOKE_OBJ(MY_DOCUMENTS, 'ADD'); 

-- GET HANDLE FOR SELECTION OBJECT 
  MY_SELECTION := CLIENT_OLE2.GET_OBJ_PROPERTY(MY_APPLICATION, 'SELECTION'); 

-- INSERT THE TEXT FIELD INTO DOCUMENT 
  CLIENT_OLE2.SET_PROPERTY(MY_SELECTION, 'TEXT', ORIG_TEXT); 

-- GET HANDLE FOR ACTIVE DOCUMENT  
  GET_SPELL := CLIENT_OLE2.GET_OBJ_PROPERTY(MY_APPLICATION, 'ACTIVEDOCUMENT'); 

-- INVOKE SPELL CHECKER 
  CLIENT_OLE2.INVOKE(GET_SPELL, 'CHECKSPELLING'); 

  CLIENT_OLE2.INVOKE(MY_APPLICATION, 'ACTIVATE');  

-- Added to handle a cancel request.  
  CLIENT_OLE2.INVOKE(MY_SELECTION,'WholeStory');   
  CLIENT_OLE2.INVOKE(MY_SELECTION,'Copy');  

-- GET CHECKED TEXT FROM DOCUMENT 
  SPELL_CHECKED := CLIENT_OLE2.GET_CHAR_PROPERTY(MY_SELECTION, 'TEXT'); 

-- REFORMAT RETURN TEXT TO DISPLAY CORRECTLY IN FORMS 
  SPELL_CHECKED := substr(replace(SPELL_CHECKED,chr(13),chr(10)), 1, length(SPELL_CHECKED)); 

-- COPY NEW TEXT IN THE FORM 
  COPY(SPELL_CHECKED,ITEM_NAME); 

-- CLOSE THE DOCUMENT WITHOUT SAVING 
  ARGS := CLIENT_OLE2.CREATE_ARGLIST;  
  CLIENT_OLE2.ADD_ARG(ARGS, 0);  
  CLIENT_OLE2.INVOKE(MY_DOCUMENT, 'CLOSE',ARGS); 
  CLIENT_OLE2.DESTROY_ARGLIST(ARGS);  

-- RELEASE THE OLE OBJECTS 
  CLIENT_OLE2.RELEASE_OBJ(MY_SELECTION); 
  CLIENT_OLE2.RELEASE_OBJ(GET_SPELL); 
  CLIENT_OLE2.RELEASE_OBJ(MY_DOCUMENT); 
  CLIENT_OLE2.RELEASE_OBJ(MY_DOCUMENTS); 
  CLIENT_OLE2.INVOKE(MY_APPLICATION, 'QUIT'); 
  CLIENT_OLE2.RELEASE_OBJ(MY_APPLICATION);     

END;

EDIT: 10/08/2009

This link http://www.experts-exchange.com/Microsoft/Development/MS_Access/Q_23085081.html details the same problem (but this time instead of oracle forms controlling word, it's ms access) Unfortunately I can't see the answer(if there is one that is!)

EDIT: 12/08/2009

All the link to expert-exchange states is that this is a vista problem - like I didn't know that!

+1  A: 

Looks like this can't be solved using Automation\OLE alone, this thread notes there is a problem with the activate method within OLE\Automation and Vista.

The way round it is to call the windows api to manipulate the windows.

carpenteri