Board index » delphi » Once again - Preventing the user from Closing Word in Ole Automation

Once again - Preventing the user from Closing Word in Ole Automation

I've got a third party applicaton that launches word to edit documents.
When the application is up, these things are true.

The File Menu is disabled (not visible) (I can duplicate this).
The 'Close Alt+F4' menu item on the system menu is not present (not Visble)
(Can not duplciate this).
The close button ('x') on the top right of the form is disabled. (is
visible). (Can not duplicate this).

A word of thanks from
the Increasingly desperate
Ruben

 

Re:Once again - Preventing the user from Closing Word in Ole Automation


Try posting to the win32api forum. Somebody there might know.

--
Binh Ly
Visit my COM Notes at http://www.castle.net/~bly/com

Ruben Vuittonet, Jr. <rv...@dbbinc.com> wrote in message
news:7tbp4e$rp415@forums.borland.com...

Quote
> I've got a third party applicaton that launches word to edit documents.
> When the application is up, these things are true.

> The File Menu is disabled (not visible) (I can duplicate this).
> The 'Close Alt+F4' menu item on the system menu is not present (not
Visble)
> (Can not duplciate this).
> The close button ('x') on the top right of the form is disabled. (is
> visible). (Can not duplicate this).

> A word of thanks from
> the Increasingly desperate
> Ruben

Re:Once again - Preventing the user from Closing Word in Ole Automation


<<Ruben Vuittonet, Jr.:
 The close button ('x') on the top right of the form is disabled. (is
visible). (Can not duplicate this).

Quote

procedure TForm1.FormShow(Sender: TObject);
var
  WordHandle: HWND;
  Menu: HMENU;
begin
  { Find the Word window handle: this works for Word 97 }
  WordHandle := FindWindow('OpusApp', nil);
  if WordHandle <> 0 then
  begin
    Menu := GetSystemMenu(WordHandle, False);
    EnableMenuItem(Menu, SC_CLOSE, MF_BYCOMMAND or MF_GRAYED);
  end;
end;

Deborah Pate

Other Threads