Function is used to showhide the taskbar

xiaoxiao2021-03-06  16

// coolutils.h

#ifndef __coolutils_h # define __coolutils_h # include "stdafx.h"

Void gshowhidetaskbar (/ * in * / bool bhide = false);

HMENU GHIDEMENU (/ * in * / cwnd * pwnd);

Bool GShowMenuBack (/ * in * / hmenu hmenu, / * in * / cwnd * pwnd);

#ENDIF

// coolutils.cpp

#include "stdafx.h" #include "coolutils.h"

/ ************************************************** ************************** * Function name: gshowhidetaskbar () * * parameters: bool bhide (flag to Toggle show / hide of taskbar) * * Return type: void * * Purpose: Function is used to Show / Hide the TaskBar * * Author: Ashutosh R. Bhatikar (ARB) * * Date written: 20th December 2000 * * modification History: * * Date of modification Reason * * 25th december 2000 added methods to show / hide menu * ************************************************** *********************************************** /

Void gshowhidetaskbar (Bool Bhide / * = false * /) {create RectWorkarea = CRECT (0,0,0,0); CRECT RectTaskbar = CRECT (0, 0, 0, 0); CWND * PWND = CWnd :: FindWindow "Shell_traywnd", "");

if (bHide) {// Code to Hide the System Task Bar SystemParametersInfo (SPI_GETWORKAREA, 0, (LPVOID) & rectWorkArea, 0); if (pWnd) {pWnd-> GetWindowRect (rectTaskBar); rectWorkArea.bottom = rectTaskBar.Height ( ); SystemParametersInfo (SPI_Setworkarea, 0, (LPVOID) & RectWorkarea, 0);

pWnd-> ShowWindow (SW_HIDE);}} else {// Code to Show the System Task Bar SystemParametersInfo (SPI_GETWORKAREA, 0, (LPVOID) & rectWorkArea, 0); if (pWnd) {pWnd-> GetWindowRect (rectTaskBar); rectWorkArea. Bottom - = RectTaskBar.height (); SystemParametersInfo (SPI_Setworkarea, 0, (LPVOID) & RectWorkarea, 0); PWND-> ShowWindow (sw_show);}}}

/ ************************************************** ************************************ * Function Name: GHIDEMENU () * * Parameters: CWND * PWND (Window Associated with the menu) * * * Return type: HMENU * * Purpose: Function hides the menu associated with pWnd * * Author: Ashutosh R. Bhatikar (ARB) * * Date written: 25nd December 2000 * * modification History: * * Date of modification Reason * **** *********************************************************** ********************* /

HMENU GHIDEMENU (/ * in * / cwnd * pwnd) {hmenu hmenu = :: getMenu (pWnd-> getsafehwnd ()); if (hmenu! = Null) {// invalidate before setmenu Since We are going to replace // the frame's client area anyway pWnd-> Invalidate (); pWnd-> SetMenu (NULL); if (pWnd-> IsKindOf (RUNTIME_CLASS (CFrameWnd))) {CFrameWnd * pFrameWnd = (CFrameWnd *) pWnd; // avoid any idle menu processing PframeWnd-> m_nidleflags & = ~ cframeWnd :: idleMenu;} return;} return null;

/ ************************************************** ************************** * Function name: gshowmenuBack () * * parameters: HMenu HMenu (Handle of the Menu Which Was Hidden) * * CWnd * pWnd (Window associated with the menu) * * Return type: BOOL * * Purpose: Function shows back the menu associated with pWnd * * Author: Ashutosh R. Bhatikar (ARB) * * Date written: 25nd December 2000 * * Mid******************************************************************************************* ********* ******************************************************* / BOOL GSHOWMENUBACK (/ * in * / hmenu HMENU, / * In * / cwnd * pwnd) {// put the menu back in place if it was removed before if (hmenu! = null) {// invalidate before setmenu Since We are going to replace // the frame's client area anyway pwnd-> Invalidate (); :: setmenu (pwnd-> getsafehwnd (), hmenu; return true;} return false;

转载请注明原文地址:https://www.9cbs.com/read-44818.html

New Post(0)