-
Notifications
You must be signed in to change notification settings - Fork 1
/
uShellFuncs.pas
57 lines (47 loc) · 1.09 KB
/
uShellFuncs.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
{
Oracle Deploy System ver.1.0 (ORDESY)
by Volodymyr Sedler aka scribe
2016
Desc: wrap/deploy/save objects of oracle database.
No warranty of using this program.
Just Free.
With bugs, suggestions please write to [email protected]
On Github: github.com/justscribe/ORDESY
As a part of project.
}
unit uShellFuncs;
interface
uses
Windows, SysUtils, ShlObj;
function GetPathMyDocs: string;
function GetWindowsUser: string;
implementation
// Retrieveing MyDocuments folder
function GetPathMyDocs: string;
var
bResult: boolean;
path: array [0..MAX_PATH] of Char;
begin
bResult:= SHGetSpecialFolderPath(0, path, CSIDL_PERSONAL, false);
if not bResult then
raise Exception.Create('Personal folder not found!');
Result:= path;
end;
// Current username
function GetWindowsUser: string;
var
UserName : string;
UserNameLen : Dword;
begin
UserNameLen := 255;
SetLength(userName, UserNameLen);
try
if GetUserName(PChar(UserName), UserNameLen) then
Result := Copy(UserName,1,UserNameLen - 1)
else
Result := 'Unknown';
except
Result := 'Unknown';
end;
end;
end.