怎样用rundll32直接叫出本地连接属性页 ( 积分: 200 )

  • 主题发起人 主题发起人 sinab
  • 开始时间 开始时间
S

sinab

Unregistered / Unconfirmed
GUEST, unregistred user!
请问各位大侠 怎样用rundll32直接叫出本地连接属性页?
 
请问各位大侠 怎样用rundll32直接叫出本地连接属性页?
 
难道真的没人会吗
 
现给你写了一个。想调用“1394 连接”、“无线网络连接”、“拨号连接”的属性,把程序里的 '本地连接' 改个名就行了。这个过程还可以删除、停用......“本地连接”,把 MakeIntResource 里的参数改了就行。<br>uses ComObj, ShlObj;<br><br>function GetDisplayName(ShellFolder: IShellFolder; PIDL: PItemIDList;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ForParsing: Boolean): string;<br>var<br> &nbsp;StrRet: _STRRET;<br> &nbsp;p: PChar;<br> &nbsp;nFlags: Integer;<br>begin<br> &nbsp;Result := '';<br> &nbsp;if ForParsing then<br> &nbsp; &nbsp;nFlags := SHGDN_FORPARSING<br> &nbsp;else<br> &nbsp; &nbsp;nFlags := SHGDN_NORMAL;<br><br> &nbsp;ShellFolder.GetDisplayNameOf(PIDL, nFlags, StrRet);<br> &nbsp;case StrRet.uType of<br> &nbsp; &nbsp;STRRET_CSTR:<br> &nbsp; &nbsp; &nbsp;SetString(Result, StrRet.cStr, lStrLen(StrRet.cStr));<br> &nbsp; &nbsp;STRRET_OFFSET:<br> &nbsp; &nbsp; &nbsp;begin<br> &nbsp; &nbsp; &nbsp; &nbsp;P := @PIDL.mkid.abID[StrRet.uOffset - SizeOf(PIDL.mkid.cb)];<br> &nbsp; &nbsp; &nbsp; &nbsp;SetString(Result, P, PIDL.mkid.cb - StrRet.uOffset);<br> &nbsp; &nbsp; &nbsp;end;<br> &nbsp; &nbsp;STRRET_WSTR:<br> &nbsp; &nbsp; &nbsp;Result := StrRet.pOleStr;<br> &nbsp;end;<br>end;<br><br>//hOwner:主窗口句柄;<br>procedure ShowLocalAreaConnection(hOwner: HWND);<br>const<br> &nbsp;Flags = SHCONTF_FOLDERS or SHCONTF_NONFOLDERS or SHCONTF_INCLUDEHIDDEN;<br>var<br> &nbsp;psf: IShellFolder;<br> &nbsp;pidl: PItemIDList;<br> &nbsp;pedl: IEnumIDList;<br> &nbsp;dwNum: LongWord;<br> &nbsp;pcm: IContextMenu;<br> &nbsp;ici: _CMINVOKECOMMANDINFO;<br>begin<br> &nbsp;SHGetDesktopFolder(psf);<br> &nbsp;SHGetSpecialFolderLocation(hOwner, CSIDL_CONTROLS, pidl);<br> &nbsp;psf.BindToObject(pidl, nil, IID_IShellFolder, Pointer(psf));<br> &nbsp;psf.EnumObjects(hOwner, Flags, pedl);<br> &nbsp;while pedl.Next(1, pidl, dwNum) = S_OK do<br> &nbsp;begin<br> &nbsp; &nbsp;if GetDisplayName(psf, pidl, False) = '网络连接' then<br> &nbsp; &nbsp;begin<br> &nbsp; &nbsp; &nbsp;psf.BindToObject(pidl, nil, IID_IShellFolder, Pointer(psf));<br> &nbsp; &nbsp; &nbsp;psf.EnumObjects(hOwner, Flags, pedl);<br> &nbsp; &nbsp; &nbsp;while pedl.Next(1, pidl, dwNum) = S_OK do<br> &nbsp; &nbsp; &nbsp;begin<br> &nbsp; &nbsp; &nbsp; &nbsp;if GetDisplayName(psf, pidl, False) = '本地连接' then<br> &nbsp; &nbsp; &nbsp; &nbsp;begin<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;psf.GetUIObjectOf(hOwner, 1, pidl, IID_IContextMenu, nil, pcm);<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;FillChar(ici, SizeOf(_CMINVOKECOMMANDINFO), #0);<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;with ici do<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;begin<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;cbSize := SizeOf(_CMINVOKECOMMANDINFO);<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;hwnd := hOwner;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;lpVerb := MakeIntResource(8);<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;nShow := SW_SHOWNORMAL;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;end;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;pcm.InvokeCommand(ici);<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Break;<br> &nbsp; &nbsp; &nbsp; &nbsp;end;<br> &nbsp; &nbsp; &nbsp;end;<br> &nbsp; &nbsp; &nbsp;Break;<br> &nbsp; &nbsp;end;<br> &nbsp;end;<br>end;
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
I
回复
0
查看
511
import
I
后退
顶部