C
chovatia.jaydeep
Hi,
I want to hide Minimize/Maximize/Close("X") buttons of an Excel
sheet(2007) which appears on title bar. To hide the buttons
programmatically, i write following code:
Please assume that my excel sheet is opened on desktop whose caption
is: "EXCELSHEET_TEST"
------------------------------------------------------------------------------------------------------------
HWND hwndExcelHandler = FindWindow(NULL, "EXCELSHEET_TEST");
DWORD dwStyle = GetWindowLong(hwndExcelHandler, GWL_STYLE);
::SetWindowLong(hwndExcelHandler, GWL_STYLE, (dwStyle &
~WS_MAXIMIZEBOX));
dwStyle = GetWindowLong(hwndExcelHandler, GWL_STYLE);
::SetWindowLong(hwndExcelHandler, GWL_STYLE, (dwStyle &
~WS_MINIMIZEBOX));
HMENU hMenuOfXLS = ::GetSystemMenu(hwndExcelHandler, false);
:eleteMenu(hMenuOfXLS, SC_CLOSE, MF_BYCOMMAND); //ok actually
remove the close button
------------------------------------------------------------------------------------------------------------
This code successfully hides MINIMIZE and MAXIMIZE buttons, but it
doesn't hide CLOSE("X") button appears on title bar.
I tried testing it with Excel 2003 and it gives me expected results.
It hides all of three buttons MINIMIZE/MAXIMIZE/CLOSE of Excel 2003
titlebar.
Can anyone please suggest me why this code doesn't works for Excel
2007?
Any suggestion on the same would be appreciated.
Thank You,
Jaydeep
I want to hide Minimize/Maximize/Close("X") buttons of an Excel
sheet(2007) which appears on title bar. To hide the buttons
programmatically, i write following code:
Please assume that my excel sheet is opened on desktop whose caption
is: "EXCELSHEET_TEST"
------------------------------------------------------------------------------------------------------------
HWND hwndExcelHandler = FindWindow(NULL, "EXCELSHEET_TEST");
DWORD dwStyle = GetWindowLong(hwndExcelHandler, GWL_STYLE);
::SetWindowLong(hwndExcelHandler, GWL_STYLE, (dwStyle &
~WS_MAXIMIZEBOX));
dwStyle = GetWindowLong(hwndExcelHandler, GWL_STYLE);
::SetWindowLong(hwndExcelHandler, GWL_STYLE, (dwStyle &
~WS_MINIMIZEBOX));
HMENU hMenuOfXLS = ::GetSystemMenu(hwndExcelHandler, false);
:eleteMenu(hMenuOfXLS, SC_CLOSE, MF_BYCOMMAND); //ok actually
remove the close button
------------------------------------------------------------------------------------------------------------
This code successfully hides MINIMIZE and MAXIMIZE buttons, but it
doesn't hide CLOSE("X") button appears on title bar.
I tried testing it with Excel 2003 and it gives me expected results.
It hides all of three buttons MINIMIZE/MAXIMIZE/CLOSE of Excel 2003
titlebar.
Can anyone please suggest me why this code doesn't works for Excel
2007?
Any suggestion on the same would be appreciated.
Thank You,
Jaydeep