临时做了个例子还是不行<br>var<br>h:thandle;<br>p
char;<br>j,i:integer;<br>ListPos: TPoint;<br>MousePos: TSmallPoint;<br>begin<br>p:=allocmem(255);<br>h:=getmenu(form1.Handle);<br>i:=getmenuitemcount(h);<br> for j:=0 to i-1 do<br> begin<br> GetMenuString(h,j,p,255,MF_BYPOSITION);<br> form1.edit3.text:=p;<br> if form1.edit3.text='ff&c' then<br> begin<br> postmessage(h,WM_command,vk_menu+key_c,MainMenu1.Items[0].Handle);//是这样吗?没有反应呀<br> end;<br> end;<br>{setcursorpos(212,200);//模拟鼠标事件可以实现点击效果<br> mouse_event (MOUSEEVENTF_LEFTDOWN, 0,0,0,0);<br> mouse_event (MOUSEEVENTF_LEFTUP, 0,0,0,0);<br>setcursorpos(212,222);<br> mouse_event (MOUSEEVENTF_LEFTDOWN, 0,0,0,0);<br> mouse_event (MOUSEEVENTF_LEFTUP, 0,0,0,0);<br>}<br>//以下代码均无反应<br>//postmessage(h,WM_LBUTTONdown,0,0);<br>//postmessage(h,WM_LBUTTONup,0,0);<br>{postmessage(h,WM_KEYDOWN,0,Key_C);<br>postmessage(h,WM_KEYDOWN,0,VK_MENU);<br>postmessage(h,WM_KEYup,0,VK_MENU);<br>postmessage(h,WM_KEYup,0,Key_C);}<br>freemem(p);