|
@@ -170,47 +170,12 @@ void CWeChatsDlg::OnBnClickedOpenWx()
|
|
|
//vector<DWORD> vtPID = FindAllProcess(_T("AliIM.exe"));
|
|
|
if (vtPID.size() != 0)
|
|
|
{
|
|
|
- CWxObject wxobj(*vtPID.begin(), g_szDynamicLibraryPath);
|
|
|
- if (wxobj.FindWxMainWnd())
|
|
|
+ m_wxObj.setInjectionObj(*vtPID.begin(), g_szDynamicLibraryPath);
|
|
|
+ if (m_wxObj.FindWxMainWnd())
|
|
|
{
|
|
|
- wxobj.InjectDynamicLibrary();
|
|
|
- wxobj.Attach2MainWnd(GetDlgItem(WX_RECT), FALSE);
|
|
|
- Sleep(10000);
|
|
|
- wxobj.DetachWxWnd();
|
|
|
+ m_wxObj.InjectDynamicLibrary();
|
|
|
+ m_wxObj.Attach2MainWnd(GetDlgItem(WX_RECT), FALSE);
|
|
|
}
|
|
|
- //if (wxobj.FindWxMainWnd())
|
|
|
- //if (wxobj.FindWxLoginWnd())
|
|
|
- //{
|
|
|
- // //g_hWxWnd = wxobj.GetWxMainWnd();
|
|
|
- // g_hWxWnd = wxobj.GetWxLoginWnd();
|
|
|
- // if (g_hWxWnd != NULL)
|
|
|
- // {
|
|
|
- // // 获取微信窗口的样式;
|
|
|
- // DWORD dwStyle = ::GetWindowLong(g_hWxWnd, GWL_STYLE);
|
|
|
- // // WS_CLIPSIBLINGS告诉父窗口不要绘制子窗口出现的区域;
|
|
|
- // dwStyle |= WS_CLIPSIBLINGS;
|
|
|
- // // 重新设置窗口样式 ;
|
|
|
- // ::SetWindowLong(g_hWxWnd, GWL_STYLE, dwStyle);
|
|
|
-
|
|
|
- // CRect rect;
|
|
|
- // GetDlgItem(WX_RECT)->GetWindowRect(&rect);
|
|
|
- // // 设置背景透明;
|
|
|
- // ::SetParent(g_hWxWnd, GetDlgItem(WX_RECT)->m_hWnd);//set parent of ms paint to our dialog.
|
|
|
- // //::SetParent(hWxWnd, m_hWnd);
|
|
|
- // // 擦除背景;
|
|
|
- // //SetWindowLong(hWxWnd, GWL_STYLE, WS_VISIBLE);//eraze title of ms paint window.
|
|
|
- // //Positioning ms paint.
|
|
|
- // ScreenToClient(wxobj.m_rcWnd);
|
|
|
- // ::MoveWindow(g_hWxWnd, wxobj.m_rcWnd.left, wxobj.m_rcWnd.top, wxobj.m_rcWnd.right, wxobj.m_rcWnd.bottom, true);
|
|
|
- // //ClientToScreen(&rect);
|
|
|
- // //ScreenToClient(&rect);
|
|
|
- // //::SetWindowPos(hWxWnd, NULL, rect.left, rect.top, rect.right, rect.bottom, SWP_SHOWWINDOW | SWP_HIDEWINDOW);
|
|
|
- // //窗口重绘,(因创建exe时,设置为SW_HIDE,导致exe窗口会被父窗口覆盖一部分)
|
|
|
- // //Invalidate();
|
|
|
- // ::UpdateWindow(g_hWxWnd);
|
|
|
- // ::ShowWindow(g_hWxWnd, SW_SHOW);
|
|
|
- // }
|
|
|
- //}
|
|
|
}
|
|
|
#endif
|
|
|
}
|
|
@@ -226,3 +191,12 @@ HBRUSH CWeChatsDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
|
|
|
// TODO: 如果默认的不是所需画笔,则返回另一个画笔
|
|
|
return hbr;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+BOOL CWeChatsDlg::DestroyWindow()
|
|
|
+{
|
|
|
+ // TODO: 在此添加专用代码和/或调用基类
|
|
|
+ m_wxObj.DetachWxWnd();
|
|
|
+ m_wxObj.EjectDynamicLibrary();
|
|
|
+ return CDialog::DestroyWindow();
|
|
|
+}
|