Board index » delphi » TExcelApplication send to back

TExcelApplication send to back

how can i to send a TExcelApplication to back or bring in front ?
--
nr

 

Re:TExcelApplication send to back


<<Nicola Regge:
how can i to send a TExcelApplication to back or bring in front ?

Quote

This is easy in Windows95:

var
  ExcelHandle: HWND;
begin
  { Find the Excel window handle: this works for Excel 97 }
  ExcelHandle := FindWindow('XlMain', nil);
  if ExcelHandle <> 0 then
    { Send it to the back: }
    SetWindowPos(ExcelHandle, HWND_BOTTOM, 0, 0, 0, 0,
                 SWP_NOACTIVATE or SWP_NOMOVE or SWP_NOSIZE);
    { Or bring it to the front: }
    SetForegroundWindow(ExcelHandle);

I believe SetForegroundWindow won't work with later
Windows versions, as MS (rightly) decided that forcing
oneself to the front is impolite. I don't know whether
using SetWindowPos with a HWND_TOP parameter
would work, but I've heard there are workarounds
for this if you really must do it - ask on the winapi
newsgroup.

--
Deborah Pate

Other Threads