-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLibUtil.pas
66 lines (49 loc) · 2.54 KB
/
LibUtil.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
58
59
60
61
62
63
64
65
66
unit LibUtil;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls, Vcl.StdCtrls, Winapi.ShellAPI,
JvExComCtrls, JvProgressBar, Vcl.WinXCtrls, Vcl.ComCtrls,
JvBaseDlg, JvBrowseFolder, JvDialogs, Vcl.Mask, JvExMask, JvToolEdit, System.Generics.Collections,
System.StrUtils, System.JSON,REST.Types, System.DateUtils, System.Types, System.IOUtils, FireDAC.Phys.IB,
FireDAC.Stan.Def, FireDAC.Phys, FireDAC.Phys.IBDef, FireDAC.Stan.Intf, FireDAC.Stan.Option, FireDAC.Stan.Error,
FireDAC.UI.Intf, FireDAC.Phys.Intf, FireDAC.Stan.Pool, FireDAC.Stan.Async, FireDAC.VCLUI.Wait, Data.DB,
FireDAC.Comp.Client, FireDAC.Dapt, FireDAC.Phys.FB, FireDAC.Phys.FBDef, FireDAC.Phys.IBBase, System.Zip, System.UITypes,
Winapi.WinSvc, Data.Win.ADODB, System.ImageList, Vcl.ImgList, JclSysUtils, dprocess;
const
cgDirBarra = {$IFDEF linux}'/'{$ELSE}'\'{$ENDIF};
cgModuloCadastro: array [1..10] of string = ('Todos', 'Utilitarios', 'CRM', 'Almoxarifado', 'Financeiro',
'PDV', 'Recepção', 'Eventos', 'Ordem de Serviço', 'Reservas');
cgModuloProcedimento: array [1..11] of string = ('Todos', 'Eventos', 'Reservas', 'Recepção', 'PDV', 'Almoxarifado',
'Financeiro', 'Utilitarios', 'Relatorios', 'Extra', 'CRM');
cgTipo: array[1..2] of string = ('Cadastro', 'Procedimento');
procedure CarregarComboBox(mComboBox: TComboBox; const cgModulos, cgTipo: array of string; cgTipoIndex: Integer);
procedure CarregarPromptComand(gCaminhoCadastro : String);
implementation
procedure CarregarComboBox(mComboBox: TComboBox; const cgModulos, cgTipo: array of string; cgTipoIndex: Integer);
var
mI: Integer;
begin
mComboBox.Clear;
for mI := Low(cgModulos) to High(cgModulos) do
mComboBox.Items.Add(cgModulos[mI] + ' ' + cgTipo[cgTipoIndex]);
end;
procedure CarregarPromptComand(gCaminhoCadastro : String);
var
StartupInfo : TStartupInfo;
ProcessInfo : TProcessInformation;
begin
ZeroMemory(@StartupInfo, SizeOf(TStartupInfo));
StartupInfo.cb := SizeOf(StartupInfo);
StartupInfo.dwFlags := STARTF_USESTDHANDLES;
StartupInfo.wShowWindow := SW_NORMAL;
if not CreateProcess(nil, PChar(gCaminhoCadastro), nil, nil, False, CREATE_NEW_CONSOLE, nil, nil, StartupInfo, ProcessInfo) then
begin
RaiseLastOSError;
Exit;
end;
WaitForSingleObject(ProcessInfo.hProcess, INFINITE);
CloseHandle(ProcessInfo.hProcess);
CloseHandle(ProcessInfo.hThread);
end;
end.