Last active
August 29, 2015 14:07
-
-
Save shuax/9073c284aae422402bd4 to your computer and use it in GitHub Desktop.
windows 10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <windows.h> | |
#include <stdio.h> | |
int width = 0; | |
HWND TaskListHwnd = NULL; | |
BOOL CALLBACK SearchTrayButton(HWND hwnd, LPARAM lParam) | |
{ | |
TCHAR buff[256]; | |
if(GetClassName(hwnd, buff, 255)) | |
{ | |
if(strcmp(buff, "TrayButton")==0) | |
{ | |
RECT rect; | |
GetClientRect(hwnd, &rect); | |
width += rect.right; | |
printf("%d %d\n", rect.right, rect.bottom); | |
SetWindowPos(hwnd, NULL, 0, 0, 0, 0, SWP_NOMOVE|SWP_HIDEWINDOW); | |
} | |
if(strcmp(buff, "ReBarWindow32")==0) | |
{ | |
TaskListHwnd = hwnd; | |
} | |
} | |
return true; | |
} | |
BOOL CALLBACK SearchShell_TrayWnd(HWND hwnd, LPARAM lParam) | |
{ | |
TCHAR buff[256]; | |
if(GetClassName(hwnd, buff, 255)) | |
{ | |
if(strcmp(buff, "Shell_TrayWnd")==0) | |
{ | |
width = 0; | |
TaskListHwnd = NULL; | |
EnumChildWindows(hwnd, SearchTrayButton, NULL); | |
puts("SearchTrayButton"); | |
if(TaskListHwnd) | |
{ | |
RECT rect; | |
GetWindowRect(TaskListHwnd, &rect); | |
printf("%d %d\n", rect.left, width); | |
rect.left -= width; | |
printf("%d %d\n", rect.left, width); | |
SetWindowPos(TaskListHwnd, NULL, rect.left, 0, rect.right - rect.left, rect.bottom - rect.top, SWP_NOZORDER|SWP_NOACTIVATE); | |
} | |
return false; | |
} | |
} | |
return true; | |
} | |
int main() | |
{ | |
EnumWindows(SearchShell_TrayWnd, NULL); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment