forked from redxu/sihook
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sisw.c
40 lines (34 loc) · 805 Bytes
/
sisw.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <string.h>
#include "tabctl.h"
#include "const.h"
#include "utils.h"
#include "sisw.h"
static WNDPROC old_si_sw_proc = NULL;
static LRESULT CALLBACK SiSwSubClass(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
LRESULT lr = CallWindowProc(old_si_sw_proc, hWnd, uMsg, wParam, lParam);
switch(uMsg)
{
case WM_SETTEXT:
{
char text[SI_BUF_SIZE];
GetSiSwTitle((LPCSTR)lParam,text);
SiTabCtl_SetItemText(hWnd,text);
}
break;
default:
break;
}
return lr;
}
//获取si_Sw窗口过程
void HookSiSw(HWND hwnd)
{
old_si_sw_proc = (WNDPROC)GetWindowLong(hwnd,GWL_WNDPROC);
SetWindowLong(hwnd,GWL_WNDPROC,(DWORD)SiSwSubClass);
}
//恢复si_Sw窗口过程
void UnhookSiSw(HWND hwnd)
{
SetWindowLong(hwnd,GWL_WNDPROC,(DWORD)old_si_sw_proc);
}