能力值:
( LV9,RANK:380 )
|
-
-
2 楼
system权限下运行,通过热键的时候,切换到用户权限。。。。
|
能力值:
( LV9,RANK:610 )
|
-
-
3 楼
我的这个不太完美 在隐藏后右下角会有一个空白 我不知道是为什么 希望你能完善下
然后告诉我
ps。这样的问题 最好发到求助问答区。。。
#include <atlbase.h>
#include <atlconv.h>
#include <CommCtrl.h>
void HideWindow(HWND h, BOOL bHide)
{
ShowWindow(h, bHide? SW_HIDE:SW_SHOW);
}
void HideTrayIcon(char szIcon[],BOOL show)
{
HWND hWnd,hWndPaper;
unsigned long lngPID;
long lngButtons;
HANDLE hProcess;
LPVOID lngAddress;
long lngHwndAdr,lngHwnd;
char strBuff[1024]={0};
TBBUTTON tbButton;
hWnd = FindWindow("Shell_TrayWnd", NULL);
hWnd = FindWindowEx(hWnd, 0, "TrayNotifyWnd", NULL);
hWndPaper = FindWindowEx(hWnd, 0, "SysPager", NULL);
if(!hWndPaper)
hWnd = FindWindowEx(hWnd, 0, "ToolbarWindow32", NULL);
else
hWnd = FindWindowEx(hWndPaper, 0, "ToolbarWindow32", NULL);
GetWindowThreadProcessId(hWnd, &lngPID);
hProcess = OpenProcess(PROCESS_ALL_ACCESS|PROCESS_VM_OPERATION|PROCESS_VM_READ|PROCESS_VM_WRITE, 0, lngPID);
lngAddress = VirtualAllocEx(hProcess, 0, 0x4096, MEM_COMMIT, PAGE_READWRITE);
lngButtons = SendMessage(hWnd, TB_BUTTONCOUNT, 0, 0);
for(int i=0 ;i<lngButtons;i++)
{
SendMessage(hWnd,TB_GETBUTTON, i, long(lngAddress));
ReadProcessMemory(hProcess, LPVOID(long(lngAddress)), &tbButton, sizeof(tbButton),0);
ReadProcessMemory(hProcess, LPVOID(tbButton.iString),strBuff,1024,0);
ReadProcessMemory(hProcess, LPVOID(tbButton.dwData),&lngHwndAdr,4,0);
ReadProcessMemory(hProcess, LPVOID(lngHwndAdr),&lngHwnd, 4,0);
USES_CONVERSION;
char *str = OLE2T((LPOLESTR)(strBuff));
if(strstr(str,szIcon))
{
SendMessage(hWnd,TB_HIDEBUTTON, tbButton.idCommand, MAKELONG (show, 0));
break;
}
}
VirtualFreeEx( hProcess, lngAddress, 0X4096, MEM_RELEASE);
CloseHandle(hProcess);
}
int main(int argc, char* argv[])
{
//隐藏TM(我电脑上是tm,如果你电脑上是qq那就类似的设置一下)
HideWindow(FindWindow(0, "TM2009"), TRUE);
HideTrayIcon("TM", TRUE);
for (int i=0; i<5; i++)
{
printf("%d秒之后恢复。。。\r\n", 5-i);
Sleep(1000);
}
//恢复
HideWindow(FindWindow(0, "TM2009"), FALSE);
HideTrayIcon("TM", FALSE);
return 0;
}
|
能力值:
( LV9,RANK:610 )
|
-
-
4 楼
在 SendMessage(hWnd,TB_HIDEBUTTON, tbButton.idCommand, MAKELONG (show, 0));
后面加一句
SendMessage(HWND_BROADCAST, WM_SETTINGCHANGE, 0, 0);
|
能力值:
( LV2,RANK:10 )
|
-
-
5 楼
真是太牛了!
|
能力值:
( LV13,RANK:260 )
|
-
-
6 楼
不错 学习了。。
|