掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
TSaveDialogの初期ディレクトリを取得するには? (ID:39933)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
if tmplen>0 then ではじまるブロックは、威光の影響を受ける範囲をすべてブロック内におさめるべき。 reg:= TRegistry.Create; try reg.RootKey:= HKEY_CURRENT_USER; if reg.OpenKey('Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\LastVisitedMRU',False) then begin if reg.ValueExists('MRUList') then begin list:=reg.ReadString('MRUList'); len:= Length(list); if len>0 then begin for i:= 1 to len do begin if reg.ValueExists(list[i]) then begin buflen:= reg.GetDataSize(list[i]); if buflen>0 then begin GetMem(buffer,buflen); try reg.ReadBinaryData(list[i],pByte(buffer)^,buflen); s:= PWideChar(buffer); p:= s; e:= s + buflen; tmplen:=0; while p<=e do begin if p^ = #0 then begin tmplen:= (p-s); Break; end; inc(p); end; if tmplen>0 then begin SetLength(fn,tmplen); copymemory(@fn[1],s,tmplen*SizeOf(WideChar)); s:= p; inc(s); p:= s; tmplen:=0; while p<=e do begin if p^ = #0 then begin tmplen:= (p-s); Break; end; inc(p); end; if tmplen>0 then begin SetLength(dir,tmplen); copymemory(@dir[1],s,tmplen*SizeOf(WideChar)); appname:=WideCharToString(@fn[1]); if appname=ExtractFilename(Application.Exename) then begin appdir :=WideCharToString(@dir[1]); Result:= appdir; OutPutDebugString(Pchar(list[i]+':'+appname+','+appdir)); Exit; end; end; end; finally FreeMem(buffer,buflen); end; end; end; end; end; end; reg.CloseKey; //finally不要 end; finally reg.Free; end; こういうふうに。 たぶん他はOK。
←解決時は質問者本人がここをチェックしてください。
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.