给你个想记事本里加菜单的例子,希望对你有所帮助:<br><br>procedure Tfrm_Main.FormCreate(Sender: TObject);<br>var<br> v_HWND: HWND;<br> v_HMENU,v_SUBMENU: HMENU;<br>begin<br> v_HWND := FindWindow(PChar('Notepad'),nil);<br> if v_HWND&lt;&gt;0 then<br> begin<br> v_HMENU := GetMenu(v_HWND);<br> if v_HMENU&lt;&gt;0 then<br> begin<br> v_SUBMENU := GetSubMenu(v_HMENU,0);<br> InsertMenu(v_SUBMENU, 0, MF_BYPOSITION, WM_NEWITEM1,'项目1');<br> //如何给这个新加的菜单项加入点击响应事件?<br> end;<br> end<br> else<br> Application.MessageBox('记事本没有打开','提示',MB_OK+MB_ICONINFORMATION);<br>end; <br><br>