Lresult callback getmsgproc (INT ncode, wparam, lparam)
{
If (hc_action = ncode)
{
Char _ module [2, 256];
Getmodulefilename (null, _ module, sizeof (_ module); // obtain the module path
If (strstr (_ module, "\ notepad.exe") // check whether notepad.exe exists.
{
Lpmsg = (lpmsg) lparam; // get the message
Hmenu hmainmenu = getmenu (lpmsg-> hwnd); // obtain the menu handle of the current window
If (hmainmenu! = NULL) // If a menu exists
{
Int icount = getmenuitemcount (hmainmenu); // gets the number of items in the menu.
For (INT I = 0; I <icount; I ++)
{
Tchar sztext [255] = "";
Getmenustring (hmainmenu, I, sztext, sizeof (sztext), mf_byposition); // get the name of the menu item
If (! Strcmp (sztext, "Integrity mail") // check whether it is credit mail.
{
Break;
}
}
If (I> = icount) // load the menu if there is no credit mail menu
{
Hmenu = loadmenu (getmodulehandle ("hookhook"), makeintresource (idr_hook_menu); // load the menu
Hmenu hpopupmenu = getsubmenu (hmenu, 0); // as long as the first menu
Appendmenu (hmainmenu, mf_popup, (uint) hpopupmenu, "Integrity mail"); // Add a menu to the main menu
// Drawmenubar (lpmsg-> hwnd );
}
}
}
}
Return callnexthookex (hhook, ncode, wparam, lparam );
}
void sethook ()
{< br> hhook = setwindowshookex (wh_getmessage, getmsgproc, getmodulehandle ("hookhook "), 0);
}