Skip to content

Instantly share code, notes, and snippets.

@shuax
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shuax/9073c284aae422402bd4 to your computer and use it in GitHub Desktop.
Save shuax/9073c284aae422402bd4 to your computer and use it in GitHub Desktop.
windows 10
#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