التعرف على مسار MyDocuments برمجيا
#7
من الأفضل استخدام الدالة SHGetFolderPath بدلا من الدالة ShGetSpecialFolderPath لانها غير مدعومة في نسخ الوينداوز الاحدث ..
From MSDN
إقتباس :[SHGetSpecialFolderPath is not supported. Instead, use ShGetFolderPath.]
لكن رغم هذا يمكن استخدامها ..

يمكن استخدام الدالة SHGetFolderPath مع نسخ دلفي الحديثة و التي تدعم اليونيكود
PHP كود :
function GetSpecialFolder(CSIDL:integer): string;
var
LResult: BOOL;
HLResult :HResult;
{
$IFDEF UNICODE}
  
PathTemp:LPWSTR;
 {
$ELSE}
  
PathTemp:LPSTR;
{
$ENDIF}
begin
GetMem
(PathTemp,MAX_PATH);
{
$IF CompilerVersion <= 17}
 
LResult := ShGetSpecialFolderPath(0, PathTemp, CSIDL, False) ;
 if 
not LResult then raise Exception.Create('Could not find your folder location.') ;
{
$ELSE}
 
HLResult:=SHGetFolderPath (0,CSIDL,0,1,PathTemp);
 if  
HLResult<>S_OK then raise Exception.Create('Could not find your folder location.') ;
{
$IFEND}

 
Result := PathTemp;
 
FreeMem(PathTemp,MAX_PATH);
end; 
يكفي أن تقوم باختيار ال CSIDL
PHP كود :
edit1.text:= GetSpecialFolder(CSIDL_Personal); 
[-] كل من 2 users say قال شكرا ل SMP3 على المشاركة المفيدة
  • wadoud, mohamed49
الرد


الردود في هذا الموضوع
التعرف على مسار MyDocuments برمجيا - بواسطة delphi4ever - 01-04-2008, 08:42 PM
التعرف على مسار MyDocuments برمجيا - بواسطة SMP3 - 04-11-2012, 11:26 PM

التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم