由于打开的文件太多,有时想要按照自己的喜欢的方式排列下任务栏按钮 .所以在网上找了很多工具,其中Taskix最合我的心意
所以跟踪了一下Taskix
03DC1F63 |> /8B5424 20 /mov edx, dword ptr [esp+20] ; <-
03DC1F67 |. |53 |push ebx ; A A
03DC1F68 |. |8D4402 FF |lea eax, dword ptr [edx+eax-1]
03DC1F6C |. |50 |push eax ; D D
03DC1F6D |. |68 52040000 |push 452 ; TB_MOVEBUTTON
03DC1F72 |. |56 |push esi
03DC1F73 |. |FFD7 |call edi
03DC1F75 |. |85C0 |test eax, eax
03DC1F77 |. |0F84 84000000 |je 03DC2001
03DC1F7D |. |8B4424 18 |mov eax, dword ptr [esp+18]
03DC1F81 |. |4D |dec ebp
03DC1F82 |. |3BE8 |cmp ebp, eax
03DC1F84 |.^\7D DD \jge short 03DC1F63
左移一位
SendMessage(hWnd,TB_MOVEBUTTON,id,id - 3);
SendMessage(hWnd,TB_MOVEBUTTON,id,id - 3);
03DC1E87 |> /8B5424 20 /mov edx, dword ptr [esp+20] ; ->
03DC1E8B |. |8BCB |mov ecx, ebx
03DC1E8D |. |2BCA |sub ecx, edx
03DC1E8F |. |2BC8 |sub ecx, eax
03DC1E91 |. |8D5429 01 |lea edx, dword ptr [ecx+ebp+1]
03DC1E95 |. |52 |push edx ; 移动到位置 D C
03DC1E96 |. |53 |push ebx ; 当前位置 B A
03DC1E97 |. |68 52040000 |push 452 ; TB_MOVEBUTTON
03DC1E9C |. |56 |push esi
03DC1E9D |. |FFD7 |call edi
03DC1E9F |. |85C0 |test eax, eax
03DC1EA1 |. |0F84 5A010000 |je 03DC2001
03DC1EA7 |. |8B4424 18 |mov eax, dword ptr [esp+18]
03DC1EAB |. |4B |dec ebx
03DC1EAC |. |3BD8 |cmp ebx, eax
03DC1EAE |.^\7D D7 \jge short 03DC1E87
右移 N位
SendMessage(hWnd,TB_MOVEBUTTON,id,id + (向右移动的位数 * 2));
id--;
SendMessage(hWnd,TB_MOVEBUTTON,id,id + (向右移动的位数 * 2));
然后自己写了一个
GetListCtrl().DeleteAllItems();
for (int i = 0; i < m_Image16List.GetImageCount(); ++i)
m_Image16List.Remove(i);
DWORD dwProcessId;
GetWindowThreadProcessId(m_hTaskWnd,&dwProcessId);
int nCount = (int)::SendMessage(m_hTaskWnd,TB_BUTTONCOUNT,0,0);
CProcessData<TBBUTTON> data(dwProcessId);
TBBUTTON tb = {0};
TBBUTTONDATA tbbData = {0};
cText text;
for (int i = 0; i < nCount; ++i)
{
::SendMessage(m_hTaskWnd,TB_GETBUTTON,i,(LPARAM)data.GetData());
data.ReadData(&tb);
data.ReadData<TBBUTTONDATA>(&tbbData,(LPCVOID)tb.dwData);
if(tb.fsStyle & BTNS_DROPDOWN)
continue;
TCHAR TipChar;
TCHAR sTip[1024] = {0};
TCHAR* pTip = (TCHAR*)tb.iString;
DWORD dwProcessId = 0;
GetWindowThreadProcessId(tbbData.hwnd,&dwProcessId);
text.strProcessPath = ((CMainFrame*)AfxGetApp()->m_pMainWnd)->GetFileNameFromPid(dwProcessId).GetBuffer();
int x = 0;
do
{
if(x == 1024)
break;
data.ReadData<TCHAR>(&TipChar,(LPCVOID)pTip++);
} while (sTip[x++] = TipChar);
text.id = i;
text.hWnd = tbbData.hwnd;
text.uCallBackMessage = tbbData.uCallbackMessage;
text.str = sTip;
m_cVec.push_back(text);
int iconindex = 0;
ICONINFO iinfo;
HICON hIcon = ExtractIcon(NULL,text.strProcessPath.c_str(),0);
if(GetIconInfo(hIcon,&iinfo) != 0)
iconindex = m_Image16List.Add(hIcon);
LVITEM lv = {0};
lv.iItem = GetListCtrl().GetItemCount();
lv.iSubItem = 0;
lv.mask = LVIF_IMAGE;
lv.iImage = iconindex;
int index = GetListCtrl().InsertItem(&lv);
GetListCtrl().SetItemText(index,1,sTip);
GetListCtrl().SetItemText(index,2,text.strProcessPath.c_str());
}
if( (nCount>0) && (defindex>=0) && (defindex<nCount) )
GetListCtrl().SetItemState(defindex,
LVIS_FOCUSED|LVIS_SELECTED,
LVIS_FOCUSED|LVIS_SELECTED);
当文件过多,为个性化任务栏按钮顺序,作者分享了如何使用Taskix进行排列,并介绍了自己编写的相关工具,提供下载链接。
2398

被折叠的 条评论
为什么被折叠?



