-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathD10_Toko_006.dpr
73 lines (63 loc) · 1.84 KB
/
D10_Toko_006.dpr
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
program D10_Toko_006;
{%ToDo 'D10_Toko_006.todo'}
uses
Forms,
Windows,
uDM in 'uDM.pas' {DM: TDataModule},
uMain in 'uMain.pas' {frmMain},
uLogin in 'uLogin.pas' {frmLogin},
uAdmin in 'uAdmin.pas' {frmAdmin},
uShared in 'uShared.pas',
uCariBarang in 'uCariBarang.pas' {frmCariBarang};
{$R *.res}
var
Mutex : THandle;
mode : Integer; // 0:normal, 1:admin, 2:kasir
begin
mode :=2;
Mutex := CreateMutex(nil, True, 'KASIR');
if (Mutex = 0) OR (GetLastError = ERROR_ALREADY_EXISTS) then
begin
// code to searh for, and activate
// the previous (first) instance
end
else
begin
Application.Initialize;
Application.Title := '.:. Kasir - Penjualan .:.';
case mode of
0: begin
if TfrmLogin.Execute then
begin
Application.CreateForm(TDM, DM);
// Application.CreateForm(TfrmMain, frmMain);
if TfrmLogin.GetAkses > 0 then
begin
Application.CreateForm(TfrmAdmin, frmAdmin);
end
else
begin
Application.CreateForm(TfrmMain, frmMain);
end;
Application.Run;
end
else
begin
Application.MessageBox('You are not authorized to use the application.','Error');
end;
end;
1: begin
Application.CreateForm(TDM, DM);
Application.CreateForm(TfrmAdmin, frmAdmin);
Application.Run;
end;
2: begin
Application.CreateForm(TDM, DM);
Application.CreateForm(TfrmMain, frmMain);
Application.CreateForm(TfrmCariBarang, frmCariBarang);
Application.Run;
end;
end;
if Mutex <> 0 then CloseHandle(Mutex);
end;
end.