Closed advertising procedures in technology integration of hidden window, system tray, etc. (source code)

zhaozj2021-02-16  38

The advertisement is a deep and evil, and it is not like this. The Internet also can't escape its shadow. So the software of various KILL advertising is endless, but their principles are basically the same, that is, the software judges that the pop-up is whether the window is advertising, it is, if you kill, don't skip. It is also quite simple, the core part, and a few lines can be done. Of course, this does not include the implementation of the hidden window and tray technology. (Vc ) first talk about the core, and advertise. (For IE Browser) Because the Windows management window is hierarchical, like a directory tree. Advertising is often a sub-window derived by IE browser. So we find all windows with a loop method, get the window handle, and then further obtain the sub-window of the IE, and then determine whether it is an advertisement. As for how to determine, we also use the easiest way to see the window style (such as: whether there is a toolbar). Here is the code implementation: void cmyWnd :: Ontimer (uint nidevent) {First window handle in Windows: CWND * PMainWnd = AFXGETMAINWND () -> getWindow (gw_hwndfirst); enter the loop while (PMainWnd) {This name is used for Determine whether it is the IE browser CString IName; get the name of the window and puts getClassName in IName (PMainWnd-> m_hwnd, IENAME.GETBUFFERSETLENGTH (100), IE name is IEframe, so determined whether the name is equal to it IF (IENAME == "IEframe") {Yes, obtain sub-window handle CWnd * pchildWnd = CWnd :: fromHandle (pmainwindowex (pmainwind-> m_hwnd, null, "workerw", null); if (pchildwnd) {If the child window Presence, get its style, if the condition is satisfied, send it a message to turn off it. if {pMainWnd-> PostMessage (WM_CLOSE, 0,0);} ((GetWindowLong (pChildWnd-> m_hWnd, GWL_STYLE) & WS_VISIBLE)!)}} continue to the next window handle pMainWnd = pMainWnd-> GetWindow (GW_HWNDNEXT);} CWnd :: ONTIMER (Nidevent);} The core is these, which can achieve the purpose of targeting the above code. But as a targeting advertising program, we don't want the program too obvious, that is, the more hidden in the program, so we think of a hidden window and use the system tray management. The implementation method is also related to the homemade window class, and is derived from CWnd, defined as follows: Class CMYWND: PUBLIC CWND {public: Tray icon Hicon M_Hicon; Tray menu HMENU MENU1; Public: Void Create (LPCTSTSTSTSTSTSTSTSTER PTITLE, RECT, UNSIGNED Short Maskid, Unsigned Short Bitmapid, Hicon Hicon, HMenu Hmenu;

A member function crete, the parameters are quite clear, don't explain it, achieve as follows:

void cmywnd :: create (LPCTSTR pTitle, RECT & rect, unsigned short MaskID, unsigned short BitmapID, HICON hicon, HMENU hmenu) {calls API to create a hidden window CreateEx (0, AfxRegisterWndClass (0), pTitle, WS_OVERLAPPEDWINDOW | WS_SYSMENU, rect, NULL, NULL, NULL; Icon and Menu Set Menu1 = HCENU; M_HICON = Hicon; Seticon (Hicon, True); SetWindowPos (& Wndtopmost, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE); Settings Trays Notifyicondata NID ; nid.cbSize = sizeof (NOTIFYICONDATA); nid.hWnd = this-> m_hWnd; nid.uID = 1; nid.uFlags = NIF_TIP | NIF_ICON | NIF_MESSAGE; nid.uCallbackMessage = WM_SYSCOMMAND; nid.hIcon = hicon; strcpy (nid .sztip, "Go to Advertising, Zhao Ming Individual Software!"); Shell_Notifyicon (Nim_ADD, & NID);} The above is the implementation of the hidden window and the system tray, and is used in the program, it is quite simple, and the CREATE function can be called. As follows: CMYWND * PFRAME = New CMYWND; where the parameters are depends on your program, Pframe-> Create ("Eyes", Rect, Idi_icon1, IDi_icon1, Hicon, HMENU;

The entire "Guan Advertising" program is over, the next job, you only need to use them together. As for how you used it, look at you, I have a source, if you are interested, send me. Website: http://h2osky.126.com

Zhao Ming Email: papaya_zm@sina.com; zmpapaya@hotmail.comweb: http://h2osky.126.com

转载请注明原文地址:https://www.9cbs.com/read-26209.html

New Post(0)