Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Code fine; .exe NOT!

Status
Not open for further replies.

vellakaran

Programmer
May 22, 2003
9
CA
Here is the problem: i have form that when a button, "Spell Check", is pressed it brings up Word and does the spell checking. When i test run it through delphi, everything is ok, but when i run the .exe, Word does not "pop-up" and become the active current document. i have to click in the taskbar to select it. any ideas on why it doesnt work int he .exe but works fine through delphi? any fixes?

i am using Windows XP Professional Version 2002 & Delphi Version 4.0 (Build 5.108) Update Pack 3

thanks!
 
I recall there is a property or method like SetFocus or BringToFront (called differently, 'ofcourse' it's M$) to the Word object that has to be set/called to pop it to the foreground.

HTH
TonHu
 
ok i tried some different ways to get the Wrod document to pop-up, setfocus, bringtofront etc...and they were all unrecognized method names. is there anywhere i can find out what methods are available for this OLE object?

also here is the code that is opening Word:
begin
WordApp.FileNew('Normal');
DBMemoMsgOnStmt.CutToClipboard;
WordApp.EditPaste;
WordApp.EditSelectAll;
WordApp.AppShow;
WordApp.ToolsSpellSelection;
WordApp.EditSelectAll;
WordApp.EditCut;
DBMemoMsgOnStmt.PasteFromClipboard;
WordApp.FileExit[2];
end;

any ideas??
 
ok this is what i found out. windows XP has changed the way that this behaviour works: when a background task is activated, Windows XP may prevent it from moving to the foreground, and flashes the icon instead.

This behavior is designed to keep background tasks from stealing focus.

You can control this behavior by editing the registry:

1. Use Regedt32 to navigate to HKEY_CURRENT_USER\Control Panel\Desktop.

2. Edit or Add Value name ForegroundLockTimeout, a REG_DWORD data type. Set the data value to 0 to disable this behavior. The default value is 200000 milliseconds and after that time the window is supposed to come to the foreground but it really doesnt. So its either 0 or never have the window come up.

 
hi,

try to use this code:

FWordApp.ActiveDocument;
FWordApp.Visible := True;
FWordApp.Activate;

Steph [Bigglasses]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top