Skip to content

Instantly share code, notes, and snippets.

@kuttsun
Last active May 30, 2016 01:44
Show Gist options
  • Save kuttsun/be082fae9700f47e37e681b9f795649a to your computer and use it in GitHub Desktop.
Save kuttsun/be082fae9700f47e37e681b9f795649a to your computer and use it in GitHub Desktop.
// タスクバーとスタートボタンの表示と非表示を切り替えるプログラム
#include "stdafx.h"
#include <windows.h>
#include <tchar.h>
int main()
{
// ClassName and WindowName
LPCTSTR name[][2] = {
{ _T("Shell_TrayWnd"), NULL },// Taskbar
{ _T("Button"), NULL },// Start Button
//{ _T("DV2ControlHost"), NULL}// Start Menu
};
BOOL currentState = FALSE;
for (int i = 0; i < sizeof(name) / sizeof(name[0]); i++) {
HWND hWnd = FindWindow(name[i][0], name[i][1]);
if (i == 0) {
currentState = IsWindowVisible(hWnd);// Taskbar State
}
ShowWindow(hWnd, (currentState == FALSE ? SW_SHOW : SW_HIDE) );
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment