1
2 void CreateMenuButtonOnDesktop()
3 {
4 HWND hwndMB = ::SHFindMenuBar(GetDesktopWindow());
5 ::GetWindowThreadProcessId(hwndMB,&m_pID);//pID就是进程ID
6 EnumWindows(EnumWindowsProc,NULL);
7 }
8
9 BOOL CALLBACK EnumWindowsProc(HWND hwnd,LPARAM lParam)
10 {
11
12 DWORD pID=0;
13 ::GetWindowThreadProcessId(hwnd,&pID);//pID就是进程ID
14
15 if ((DWORD)m_pID == pID)
16 {
17
18 TCHAR szClassName[128];
19 GetClassName(hwnd,szClassName,128);
20 if (wcscmp(szClassName,_T("MS_SOFTKEY_CE_1.0")) == 0)
21 {
22
23 child_hWnd = CreateWindow(szWindowClass, szTitle, WS_VISIBLE,
24 CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, hwnd, NULL, g_hInst, NULL);
25
26
27 if (!child_hWnd)
28 {
29 return FALSE;
30 }
31
32 int nWidth = 36;
33 int nHeight = 20;
34 RECT rc;
35 GetWindowRect(hwnd,&rc);
36 MoveWindow(child_hWnd, (rc.right- nWidth)/2, (rc.bottom - rc.top - nHeight)/2 , nWidth, nHeight, FALSE);
37
38 ShowWindow(child_hWnd, WM_SHOWWINDOW);
39 UpdateWindow(child_hWnd);
40 return FALSE;
41 }
42 }
43 return TRUE;
详解百度手机输入法“搜索框”的秘密
2024-12-28 21:35