المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : الأستعراض بحثاً عن مجلد


issamdnn
06-12-2009, 09:34 AM
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,shellapi, StdCtrls, ActiveX, ComObj, CommCtrl, FileCtrl,ToolWin, ShlObj;

type
TForm1 = class(TForm)
Button1: TButton;
Label1: TLabel;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;
g_pMalloc:^IMalloc;
implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
bi:BROWSEINFO;
lpbuffer:PChar;
pidlprograms:pITEMIDLIST; //pidl for programs folder
pidlBrouse:pITEMIDLIST; //pidl selected by user
begin
GetMem(lpbuffer,500);
//lpbuffer:=pchar(g_pMalloc^.alloc(MAX_PATH));
// get pidl for the program folder
SHGetSpecialFolderLocation(Handle,CSIDL_COMMON_STA RTMENU,pidlprograms) ;
bi.hwndOwner:= Handle ;
bi.ulFlags:= 0 ;
bi.pidlRoot:=pidlprograms;
bi.pszDisplayName:=lpbuffer;
bi.lpszTitle:='الرجاء البحث عن المجلد المطلوب هنا من برمجة المهندس عصام المبسبس';
bi.lpfn:=nil;
bi.lParam:=0;
//pidlBrouse:=

pidlBrouse:=SHBrowseForFolder(bi);
//Label1.Caption:=FormatCurr('', pidlBrouse.mkid.cb );
SHGetPathFromIDList(pidlBrouse,lpbuffer);
Label1.Caption:=lpbuffer;

end;

chafik
26-10-2010, 12:10 AM
string folder;
//------------------------------------------------------------------------------
CSIDL_ALTSTARTUP
CSIDL_APPDATA
CSIDL_BITBUCKET
CSIDL_COMMON_ALTSTARTUP
CSIDL_COMMON_DESKTOPDIRECTORY
CSIDL_COMMON_FAVORITES
CSIDL_COMMON_PROGRAMS
CSIDL_COMMON_STARTMENU
CSIDL_COMMON_STARTUP
CSIDL_CONTROLS
CSIDL_COOKIES
CSIDL_DESKTOP
CSIDL_DESKTOPDIRECTORY
CSIDL_DRIVES
CSIDL_FAVORITES
CSIDL_FONTS
CSIDL_HISTORY
CSIDL_INTERNET
CSIDL_INTERNET_CACHE
CSIDL_NETHOOD
CSIDL_NETWORK
CSIDL_PERSONAL
CSIDL_PRINTERS
CSIDL_PRINTHOOD
CSIDL_PROGRAMS
CSIDL_RECENT
CSIDL_SENDTO
CSIDL_STARTMENU
CSIDL_STARTUP
CSIDL_TEMPLATES


exemple:

procedure TForm1.Button2Click(Sender: TObject);
var
PIDL: PItemIDList;
Path: array[0..MAX_PATH] of Char;
begin
SHGetSpecialFolderLocation(Handle, CSIDL_PROGRAMS, PIDL);
SHGetPathFromIDList(PIDL, Path);
ShowMessage(Path);
end;