一个比较难的问题,关于给POP MENU增加菜单(100分)

  • 主题发起人 白河愁
  • 开始时间

白河愁

Unregistered / Unconfirmed
GUEST, unregistred user!
如何给 右击桌面 弹出的POPMENU 增加一个选项?
 
请看清楚问题。
 
uses registry;<br>var<br>&nbsp; reg: Tregistry;<br>&nbsp; s,f:string;<br><br>begin<br>&nbsp; reg := TRegistry.create;<br>&nbsp; try<br>&nbsp; &nbsp; s:='/.GB/Shell/我的程序/command';//可以改成你想要的文件扩展名<br>&nbsp; &nbsp; f:='d:/abc/abc.exe "%1"'; &nbsp; &nbsp;//注意空格<br>&nbsp; &nbsp; reg.rootkey := HKEY_CLASSES_ROOT;<br>&nbsp; &nbsp; if not reg.KeyExists(s) then<br>&nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; reg.CreateKey(s);<br>&nbsp; &nbsp; &nbsp; reg.OpenKey(s,true);<br>&nbsp; &nbsp; &nbsp; reg.WriteString('',f);<br>&nbsp; &nbsp; end;<br><br>&nbsp; finally<br>&nbsp; &nbsp; reg.CloseKey;<br>&nbsp; &nbsp; reg.Destroy;<br>&nbsp; end;
 
楼上的你自己试过了吗
 
WinApi<br><br>
 
/*首先程序级别要达到1级或0级*/<br>#define IDM_ABOUT 1<br><br>LRESULT CALLBACK WndProc1(HWND, UINT, WPARAM, LPARAM);<br>LRESULT (CALLBACK* oldProc)(HWND, UINT, WPARAM, LPARAM);<br><br>void __fastcall TForm1::Button1Click(TObject *Sender)<br>{<br>&nbsp;HWND dt;<br>&nbsp;dt = GetDesktopWindow();<br>&nbsp;oldProc = (WNDPROC)SetWindowLong(dt, GWL_WNDPROC, (LONG)WndProc1);<br>}<br><br>LRESULT CALLBACK WndProc1(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)<br>{<br>&nbsp; static HMENU hMenu;<br>&nbsp; switch (msg)<br>&nbsp; {<br>&nbsp; &nbsp; case WM_INITMENUPOPUP:<br>&nbsp; &nbsp; hMenu = (HMENU)wParam;<br>&nbsp; &nbsp; AppendMenu(hMenu, MF_STRING, IDM_ABOUT, "About...")<br>&nbsp; &nbsp; break;<br>&nbsp; }<br>&nbsp; return CallWindowProc((FARPROC)oldProc, hWnd, msg, wParam, lParam);<br>}<br>
 
上面的办法是右击桌面文件时出现的POP,直接右击桌面,不知道????关注!
 
程序级别是指?RING?
 
就是RING
 
98下不是只有ring0和ring3?而NT并不存在RING的概念,那1.......?
 
1是笔误
 
增加了似乎也无法运行,不过根据AppendMenu查得了不少结果,<br>o*o写了一个hook程序实现了这个功能,而且似乎也用不到ring,不知道这有办法吗?
 
hook?很多人都把hook挂在嘴边,其实我上面写的就是窗口子类化,<br>为何不看看一些关于windows开发的基础读本?
 
按道理说,弹出一个POPUP MENU不是产生一个事件吗?把这个截获应该可以的吧。<br>case WM_INITMENUPOPUP:<br>这个不就是判断消息吗?
 
可我重载了原来的窗口过程啊!
 
有没有PASCAL版本,写了N遍都是不对的.......
 
不可能有Pascal版本,那有人用Pascal写SDK啊!
 
yyii_yyii的代码完全可以翻译成Pascal。<br>只是楼主的意思是没有驻留程序,只怕要写一个服务才行
 
LRESULT (CALLBACK* oldProc)(HWND, UINT, WPARAM, LPARAM);<br><br>这个应该怎么转换?<br>驻留也不难吧,98下弄到RING0还是很容易的。
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
D
回复
0
查看
2K
DelphiTeacher的专栏
D
D
回复
0
查看
1K
DelphiTeacher的专栏
D
顶部