본문 바로가기
C & C++/C & C++

시작버튼, 시계, 작업표시줄, 작업관리자 숨기기!!

by izen8 2012. 8. 21.
반응형

#define TASKBAR "Shell_TrayWnd" // Taskbar class name


#define ID_STARTBUTTON 0x130 // Start button ID


#define ID_TRAY 0x12F // System tray ID


#define ID_CLOCK 0x12F




/***************************
* Hide/Show Start Button. *
* TRUE=Show, FALSE=Hide *
* (Win9x/NT/2K/XP) *
***************************/

int DLL_EXP_IMP WINAPI StartButton_Show_Hide(BOOL bShowHide

)
{

HWND hWnd

;

hWnd = GetDlgItem(FindWindow(TASKBAR, NULL), ID_STARTBUTTON)

;

if (hWnd == NULL

)

return 0

;

ShowWindow(hWnd, bShowHide ? SW_SHOW : SW_HIDE)

;

UpdateWindow(hWnd)

;

return 1

;
}


/*************************
* Hide/Show Taskbar. *
* TRUE=Show, FALSE=Hide *
* (Win9x/NT/2K/XP) *
*************************/

int DLL_EXP_IMP WINAPI Taskbar_Show_Hide(BOOL bShowHide

)
{
HWND hWnd

;



hWnd

=

FindWindow

(

TASKBAR,

NULL)

;

if

 

(

hWnd

==

 

NULL

)

return

 

0

;

ShowWindow

(

hWnd, bShowHide

?

SW_SHOW

:

SW_HIDE

)

;
UpdateWindow

(

hWnd

)

;

return

 

1

;
}


/***************************
* Hide/Show System Clock. *
* TRUE=Show, FALSE=Hide *
* (Win9x/NT/2K/XP) *
***************************/

int

DLL_EXP_IMP WINAPI Clock_Show_Hide

(

BOOL bShowHide

)


{
HWND hWnd

;



hWnd

=

GetDlgItem

(

FindWindow

(

TASKBAR,

NULL)

, ID_TRAY

)

;
hWnd

=

GetDlgItem

(

hWnd, ID_CLOCK

)

;

if

 

(

hWnd

==

 

NULL

)

return

 

0

;

ShowWindow

(

hWnd, bShowHide

?

SW_SHOW

:

SW_HIDE

)

;
UpdateWindow

(

hWnd

)

;

return

 

1

;
}


/************************************************************
* Enable/Disable special keys. *
* (Ctrl+Alt+Del, Alt+Tab, Alt+Esc, Ctrl+Esc, Win key, ...) *
* TRUE=Enable, FALSE=Disable *
* (Win 9x) *
************************************************************/

int

DLL_EXP_IMP WINAPI Keys_Enable_Disable

(

BOOL bEnableDisable

)


{
BOOL bOldState

;



return

SystemParametersInfo

(

SPI_SETSCREENSAVERRUNNING, bEnableDisable

?

FALSE

:

TRUE,

&

bOldState, 0

)

;
}


/************************************
* Enable/Disable Alt+Tab, Alt+Esc. *
* TRUE=Enable, FALSE=Disable *
* ( Win ?) *
************************************/

int

DLL_EXP_IMP WINAPI AltTab1_Enable_Disable

(

BOOL bEnableDisable

)


{
BOOL bOldState

;



return

SystemParametersInfo

(

SPI_SETFASTTASKSWITCH, bEnableDisable

?

FALSE

:

TRUE,

&

bOldState, 0

)

;
}


/************************************
* Enable/Disable Alt+Tab, Alt+Esc. *
* TRUE=Enable, FALSE=Disable *
* (Win 2K) *
************************************/

int

DLL_EXP_IMP WINAPI AltTab2_Enable_Disable

(

HWND hWnd, BOOL bEnableDisable

)


{
#define m_nHotKeyID 100

if

 

(!

bEnableDisable

)


{

if

 

(!

RegisterHotKey

(

hWnd, m_nHotKeyID

+0

, MOD_ALT, VK_TAB

)

)

// Alt+Tab

 

return

 

0

;

if

 

(!

RegisterHotKey

(

hWnd, m_nHotKeyID

+1

, MOD_ALT, VK_ESCAPE

)

)

// Alt+Esc

 

return

 

0

;
}
else
{

if

 

(!

UnregisterHotKey

(

hWnd, m_nHotKeyID

+

0

)

)

return

 

0

;

if

 

(!

UnregisterHotKey

(

hWnd, m_nHotKeyID

+

1

)

)

return

 

0

;
}

return

 

1

;

}

매우 매우 간단하죠?

FindWindow로 TASKBAR의 클래스 이름을 얻어옵니다.
ShowWindows로 표시를 해줄지 말지 결정합니다.
UpdateWindows로 윈도우를 업데이트 해줍니다.

결과가 나옵니다.

so, so simple !!

출처 - CodeProject.com

P.S 1. CodeProject 에 가시면, 더욱 더 많은 기능이 있습니다 ~_~..

제가 허접이라서 Ctrl+Alt+Del 은 왜 그렇게 했는가 잘 이해가 안가네요. ( 라는 것도 있지만서도 귀찮아서.. 소스도 길고.. )

P.S 2. 주석까지도 그대로 베껴왔습니다. ㅇ_ㅇ...;

 

반응형

댓글