uses ShellApi;
ShellExecute(GetDesktopWindow, 'open', 'rundll32.exe',
PChar('shell32.dll,
OpenAs_RunDLL' + ' c:\xxx.txt'),
nil, SW_SHOWNORMAL);
是这个吗?
ShellExecute(GetDesktopWindow, 'open', 'rundll32.exe',
PChar('shell32.dll,
OpenAs_RunDLL' + ' c:\xxx.txt'),
nil, SW_SHOWNORMAL);
是这个吗?
解决方案 »
- 怎么提取QQ2008的截图功能!!
- 怎样读取命令行参数??????
- 為什麼我在console application中建立的TcpSever與TcpClient連接後馬上斷掉?
- 何时触发PageControl.PageControl1DrawTab事件?
- 如何取一个字节的前四位和后四位??急
- 当在Edit1.tex输入数字时,输一个然后间隔一个空格,再输下一个数字再间隔一个空格
- 怎么实现UDP数据包的拆包组包发送与接收?在线等待,期待高手(Up、gz均有分)......
- delphi7 两个fsNormal 窗体 点击按钮 form1 关闭 form2打开 怎么写代码啊?
- Paradox数据库的紧缩问题
- 焦点自动跳到下一个控件的函数是Perform 高分伺候
- 为了推广我的网站,需要在搜寻引挚中注册。听说登录骑兵可以解决,请问哪有下载。
- 急急急!!!
ShellExecute(GetDesktopWindow, 'open', 'rundll32.exe',
PChar('shell32.dll OpenAs_RunDLL' + ' c:\xxx.txt'),nil, SW_SHOWNORMAL);
'Open'打开命令,
rundll32.exe, 所调可执行文件,
Pchar(),参数, 其中,'c:\xxx.txt'为打开的文件名,
够清楚了吗?
你的主要目的是干什么呀?
我只知道在VB中的用法.调用这两个API就可以了.
Public Declare Function SHBrowseForFolder Lib "shell32" (lpbi As BrowseInfo) As Long
Public Declare Function SHGetPathFromIDList Lib "shell32" (ByVal pidList As Long, ByVal lpBuffer As String) As Long
Delphi中要怎么做呀?
放一个TOpenDialog组件,
然后if OpenDialog1.execute then
begin
end;
对不起,我不懂VB.
if OpenDialog1.execute then
begin
//选择事件;
end;就可以了
begin
if uMsg = BFFM_INITIALIZED then
Result := SendMessage (hwnd,BFFM_SETSELECTION,ord(True),Longint(PChar(path)))
else
Result := 1;
end;function SelDir( const Caption:string; const Root:WideString; out Directory:string):Boolean;
var
WindowList:Pointer;
BrowsInfo:TBrowseInfo;
Buffer:PChar;
RootItemIDList,ItemIDList:PItemIDList;
ShellMalloc:IMalloc;
IDesktopFolder:IShellFolder;
Eaten,Flags:LongWord;
begin
Result:= False;
Directory:='';
FillChar (BrowsInfo,sizeof(BrowsInfo),0);
if (ShGetMalloc(ShellMalloc)=S_OK) and (ShellMalloc <> nil) then
begin
Buffer := ShellMalloc.Alloc(MAX_PATH);
try
RootItemIDList := nil;
if Root <> '' then begin
SHGetDesktopFolder(IDesktopFolder);
IDesktopFolder.ParseDisplayName(Application.Handle,nil,POleStr(Root),Eaten,RootItemIDList,Flags);
end;
with BrowsInfo do
begin
hwndOwner := Application.Handle;
pidlRoot := RootItemIDList;
pszDisplayName:= Buffer;
lpszTitle := Pchar(Caption);
ulFlags := BIF_RETURNONLYFSDIRS ;
lpfn:=@BrowseCallbackProc;
lparam:= BFFM_INITIALIZED;
end;
WindowList := DisableTaskWindows(0);
try
ItemIDList := SHBrowseForFolder(BrowsInfo);
finally
EnableTaskWindows(WindowList);
end;
Result := ItemIDList <> nil;
if Result then
begin
ShGetPathFromIDList (ItemIDList,Buffer);
ShellMalloc.Free(ItemIDList);
Directory := Buffer;
end;
finally
ShellMalloc.Free(Buffer);
end;
end;
end;procedure TForm1.Button1Click(Sender: TObject);
var
path:string;
begin
path := 'd:\del';
path := SelDir ('please select a directoy','',path);
showmessage(path);
end;
我必须吃饭去了 *(~