如何调出本地连接属性的窗口??? ( 积分: 20 )

  • 主题发起人 主题发起人 rockmmm
  • 开始时间 开始时间
R

rockmmm

Unregistered / Unconfirmed
GUEST, unregistred user!
如题,注:我的机子系统是2000。
 
无人知晓?
 
调用“1394 连接”、“无线网络连接”、“拨号连接”的属性,把程序里的 '本地连接' 改个名就行了。
uses ComObj, ShlObj;

function GetDisplayName(ShellFolder: IShellFolder; PIDL: PItemIDList;
ForParsing: Boolean): string;
var
StrRet: _STRRET;
p: PChar;
nFlags: Integer;
begin
Result := '';
if ForParsing then
nFlags := SHGDN_FORPARSING
else
nFlags := SHGDN_NORMAL;

ShellFolder.GetDisplayNameOf(PIDL, nFlags, StrRet);
case StrRet.uType of
STRRET_CSTR:
SetString(Result, StrRet.cStr, lStrLen(StrRet.cStr));
STRRET_OFFSET:
begin
P := @PIDL.mkid.abID[StrRet.uOffset - SizeOf(PIDL.mkid.cb)];
SetString(Result, P, PIDL.mkid.cb - StrRet.uOffset);
end;
STRRET_WSTR:
Result := StrRet.pOleStr;
end;
end;

//hOwner:主窗口句柄;
procedure ShowLocalAreaConnection(hOwner: HWND);
const
Flags = SHCONTF_FOLDERS or SHCONTF_NONFOLDERS or SHCONTF_INCLUDEHIDDEN;
var
psf: IShellFolder;
pidl: PItemIDList;
pedl: IEnumIDList;
dwNum: LongWord;
pcm: IContextMenu;
ici: _CMINVOKECOMMANDINFO;
begin
SHGetDesktopFolder(psf);
SHGetSpecialFolderLocation(hOwner, CSIDL_CONTROLS, pidl);
psf.BindToObject(pidl, nil, IID_IShellFolder, Pointer(psf));
psf.EnumObjects(hOwner, Flags, pedl);
while pedl.Next(1, pidl, dwNum) = S_OK do
begin
if GetDisplayName(psf, pidl, False) = '网络连接' then
begin
psf.BindToObject(pidl, nil, IID_IShellFolder, Pointer(psf));
psf.EnumObjects(hOwner, Flags, pedl);
while pedl.Next(1, pidl, dwNum) = S_OK do
begin
if GetDisplayName(psf, pidl, False) = '本地连接' then
begin
psf.GetUIObjectOf(hOwner, 1, pidl, IID_IContextMenu, nil, pcm);
FillChar(ici, SizeOf(_CMINVOKECOMMANDINFO), #0);
with ici do
begin
cbSize := SizeOf(_CMINVOKECOMMANDINFO);
hwnd := hOwner;
lpVerb := MakeIntResource(8);
nShow := SW_SHOWNORMAL;
end;
pcm.InvokeCommand(ici);
Break;
end;
end;
Break;
end;
end;
end;
 
接受答案了.
 
后退
顶部