From a2a4aedd3c71df6211eacf613a64572dabae97f4 Mon Sep 17 00:00:00 2001 From: pedroricardo Date: Mon, 25 Nov 2013 13:02:18 +0000 Subject: [PATCH] git-svn-id: http://svn.softwarepublico.gov.br/svn/cacic/cacic/trunk/agente-windows@1572 fecfc0c7-e812-0410-ae72-849f08638ee7 --- MapaTesteProj/AcessoMapaTeste.dcu | Bin 0 -> 4317 bytes MapaTesteProj/AcessoMapaTeste.dfm | 159 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ MapaTesteProj/AcessoMapaTeste.pas | 34 ++++++++++++++++++++++++++++++++++ MapaTesteProj/MapaCACIC.exe | Bin 0 -> 827392 bytes MapaTesteProj/MapaCACIC.identcache | Bin 0 -> 337 bytes MapaTesteProj/MapaCACICteste.dpr | 41 +++++++++++++++++++++++++++++++++++++++++ MapaTesteProj/MapaCACICteste.dproj | 41 +++++++++++++++++++++++++++++++++++++++++ MapaTesteProj/MapaCACICteste.dproj.local | 25 +++++++++++++++++++++++++ MapaTesteProj/MapaCACICteste.identcache | Bin 0 -> 342 bytes MapaTesteProj/MapaCACICteste.res | Bin 0 -> 5280 bytes MapaTesteProj/MapaTeste.dcu | Bin 0 -> 30080 bytes MapaTesteProj/MapaTeste.dfm | 642 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ MapaTesteProj/MapaTeste.pas | 785 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ MapaTesteProj/MapaTesteProj02.identcache | Bin 0 -> 226 bytes MapaTesteProj/iphist.dat | 0 15 files changed, 1727 insertions(+), 0 deletions(-) create mode 100644 MapaTesteProj/AcessoMapaTeste.dcu create mode 100644 MapaTesteProj/AcessoMapaTeste.dfm create mode 100644 MapaTesteProj/AcessoMapaTeste.pas create mode 100644 MapaTesteProj/MapaCACIC.exe create mode 100644 MapaTesteProj/MapaCACIC.identcache create mode 100644 MapaTesteProj/MapaCACICteste.dpr create mode 100644 MapaTesteProj/MapaCACICteste.dproj create mode 100644 MapaTesteProj/MapaCACICteste.dproj.local create mode 100644 MapaTesteProj/MapaCACICteste.identcache create mode 100644 MapaTesteProj/MapaCACICteste.res create mode 100644 MapaTesteProj/MapaTeste.dcu create mode 100644 MapaTesteProj/MapaTeste.dfm create mode 100644 MapaTesteProj/MapaTeste.pas create mode 100644 MapaTesteProj/MapaTesteProj02.identcache create mode 100644 MapaTesteProj/iphist.dat diff --git a/MapaTesteProj/AcessoMapaTeste.dcu b/MapaTesteProj/AcessoMapaTeste.dcu new file mode 100644 index 0000000..22bacfd Binary files /dev/null and b/MapaTesteProj/AcessoMapaTeste.dcu differ diff --git a/MapaTesteProj/AcessoMapaTeste.dfm b/MapaTesteProj/AcessoMapaTeste.dfm new file mode 100644 index 0000000..9689668 --- /dev/null +++ b/MapaTesteProj/AcessoMapaTeste.dfm @@ -0,0 +1,159 @@ +object frmAcesso: TfrmAcesso + Left = 0 + Top = 0 + Caption = 'Acessar' + ClientHeight = 309 + ClientWidth = 624 + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Tahoma' + Font.Style = [] + OldCreateOrder = False + PixelsPerInch = 96 + TextHeight = 13 + object btAcesso: TButton + Left = 177 + Top = 260 + Width = 105 + Height = 33 + Caption = 'Acessar' + Default = True + Enabled = False + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -16 + Font.Name = 'Arial' + Font.Style = [fsBold] + ParentFont = False + TabOrder = 0 + end + object btCancela: TButton + Left = 333 + Top = 260 + Width = 105 + Height = 33 + Caption = 'Cancelar' + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -16 + Font.Name = 'Arial' + Font.Style = [fsBold] + ParentFont = False + TabOrder = 1 + end + object pnAcesso: TPanel + Left = 2 + Top = 3 + Width = 602 + Height = 196 + BevelInner = bvRaised + BevelOuter = bvLowered + TabOrder = 2 + object lbNomeUsuarioAcesso: TLabel + Left = 109 + Top = 42 + Width = 127 + Height = 20 + Caption = 'Nome de Usu'#225'rio:' + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -16 + Font.Name = 'MS Sans Serif' + Font.Style = [] + ParentFont = False + Visible = False + end + object lbSenhaAcesso: TLabel + Left = 106 + Top = 82 + Width = 130 + Height = 20 + Caption = 'Senha de Acesso:' + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -16 + Font.Name = 'MS Sans Serif' + Font.Style = [] + ParentFont = False + Visible = False + end + object lbAviso: TLabel + Left = 4 + Top = 171 + Width = 593 + Height = 13 + Alignment = taCenter + AutoSize = False + Font.Charset = DEFAULT_CHARSET + Font.Color = clNavy + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + ParentFont = False + end + object edNomeUsuarioAcesso: TEdit + Left = 239 + Top = 39 + Width = 250 + Height = 28 + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -16 + Font.Name = 'MS Sans Serif' + Font.Style = [] + MaxLength = 20 + ParentFont = False + TabOrder = 0 + Visible = False + end + object edSenhaAcesso: TEdit + Left = 239 + Top = 79 + Width = 250 + Height = 28 + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -16 + Font.Name = 'MS Sans Serif' + Font.Style = [] + ParentFont = False + PasswordChar = #7 + TabOrder = 1 + Visible = False + end + end + object pnMessageBox: TPanel + Left = 1 + Top = 198 + Width = 602 + Height = 45 + BevelInner = bvLowered + Color = clGradientInactiveCaption + Font.Charset = DEFAULT_CHARSET + Font.Color = clGradientActiveCaption + Font.Height = -13 + Font.Name = 'Arial' + Font.Style = [] + ParentFont = False + TabOrder = 3 + Visible = False + object lbMensagens: TLabel + Left = 2 + Top = 2 + Width = 598 + Height = 41 + Align = alClient + Alignment = taCenter + AutoSize = False + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -13 + Font.Name = 'MS Sans Serif' + Font.Style = [] + ParentFont = False + Layout = tlCenter + end + end +end diff --git a/MapaTesteProj/AcessoMapaTeste.pas b/MapaTesteProj/AcessoMapaTeste.pas new file mode 100644 index 0000000..d75bd3c --- /dev/null +++ b/MapaTesteProj/AcessoMapaTeste.pas @@ -0,0 +1,34 @@ +unit AcessoMapaTeste; + +interface + +uses + Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, + Dialogs, StdCtrls, ExtCtrls; + +type + TfrmAcesso = class(TForm) + btAcesso: TButton; + btCancela: TButton; + pnAcesso: TPanel; + lbNomeUsuarioAcesso: TLabel; + lbSenhaAcesso: TLabel; + lbAviso: TLabel; + edNomeUsuarioAcesso: TEdit; + edSenhaAcesso: TEdit; + pnMessageBox: TPanel; + lbMensagens: TLabel; + private + { Private declarations } + public + { Public declarations } + end; + +var + frmAcesso: TfrmAcesso; + +implementation + +{$R *.dfm} + +end. diff --git a/MapaTesteProj/MapaCACIC.exe b/MapaTesteProj/MapaCACIC.exe new file mode 100644 index 0000000..350fa62 Binary files /dev/null and b/MapaTesteProj/MapaCACIC.exe differ diff --git a/MapaTesteProj/MapaCACIC.identcache b/MapaTesteProj/MapaCACIC.identcache new file mode 100644 index 0000000..1ba8b4f Binary files /dev/null and b/MapaTesteProj/MapaCACIC.identcache differ diff --git a/MapaTesteProj/MapaCACICteste.dpr b/MapaTesteProj/MapaCACICteste.dpr new file mode 100644 index 0000000..4868773 --- /dev/null +++ b/MapaTesteProj/MapaCACICteste.dpr @@ -0,0 +1,41 @@ +program MapaCACICteste; + +uses + Forms, + Windows, + MapaTeste in 'MapaTeste.pas' {frmMapaCacic}, + AcessoMapaTeste in 'AcessoMapaTeste.pas' {frmAcesso}, + CACIC_Comm in '..\CACIC_Comm.pas', + CACIC_Library in '..\CACIC_Library.pas'; + +{$R *.res} + +const APP_NAME = 'MapaCacicteste.exe'; + +var hwind:HWND; + oCacic : TCACIC; + +begin + oCacic := TCACIC.Create(); + + if( oCacic.isAppRunning( APP_NAME ) ) + then begin + hwind := 0; + repeat // The string 'My app' must match your App Title (below) + hwind:=Windows.FindWindowEx(0,hwind,'TApplication', APP_NAME ); + until (hwind<>Application.Handle); + IF (hwind<>0) then + begin + Windows.ShowWindow(hwind,SW_SHOWNORMAL); + Windows.SetForegroundWindow(hwind); + end; + FreeMemory(0); + end + else + begin + Application.Initialize; + Application.CreateForm(TfrmMapaCacic, frmMapaCacic); + Application.Run; + end; + oCacic.Free(); +end. diff --git a/MapaTesteProj/MapaCACICteste.dproj b/MapaTesteProj/MapaCACICteste.dproj new file mode 100644 index 0000000..4e7f700 --- /dev/null +++ b/MapaTesteProj/MapaCACICteste.dproj @@ -0,0 +1,41 @@ + + + {4f42d5b9-4185-4233-9988-97f71c5d98fc} + Debug + AnyCPU + DCC32 + MapaCACICteste.exe + MapaCACICteste.dpr + + + 7.0 + False + False + 0 + RELEASE + + + 7.0 + DEBUG + + + Delphi.Personality + + +FalseTrueFalseFalseFalse1000FalseFalseFalseFalseFalse104612521.0.0.01.0.0.0MapaCACICteste.dpr + + + + + MainSource + + + + +
frmAcesso
+
+ +
frmMapaCacic
+
+
+
\ No newline at end of file diff --git a/MapaTesteProj/MapaCACICteste.dproj.local b/MapaTesteProj/MapaCACICteste.dproj.local new file mode 100644 index 0000000..2c1a17e --- /dev/null +++ b/MapaTesteProj/MapaCACICteste.dproj.local @@ -0,0 +1,25 @@ + + + + 2013/10/25 15:08:21.585.dproj,C:\Documents and Settings\adriano\Meus documentos\RAD Studio\Projects\Project1.dproj=C:\Documents and Settings\adriano\Meus documentos\RAD Studio\Projects\MapaTesteProj0.dproj + 2013/10/25 15:08:53.133.dproj,C:\Documents and Settings\adriano\Meus documentos\RAD Studio\Projects\MapaTesteProj0.dproj=C:\Documents and Settings\adriano\Meus documentos\RAD Studio\Projects\MapaTesteProj0_2.dproj + 2013/10/25 15:17:19.101.pas,C:\Documents and Settings\adriano\Meus documentos\RAD Studio\Projects\Unit1.pas=C:\Documents and Settings\adriano\Meus documentos\RAD Studio\Projects\MapaTeste.pas + 2013/10/25 15:17:19.101.dfm,C:\Documents and Settings\adriano\Meus documentos\RAD Studio\Projects\Unit1.dfm=C:\Documents and Settings\adriano\Meus documentos\RAD Studio\Projects\MapaTeste.dfm + 2013/10/25 15:19:13.802.pas,C:\Documents and Settings\adriano\Meus documentos\RAD Studio\Projects\Unit1.pas=C:\Documents and Settings\adriano\Meus documentos\RAD Studio\Projects\AcessoMapaTeste.pas + 2013/10/25 15:19:13.802.dfm,C:\Documents and Settings\adriano\Meus documentos\RAD Studio\Projects\Unit1.dfm=C:\Documents and Settings\adriano\Meus documentos\RAD Studio\Projects\AcessoMapaTeste.dfm + 2013/10/25 15:20:11.034.pas,C:\Documents and Settings\adriano\Meus documentos\RAD Studio\Projects\AcessoMapaTeste.pas=C:\Documents and Settings\adriano\Desktop\Mapa0.2\AcessoMapaTeste.pas + 2013/10/25 15:20:11.034.dfm,C:\Documents and Settings\adriano\Meus documentos\RAD Studio\Projects\AcessoMapaTeste.dfm=C:\Documents and Settings\adriano\Desktop\Mapa0.2\AcessoMapaTeste.dfm + 2013/10/25 15:20:19.753.pas,C:\Documents and Settings\adriano\Meus documentos\RAD Studio\Projects\MapaTeste.pas=C:\Documents and Settings\adriano\Desktop\Mapa0.2\MapaTeste.pas + 2013/10/25 15:20:19.753.dfm,C:\Documents and Settings\adriano\Meus documentos\RAD Studio\Projects\MapaTeste.dfm=C:\Documents and Settings\adriano\Desktop\Mapa0.2\MapaTeste.dfm + 2013/10/25 15:20:21.487.dproj,C:\Documents and Settings\adriano\Meus documentos\RAD Studio\Projects\MapaTesteProj0_2.dproj=C:\Documents and Settings\adriano\Desktop\Mapa0.2\MapaTesteProj0_2.dproj + 2013/11/05 11:28:21.475.dproj,C:\Documents and Settings\adriano\Desktop\Mapa0.2\MapaTesteProj0_2.dproj=C:\Documents and Settings\adriano\Desktop\Mapa0.2\MapaTesteProj02.dproj + 2013/11/11 16:28:39.095.pas,C:\Documents and Settings\adriano\Desktop\Mapa0.2\MapaTeste.pas=C:\devel\cacic\agente-windows\MapaTesteProj\MapaTeste.pas + 2013/11/11 16:28:39.095.dfm,C:\Documents and Settings\adriano\Desktop\Mapa0.2\MapaTeste.dfm=C:\devel\cacic\agente-windows\MapaTesteProj\MapaTeste.dfm + 2013/11/11 16:29:05.925.dproj,C:\Documents and Settings\adriano\Desktop\Mapa0.2\MapaTesteProj02.dproj=C:\devel\cacic\agente-windows\MapaTesteProj\MapaTesteProj02.dproj + 2013/11/11 16:29:36.615.pas,C:\Documents and Settings\adriano\Desktop\Mapa0.2\AcessoMapaTeste.pas=C:\devel\cacic\agente-windows\MapaTesteProj\AcessoMapaTeste.pas + 2013/11/11 16:29:36.615.dfm,C:\Documents and Settings\adriano\Desktop\Mapa0.2\AcessoMapaTeste.dfm=C:\devel\cacic\agente-windows\MapaTesteProj\AcessoMapaTeste.dfm + 2013/11/12 18:18:32.539.dproj,C:\devel\cacic\agente-windows\MapaTesteProj\MapaTesteProj02.dproj=C:\devel\cacic\agente-windows\MapaTesteProj\MapaCACIC.dproj + 2013/11/22 16:35:45.536.dproj,C:\devel\cacic\agente-windows\MapaTesteProj\MapaCACIC.dproj=C:\devel\cacic\agente-windows\MapaTesteProj\MapaCACIC_teste.dproj + 2013/11/22 16:36:47.288.dproj,C:\devel\cacic\agente-windows\MapaTesteProj\MapaCACIC_teste.dproj=C:\devel\cacic\agente-windows\MapaTesteProj\MapaCACICteste.dproj + + diff --git a/MapaTesteProj/MapaCACICteste.identcache b/MapaTesteProj/MapaCACICteste.identcache new file mode 100644 index 0000000..65ecbc0 Binary files /dev/null and b/MapaTesteProj/MapaCACICteste.identcache differ diff --git a/MapaTesteProj/MapaCACICteste.res b/MapaTesteProj/MapaCACICteste.res new file mode 100644 index 0000000..1826680 Binary files /dev/null and b/MapaTesteProj/MapaCACICteste.res differ diff --git a/MapaTesteProj/MapaTeste.dcu b/MapaTesteProj/MapaTeste.dcu new file mode 100644 index 0000000..b1f052c Binary files /dev/null and b/MapaTesteProj/MapaTeste.dcu differ diff --git a/MapaTesteProj/MapaTeste.dfm b/MapaTesteProj/MapaTeste.dfm new file mode 100644 index 0000000..4173d62 --- /dev/null +++ b/MapaTesteProj/MapaTeste.dfm @@ -0,0 +1,642 @@ +object frmMapaCacic: TfrmMapaCacic + Left = 0 + Top = -55 + Caption = 'frmMapaCacic' + ClientHeight = 634 + ClientWidth = 789 + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Tahoma' + Font.Style = [] + OldCreateOrder = False + Position = poDesigned + OnActivate = FormActivate + OnClose = FormClose + OnCreate = FormCreate + DesignSize = ( + 789 + 634) + PixelsPerInch = 96 + TextHeight = 13 + object edWebManagerAddress: TLabel + Left = 155 + Top = 682 + Width = 500 + Height = 14 + Anchors = [akBottom] + AutoSize = False + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Arial' + Font.Style = [fsBold] + ParentFont = False + ExplicitLeft = 159 + ExplicitTop = 537 + end + object lbWebManagerAddress: TLabel + Left = 0 + Top = 683 + Width = 153 + Height = 13 + Anchors = [akLeft, akBottom] + AutoSize = False + Caption = 'Endere'#231'o do Servidor de Aplica'#231#227'o:' + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -9 + Font.Name = 'Arial' + Font.Style = [] + ParentFont = False + ExplicitTop = 538 + end + object btGravarInformacoes: TButton + Left = 188 + Top = 580 + Width = 401 + Height = 35 + Anchors = [] + Caption = 'Grava e Envia Informa'#231#245'es Patrimoniais ao Gerente WEB' + Enabled = False + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -13 + Font.Name = 'Arial' + Font.Style = [fsBold] + ParentFont = False + TabOrder = 0 + Visible = False + OnClick = AtualizaPatrimonio + end + object gbInformacoesSobreComputador: TGroupBox + Left = 1 + Top = 64 + Width = 780 + Height = 497 + Anchors = [] + Caption = + ' Informa'#231#245'es sobre localiza'#231#227'o f'#237'sica e patrimonial deste comput' + + 'ador ' + Font.Charset = DEFAULT_CHARSET + Font.Color = clBlue + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [fsBold] + ParentFont = False + TabOrder = 1 + object lbEtiqueta1: TLabel + Left = 6 + Top = 226 + Width = 45 + Height = 13 + Caption = 'Etiqueta1' + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + ParentFont = False + Visible = False + end + object lbEtiqueta2: TLabel + Left = 266 + Top = 226 + Width = 250 + Height = 13 + AutoSize = False + Caption = 'Etiqueta2' + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + ParentFont = False + Visible = False + end + object lbEtiqueta3: TLabel + Left = 530 + Top = 226 + Width = 250 + Height = 13 + AutoSize = False + Caption = 'Etiqueta3' + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + ParentFont = False + Visible = False + end + object lbEtiqueta4: TLabel + Left = 3 + Top = 275 + Width = 250 + Height = 13 + AutoSize = False + Caption = 'Etiqueta4' + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + ParentFont = False + Visible = False + end + object lbEtiqueta5: TLabel + Left = 266 + Top = 275 + Width = 250 + Height = 13 + AutoSize = False + Caption = 'Etiqueta5' + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + ParentFont = False + Visible = False + end + object lbEtiqueta6: TLabel + Left = 530 + Top = 275 + Width = 250 + Height = 13 + AutoSize = False + Caption = 'Etiqueta6' + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + ParentFont = False + Visible = False + end + object lbEtiquetaUserLogado: TLabel + Left = 420 + Top = 33 + Width = 250 + Height = 13 + AutoSize = False + Caption = 'Usu'#225'rio Logado' + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + ParentFont = False + Visible = False + end + object lbEtiquetaNomeComputador: TLabel + Left = 107 + Top = 146 + Width = 250 + Height = 13 + AutoSize = False + Caption = 'Computador' + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + ParentFont = False + Visible = False + end + object lbEtiquetaCpfUser: TLabel + Left = 420 + Top = 89 + Width = 250 + Height = 13 + AutoSize = False + Caption = 'CPF' + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + ParentFont = False + Visible = False + end + object lbEtiquetaIpComputador: TLabel + Left = 420 + Top = 146 + Width = 250 + Height = 13 + AutoSize = False + Caption = 'IP' + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + ParentFont = False + Visible = False + end + object lbEtiquetaPatrimonioPc: TLabel + Left = 107 + Top = 33 + Width = 250 + Height = 13 + AutoSize = False + Caption = 'Patrim'#244'nio' + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + ParentFont = False + Visible = False + end + object lbEtiquetaNome: TLabel + Left = 107 + Top = 89 + Width = 250 + Height = 13 + AutoSize = False + Caption = 'Nome' + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + ParentFont = False + Visible = False + end + object edTeInfoPatrimonio1: TEdit + Left = 5 + Top = 245 + Width = 251 + Height = 24 + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -13 + Font.Name = 'Arial' + Font.Style = [] + MaxLength = 100 + ParentFont = False + ParentShowHint = False + ShowHint = True + TabOrder = 0 + Visible = False + end + object edTeInfoPatrimonio4: TEdit + Left = 6 + Top = 294 + Width = 250 + Height = 24 + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -13 + Font.Name = 'MS Sans Serif' + Font.Style = [] + MaxLength = 20 + ParentFont = False + ParentShowHint = False + ShowHint = True + TabOrder = 3 + Visible = False + end + object edTeInfoPatrimonio2: TEdit + Left = 262 + Top = 245 + Width = 250 + Height = 24 + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -13 + Font.Name = 'MS Sans Serif' + Font.Style = [] + MaxLength = 20 + ParentFont = False + ParentShowHint = False + ShowHint = True + TabOrder = 1 + Visible = False + end + object edTeInfoPatrimonio3: TEdit + Left = 530 + Top = 245 + Width = 250 + Height = 24 + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -13 + Font.Name = 'MS Sans Serif' + Font.Style = [] + MaxLength = 20 + ParentFont = False + ParentShowHint = False + ShowHint = True + TabOrder = 2 + Visible = False + end + object edTeInfoPatrimonio5: TEdit + Left = 266 + Top = 294 + Width = 250 + Height = 24 + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -13 + Font.Name = 'MS Sans Serif' + Font.Style = [] + MaxLength = 20 + ParentFont = False + ParentShowHint = False + ShowHint = True + TabOrder = 4 + Visible = False + end + object edTeInfoPatrimonio6: TEdit + Left = 530 + Top = 294 + Width = 250 + Height = 24 + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -13 + Font.Name = 'MS Sans Serif' + Font.Style = [] + MaxLength = 20 + ParentFont = False + ParentShowHint = False + ShowHint = True + TabOrder = 5 + Visible = False + end + object pnDivisoria01: TPanel + Left = 3 + Top = 211 + Width = 772 + Height = 3 + TabOrder = 6 + end + object btCombosUpdate: TButton + Left = 684 + Top = 10 + Width = 94 + Height = 20 + Caption = 'Recarregar' + Enabled = False + TabOrder = 7 + OnClick = btCombosUpdateClick + end + object edTeInfoUserLogado: TEdit + Left = 420 + Top = 52 + Width = 250 + Height = 24 + Enabled = False + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -13 + Font.Name = 'MS Sans Serif' + Font.Style = [] + MaxLength = 20 + ParentFont = False + ParentShowHint = False + ShowHint = True + TabOrder = 8 + Visible = False + end + object edTeInfoNomeComputador: TEdit + Left = 107 + Top = 165 + Width = 250 + Height = 24 + Enabled = False + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -13 + Font.Name = 'MS Sans Serif' + Font.Style = [] + MaxLength = 20 + ParentFont = False + ParentShowHint = False + ShowHint = True + TabOrder = 9 + Visible = False + end + object edTeInfoCpfUser: TEdit + Left = 420 + Top = 108 + Width = 250 + Height = 24 + Enabled = False + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -13 + Font.Name = 'MS Sans Serif' + Font.Style = [] + MaxLength = 20 + ParentFont = False + ParentShowHint = False + ShowHint = True + TabOrder = 10 + Visible = False + end + object edTeInfoIpComputador: TEdit + Left = 420 + Top = 165 + Width = 250 + Height = 24 + Enabled = False + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -13 + Font.Name = 'MS Sans Serif' + Font.Style = [] + MaxLength = 20 + ParentFont = False + ParentShowHint = False + ShowHint = True + TabOrder = 11 + Visible = False + end + object edTePatrimonioPc: TEdit + Left = 107 + Top = 52 + Width = 250 + Height = 24 + Enabled = False + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -13 + Font.Name = 'MS Sans Serif' + Font.Style = [] + MaxLength = 20 + ParentFont = False + ParentShowHint = False + ShowHint = True + TabOrder = 12 + Visible = False + end + object edTeInfoNome: TEdit + Left = 107 + Top = 108 + Width = 250 + Height = 24 + Enabled = False + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -13 + Font.Name = 'MS Sans Serif' + Font.Style = [] + MaxLength = 20 + ParentFont = False + ParentShowHint = False + ShowHint = True + TabOrder = 13 + Visible = False + end + object bgTermoResponsabilidade: TGroupBox + Left = 8 + Top = 328 + Width = 761 + Height = 161 + Caption = 'Termo de Responsabilidade' + TabOrder = 14 + object mmTermoResponsabilidade: TMemo + Left = 8 + Top = 21 + Width = 745 + Height = 108 + Enabled = False + Lines.Strings = ( + 'mmTermoResponsabilidade') + ReadOnly = True + ScrollBars = ssVertical + TabOrder = 0 + end + object rdConcordaTermos: TRadioButton + Left = 24 + Top = 135 + Width = 337 + Height = 17 + Caption = 'Eu aceito os termos e condi'#231#245'es etc...' + TabOrder = 1 + OnClick = rdConcordaTermosClick + end + end + end + object gbLeiaComAtencao: TGroupBox + Left = 1 + Top = 11 + Width = 780 + Height = 53 + Anchors = [] + Caption = ' Leia com aten'#231#227'o ' + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clRed + Font.Height = -13 + Font.Name = 'MS Sans Serif' + Font.Style = [fsBold] + ParentColor = False + ParentFont = False + TabOrder = 2 + DesignSize = ( + 780 + 53) + object lbLeiaComAtencao: TLabel + Left = 14 + Top = 18 + Width = 769 + Height = 32 + Anchors = [] + AutoSize = False + Caption = + 'O preenchimento correto dos campos abaixo define a exatid'#227'o do c' + + 'ontrole de patrim'#244'nio e localiza'#231#227'o f'#237'sica do equipamento.' + Font.Charset = DEFAULT_CHARSET + Font.Color = clBlack + Font.Height = -13 + Font.Name = 'MS Sans Serif' + Font.Style = [] + ParentFont = False + WordWrap = True + end + end + object pnVersao: TPanel + Left = 676 + Top = 676 + Width = 105 + Height = 20 + Anchors = [akRight, akBottom] + BevelInner = bvLowered + Caption = 'Vers'#227'o' + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [fsBold] + ParentFont = False + TabOrder = 3 + end + object pnMessageBox: TPanel + Left = 1 + Top = 246 + Width = 780 + Height = 45 + BevelInner = bvLowered + Color = clInactiveBorder + Font.Charset = DEFAULT_CHARSET + Font.Color = clMenuHighlight + Font.Height = -13 + Font.Name = 'Arial' + Font.Style = [] + ParentBackground = False + ParentFont = False + TabOrder = 4 + Visible = False + object lbMensagens: TLabel + Left = 2 + Top = 2 + Width = 776 + Height = 41 + Align = alClient + Alignment = taCenter + AutoSize = False + Color = clGrayText + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -13 + Font.Name = 'MS Sans Serif' + Font.Style = [] + ParentColor = False + ParentFont = False + Layout = tlCenter + ExplicitLeft = -38 + ExplicitTop = 4 + end + end + object timerMessageBoxShowOrHide: TTimer + Enabled = False + Interval = 500 + Left = 34 + Top = 569 + end + object timerMessageShowTime: TTimer + Enabled = False + Interval = 0 + OnTimer = timerMessageShowTimeTimer + Left = 2 + Top = 569 + end + object timerProcessos: TTimer + Enabled = False + Interval = 1 + OnTimer = timerProcessosTimer + Left = 66 + Top = 569 + end + object IdIPWatch1: TIdIPWatch + Active = False + HistoryFilename = 'iphist.dat' + Left = 96 + Top = 568 + end +end diff --git a/MapaTesteProj/MapaTeste.pas b/MapaTesteProj/MapaTeste.pas new file mode 100644 index 0000000..8f5959d --- /dev/null +++ b/MapaTesteProj/MapaTeste.pas @@ -0,0 +1,785 @@ +(** +--------------------------------------------------------------------------------------------------------------------------------------------------------------- +Copyright 2000, 2001, 2002, 2003, 2004, 2005 Dataprev - Empresa de Tecnologia e Informações da Previdência Social, Brasil + +Este arquivo é parte do programa CACIC - Configurador Automático e Coletor de Informações Computacionais + +O CACIC é um software livre; você pode redistribui-lo e/ou modifica-lo dentro dos termos da Licença Pública Geral GNU como +publicada pela Fundação do Software Livre (FSF); na versão 2 da Licença, ou (na sua opinião) qualquer versão. + +Este programa é distribuido na esperança que possa ser util, mas SEM NENHUMA GARANTIA; sem uma garantia implicita de ADEQUAÇÂO a qualquer +MERCADO ou APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU para maiores detalhes. + +Você deve ter recebido uma cópia da Licença Pública Geral GNU, sob o título "LICENCA.txt", junto com este programa, se não, escreva para a Fundação do Software +Livre(FSF) Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +--------------------------------------------------------------------------------------------------------------------------------------------------------------- +*) + +unit MapaTeste; + +interface + +uses + Windows, + SysUtils, // Deve ser colocado após o Windows acima, nunca antes + StrUtils, + StdCtrls, + Controls, + Classes, + Forms, + ExtCtrls, + Graphics, + Dialogs, + CACIC_Library, + CACIC_Comm, + ComCtrls, + Commctrl, + ShellAPI, + AcessoMapaTeste, + Types, + IdIPWatch, + Registry, + Math, IdBaseComponent, IdComponent; + +function IsUserAnAdmin() : boolean; external shell32; + +var strCollectsPatrimonioLast, + strConfigsPatrimonioCombos, + strFieldsAndValuesToRequest, + strIdUON1, + strFrmAtual, + strShowOrHide : string; + textFileAguarde : TextFile; + boolFinalizando : boolean; + objCacic : TCACIC; + Fechar : boolean; + Dummy : integer; + OldValue : LongBool; + +type + TfrmMapaCacic = class(TForm) + btGravarInformacoes: TButton; + edWebManagerAddress: TLabel; + gbInformacoesSobreComputador: TGroupBox; + lbEtiqueta1: TLabel; + lbEtiqueta2: TLabel; + lbEtiqueta3: TLabel; + lbEtiqueta4: TLabel; + lbEtiqueta5: TLabel; + lbEtiqueta6: TLabel; + edTeInfoPatrimonio1: TEdit; + edTeInfoPatrimonio4: TEdit; + edTeInfoPatrimonio2: TEdit; + edTeInfoPatrimonio3: TEdit; + edTeInfoPatrimonio5: TEdit; + edTeInfoPatrimonio6: TEdit; + pnDivisoria01: TPanel; + btCombosUpdate: TButton; + gbLeiaComAtencao: TGroupBox; + lbLeiaComAtencao: TLabel; + lbWebManagerAddress: TLabel; + pnVersao: TPanel; + timerMessageBoxShowOrHide: TTimer; + timerMessageShowTime: TTimer; + timerProcessos: TTimer; + edTeInfoUserLogado: TEdit; + edTeInfoNomeComputador: TEdit; + edTeInfoCpfUser: TEdit; + edTeInfoIpComputador: TEdit; + lbEtiquetaUserLogado: TLabel; + lbEtiquetaNomeComputador: TLabel; + lbEtiquetaCpfUser: TLabel; + lbEtiquetaIpComputador: TLabel; + IdIPWatch1: TIdIPWatch; + lbEtiquetaPatrimonioPc: TLabel; + edTePatrimonioPc: TEdit; + edTeInfoNome: TEdit; + lbEtiquetaNome: TLabel; + bgTermoResponsabilidade: TGroupBox; + mmTermoResponsabilidade: TMemo; + rdConcordaTermos: TRadioButton; + pnMessageBox: TPanel; + lbMensagens: TLabel; + + procedure FormCreate(Sender: TObject); + procedure AtualizaPatrimonio(Sender: TObject); + procedure mapa; + procedure FormClose(Sender: TObject; var Action: TCloseAction); + procedure FormActivate(Sender: TObject); + procedure btCombosUpdateClick(Sender: TObject); + procedure timerMessageShowTimeTimer(Sender: TObject); + procedure timerProcessosTimer(Sender: TObject); + function NomeComputador : String; + function UserName : String; + function getConfigs : String; + function SetCpfUser : String; + function SetPatrimonioPC : String; + function FormatarCpf(strCpfUser : String) : String; + procedure rdConcordaTermosClick(Sender: TObject); + + + private + strTeInfoPatrimonio1, + strTeInfoPatrimonio2, + strTeInfoPatrimonio3, + strTeInfoPatrimonio4, + strTeInfoPatrimonio5, + strTeInfoPatrimonio6 : String; + + procedure SetFocus; + procedure MontaInterface; + procedure RecuperaValoresAnteriores; + procedure Sair; + + public + foco, + boolAcessoOK : boolean; + strId_usuario, + strChkSisInfFileName, + strGerColsInfFileName : String; + + procedure Finalizar(p_pausa:boolean); + procedure Mensagem(p_strMsg : String; p_boolAlerta : boolean = false; p_intPausaSegundos : integer = 0); + + end; + +var frmMapaCacic: TfrmMapaCacic; + +implementation + +{$R *.dfm} + +procedure TfrmMapaCacic.Mensagem(p_strMsg : String; p_boolAlerta : boolean; p_intPausaSegundos : integer); +Begin + strShowOrHide := 'Show'; + + objCacic.writeDebugLog('Mensagem: ' + p_strMsg); + + if p_boolAlerta then + lbMensagens.Font.Color := clRed + else + lbMensagens.Font.Color := clBlack; + + lbMensagens.Caption := p_strMsg; + + objCacic.writeDailyLog(lbMensagens.Caption); + Application.ProcessMessages; + + if (p_intPausaSegundos > 0) then + timerMessageShowTime.Interval := p_intPausaSegundos * 1000; + + timerMessageBoxShowOrHide.Enabled := true; + + Application.ProcessMessages; +End; + +procedure TfrmMapaCacic.Sair; +Begin + Application.Terminate; +End; + +procedure TfrmMapaCacic.Finalizar(p_pausa:boolean); +Begin + gbLeiaComAtencao.Visible := false; + gbInformacoesSobreComputador.Visible := false; + btGravarInformacoes.Visible := false; + + Mensagem('Finalizando o MapaCacic...'); + + Application.ProcessMessages; + + Sleep(1000); + + Sair; +End; + +procedure TfrmMapaCacic.rdConcordaTermosClick(Sender: TObject); +begin + btGravarInformacoes.Enabled:= true; +end; + +//------------------------------------------------------------------------------ +//------------------FUNÇÃO PARA RETORNAR O NOME DO COMPUTADOR.------------------ +//------------------------------------------------------------------------------ + +Function TfrmMapaCacic.NomeComputador : String; +var + lpBuffer : PChar; + nSize : DWord; +const Buff_Size = MAX_COMPUTERNAME_LENGTH + 1; +begin + nSize := Buff_Size; + lpBuffer := StrAlloc(Buff_Size); + GetComputerName(lpBuffer,nSize); + Result := String(lpBuffer); + StrDispose(lpBuffer); +end; + +//------------------------------------------------------------------------------ +//------------------FUNÇÃO PARA RETORNAR O NOME DO USUARIO.--------------------- +//------------------------------------------------------------------------------ + +Function TfrmMapaCacic.UserName : String; +var + lpBuffer : PChar; + nSize : DWord; +const Buff_Size = MAX_COMPUTERNAME_LENGTH + 1; +begin + nSize := Buff_Size; + lpBuffer := StrAlloc(Buff_Size); + GetUserName(lpBuffer,nSize); + Result := String(lpBuffer); + StrDispose(lpBuffer); +end; + +//------------------------------------------------------------------------------ +//----------------------FUNÇÃO PARA RETORNAR O PATRIMONIO----------------------- +//------------------------------------------------------------------------------ + +function TfrmMapaCacic.SetPatrimonioPC : String; +var + strPatrimonioPc, + strNomePC : String; +begin + Result:=''; + strNomePC:=NomeComputador; + + if (pos('-',strNomePC) > 0) then + strPatrimonioPc:=copy(strNomePC, 0, (pos('-', strNomePC)-1)); + Result:=strPatrimonioPC; +end; + +//------------------------------------------------------------------------------ +//--------------------FUNÇÃO PARA FORMATAR O CPF-------------------------------- +//------------------------------------------------------------------------------ + +function TfrmMapaCacic.FormatarCpf(strCpfUser : String) : String; +var + strCpfFormatado : String; +begin + Result:=''; + strCpfFormatado:= Copy(strCpfUser, 1,3) + + + '.' + Copy(strCpfUser, 4,3) + + + '.' + Copy(strCpfUser, 7,3) + + + '-' + Copy(strCpfUser, 10,2); + Result:=strCpfFormatado; + +end; +//------------------------------------------------------------------------------ +//--------------------FUNÇÃO PARA RETORNAR O CPF DO USUARIO--------------------- +//------------------------------------------------------------------------------ + +function TfrmMapaCacic.SetCpfUser : String; +var + strCpfUser, + strUser : String; +begin + Result:=''; + strUser:=UserName; + + if (pos('-',strUser) > 0) then + strCpfUser:=copy(strUser, 0, (pos('-', strUser)-1)); + + Result:=strCpfUser; +end; + +function TfrmMapaCacic.getConfigs : String; +Begin + btCombosUpdate.Enabled := false; + + Result := Comm(objCacic.getWebManagerAddress + objCacic.getWebServicesFolderName + 'get/config', strFieldsAndValuesToRequest,objCacic.getLocalFolderName); + objCacic.setBoolCipher(not objCacic.isInDebugMode); + + objCacic.writeDebugLog('FormActivate: Retorno de getConfigs: "'+Result+'"'); + + if (Result <> '0') then + Begin + Mensagem('Comunicação Efetuada com Sucesso! Salvando as Configurações Obtidas...',false,1); + objCacic.setValueToFile('Configs' ,'Patrimonio_Combos' , objCacic.getValueFromTags('Configs_Patrimonio_Combos' , Result), strGerColsInfFileName); + objCacic.setValueToFile('Configs' ,'Patrimonio_Interface' , objCacic.getValueFromTags('Configs_Patrimonio_Interface', Result), strGerColsInfFileName); + objCacic.setValueToFile('Collects','Patrimonio_Last' , objCacic.getValueFromTags('Collects_Patrimonio_Last' , Result), strGerColsInfFileName); + End; + btCombosUpdate.Enabled := true; +End; + +procedure TfrmMapaCacic.RecuperaValoresAnteriores; +var strCollectsPatrimonioLast, + strConfigsPatrimonioInterface : String; +begin + btCombosUpdate.Enabled := false; + + Mensagem('Recuperando Valores Anteriores...',false,1); + + strCollectsPatrimonioLast := objCacic.deCrypt( objCacic.GetValueFromFile + ('Collects','Patrimonio_Last', + strGerColsInfFileName)); + + if (strCollectsPatrimonioLast <> '') then + Begin + strConfigsPatrimonioInterface := objCacic.deCrypt( objCacic.GetValueFromFile + ('Configs','Patrimonio_Interface', + strGerColsInfFileName)); + + lbEtiqueta1.Caption := objCacic.getValueFromTags('te_etiqueta1', + strConfigsPatrimonioInterface); + + if (strTeInfoPatrimonio1='') then + strTeInfoPatrimonio1 := objCacic.getValueFromTags('TeInfoPatrimonio1', + strCollectsPatrimonioLast); + if (strTeInfoPatrimonio2='') then + strTeInfoPatrimonio2 := objCacic.getValueFromTags('TeInfoPatrimonio2', + strCollectsPatrimonioLast); + if (strTeInfoPatrimonio3='') then + strTeInfoPatrimonio3 := objCacic.getValueFromTags('TeInfoPatrimonio3', + strCollectsPatrimonioLast); + if (strTeInfoPatrimonio4='') then + strTeInfoPatrimonio4 := objCacic.getValueFromTags('TeInfoPatrimonio4', + strCollectsPatrimonioLast); + if (strTeInfoPatrimonio5='') then + strTeInfoPatrimonio5 := objCacic.getValueFromTags('TeInfoPatrimonio5', + strCollectsPatrimonioLast); + if (strTeInfoPatrimonio6='') then + strTeInfoPatrimonio6 := objCacic.getValueFromTags('TeInfoPatrimonio6', + strCollectsPatrimonioLast); + End; + btCombosUpdate.Enabled := true; + Application.ProcessMessages; +end; + +procedure TfrmMapaCacic.AtualizaPatrimonio(Sender: TObject); +var strColetaAtual, + strRetorno: String; +begin + + Mensagem('Enviando Informações Coletadas ao Banco de Dados...',false,1); + + strFieldsAndValuesToRequest := 'CollectType=' + objCacic.replaceInvalidHTTPChars(objCacic.enCrypt('col_patr')) ; + + strColetaAtual := StringReplace('[TeInfoPatrimonio]' + edTePatrimonioPc.Text + '[/TeInfoPatrimonio]' + + '[TeInfoUser]' + edTeInfoUserLogado.Text + '[/TeInfoUser]' + + '[TeInfoNome]' + edTeInfoNome.Text + '[/TeInfoNome]' + + '[TeInfoCpfUser]' + edTeInfoCpfUser.Text + '[/TeInfoCpfUser]' + + '[TeInfoPatrimonio1]' + edTeInfoPatrimonio1.Text + '[/TeInfoPatrimonio1]' + + '[TeInfoPatrimonio2]' + edTeInfoPatrimonio2.Text + '[/TeInfoPatrimonio2]' + + '[TeInfoPatrimonio3]' + edTeInfoPatrimonio3.Text + '[/TeInfoPatrimonio3]' + + '[TeInfoPatrimonio4]' + edTeInfoPatrimonio4.Text + '[/TeInfoPatrimonio4]' + + '[TeInfoPatrimonio5]' + edTeInfoPatrimonio5.Text + '[/TeInfoPatrimonio5]' + + '[TeInfoPatrimonio6]' + edTeInfoPatrimonio6.Text + '[/TeInfoPatrimonio6]',',','[[COMMA]]',[rfReplaceAll]); + + strFieldsAndValuesToRequest := strFieldsAndValuesToRequest + ',col_patr=' + + objCacic.replaceInvalidHTTPChars(objCacic.enCrypt(strColetaAtual)); + + strRetorno := Comm(objCacic.getWebManagerAddress + objCacic.getWebServicesFolderName + 'gercols/set/collects', strFieldsAndValuesToRequest, + objCacic.getLocalFolderName); + + objCacic.setBoolCipher(not objCacic.isInDebugMode); + + if (strRetorno = '0') then + Mensagem('ATENÇÃO: PROBLEMAS NO ENVIO DAS INFORMAÇÕES COLETADAS AO BANCO DE DADOS...',true,1) + else + Begin + Mensagem('Salvando Informações Coletadas em Base Local...',false,1); + objCacic.setValueToFile('Collects','Patrimonio_Last' , + objCacic.enCrypt(strColetaAtual), strGerColsInfFileName); + + End; + objCacic.writeDebugLog(#13#10 + 'AtualizaPatrimonio: Dados Enviados ao Servidor!'); + Application.ProcessMessages; + + Finalizar(true); + +end; + + +procedure TfrmMapaCacic.MontaInterface; +var strConfigsPatrimonioInterface : String; +Begin + btCombosUpdate.Enabled := false; + + Mensagem('Montando Interface para Coleta de Informações...',false,1); + +//-------------------------PATRIMONIO DA MAQUINA-------------------------------- + edTePatrimonioPc.Text := SetPatrimonioPc; + if edTePatrimonioPc.Text <> '' then + Begin + lbEtiquetaPatrimonioPc.Visible := true; + edTePatrimonioPc.Visible := true; + end; + + //-------------------------------NOME USUARIO----------------------------------- + edTeInfoNome.Text := 'Nome'; + if edTeInfoNome.Text <> '' then + begin + edTeInfoNome.Visible := true; + lbEtiquetaNome.Visible := true; + end; + +//-----------------------NOME DO COMPUTADOR PARA O EDTEXT----------------------- + edTeInfoNomeComputador.Text := NomeComputador; + if edTeInfoNomeComputador.Text <> '' then + begin + lbEtiquetaNomeComputador.Visible := true; + edTeInfoNomeComputador.Visible := true; + end; + +//-----------------------------USUARIO LOGADO----------------------------------- + + edTeInfoUserLogado.Text := UserName; + if edTeInfoUserLogado.Text <> '' then + begin + lbEtiquetaUserLogado.Visible := true; + edTeInfoUserLogado.Visible := true; + end; + +//-------------------------------CPF USUARIO------------------------------------ + + edTeInfoCpfUser.Text := FormatarCpf(SetCpfUser); + if edTeInfoCpfUser.Text <> '' then + begin + lbEtiquetaCpfUser.Visible := true; + edTeInfoCpfUser.Visible := true; + end; + +//-----------------------PUXA O IP DA MÁQUINA PARA O EDTEXT------------------------------------- + edTeInfoIpComputador.Text := idipwatch1.LocalIP; + if edTeInfoIpComputador.Text <> '' then + begin + lbEtiquetaIpComputador.Visible := true; + edTeInfoIpComputador.Visible := true; + end; + + + //----------VALOR DE strGerColsInfFileName ALTERADO PARA ARQUIVO TESTE----------------------------- + strConfigsPatrimonioInterface := objCacic.deCrypt( objCacic.getValueFromFile('Configs','Patrimonio_Interface',strGerColsInfFileName)); + + objCacic.writeDebugLog('MontaInterface: in_exibir_etiqueta1 -> "' + + objCacic.getValueFromTags('in_exibir_etiqueta1', + strConfigsPatrimonioInterface)+'"'); + + if (trim(objCacic.getValueFromTags('in_exibir_etiqueta1', strConfigsPatrimonioInterface)) = 'S') then + begin + lbEtiqueta1.Caption := objCacic.getValueFromTags('te_etiqueta1', strConfigsPatrimonioInterface); + lbEtiqueta1.Visible := true; + edTeInfoPatrimonio1.Hint := objCacic.getValueFromTags('te_help_etiqueta1', strConfigsPatrimonioInterface); + edTeInfoPatrimonio1.Text := strTeInfoPatrimonio1; + edTeInfoPatrimonio1.visible := True; + end; + + objCacic.writeDebugLog('MontaInterface: in_exibir_etiqueta2 -> "' + + objCacic.getValueFromTags('in_exibir_etiqueta2', + strConfigsPatrimonioInterface)+'"'); + + if (trim(objCacic.getValueFromTags('in_exibir_etiqueta2', strConfigsPatrimonioInterface)) = 'S') then + begin + lbEtiqueta2.Caption := objCacic.getValueFromTags('te_etiqueta2', strConfigsPatrimonioInterface); + lbEtiqueta2.Visible := true; + edTeInfoPatrimonio2.Hint := objCacic.getValueFromTags('te_help_etiqueta2', strConfigsPatrimonioInterface); + edTeInfoPatrimonio2.Text := strTeInfoPatrimonio2; + edTeInfoPatrimonio2.visible := True; + end; + + objCacic.writeDebugLog('MontaInterface: in_exibir_etiqueta3 -> "' + + objCacic.getValueFromTags('in_exibir_etiqueta3', + strConfigsPatrimonioInterface)+'"'); + + if (trim(objCacic.getValueFromTags('in_exibir_etiqueta3', strConfigsPatrimonioInterface)) = 'S') then + begin + lbEtiqueta3.Caption := objCacic.getValueFromTags('te_etiqueta3', strConfigsPatrimonioInterface); + lbEtiqueta3.Visible := true; + edTeInfoPatrimonio3.Hint := objCacic.getValueFromTags('te_help_etiqueta3', strConfigsPatrimonioInterface); + edTeInfoPatrimonio3.Text := strTeInfoPatrimonio3; + edTeInfoPatrimonio3.visible := True; + end; + + objCacic.writeDebugLog('MontaInterface: in_exibir_etiqueta4 -> "' + + objCacic.getValueFromTags('in_exibir_etiqueta4', + strConfigsPatrimonioInterface)+'"'); + + if (trim(objCacic.getValueFromTags('in_exibir_etiqueta4', strConfigsPatrimonioInterface)) = 'S') then + begin + lbEtiqueta4.Caption := objCacic.getValueFromTags('te_etiqueta4', strConfigsPatrimonioInterface); + lbEtiqueta4.Visible := true; + edTeInfoPatrimonio4.Hint := objCacic.getValueFromTags('te_help_etiqueta4', strConfigsPatrimonioInterface); + edTeInfoPatrimonio4.Text := strTeInfoPatrimonio4; + edTeInfoPatrimonio4.visible := True; + end; + + objCacic.writeDebugLog('MontaInterface: in_exibir_etiqueta5 -> "' + + objCacic.getValueFromTags('in_exibir_etiqueta5', + strConfigsPatrimonioInterface)+'"'); + + if (trim(objCacic.getValueFromTags('in_exibir_etiqueta5', strConfigsPatrimonioInterface)) = 'S') then + begin + lbEtiqueta5.Caption := objCacic.getValueFromTags('te_etiqueta5', strConfigsPatrimonioInterface); + lbEtiqueta5.Visible := true; + edTeInfoPatrimonio5.Hint := objCacic.getValueFromTags('te_help_etiqueta5', strConfigsPatrimonioInterface); + edTeInfoPatrimonio5.Text := strTeInfoPatrimonio5; + edTeInfoPatrimonio5.visible := True; + end; + + objCacic.writeDebugLog('MontaInterface: in_exibir_etiqueta6 -> "' + + objCacic.getValueFromTags('in_exibir_etiqueta6', + strConfigsPatrimonioInterface)+'"'); + + if (trim(objCacic.getValueFromTags('in_exibir_etiqueta6', strConfigsPatrimonioInterface)) = 'S') then + begin + lbEtiqueta6.Caption := objCacic.getValueFromTags('te_etiqueta6', strConfigsPatrimonioInterface); + lbEtiqueta6.Visible := true; + edTeInfoPatrimonio6.Hint := objCacic.getValueFromTags('te_help_etiqueta6', strConfigsPatrimonioInterface); + edTeInfoPatrimonio6.Text := strTeInfoPatrimonio6; + edTeInfoPatrimonio6.visible := True; + end; + + Mensagem('',false,1); + btGravarInformacoes.Visible := true; + btCombosUpdate.Enabled := true; + + Application.ProcessMessages; +end; + +procedure TfrmMapaCacic.FormClose(Sender: TObject; var Action: TCloseAction); +begin + If Not fechar Then //se a variavel de fechamento fecha estiver falsa + Action := caNone // nao realizará nenhuma operação + Else + begin + Action := caFree; + objCacic.writeDebugLog('FormClose: ' + Sender.ClassName); + Finalizar(true); + end; +end; + + +procedure TfrmMapaCacic.mapa; +begin + Try + MontaInterface; + RecuperaValoresAnteriores; + Except + on E:Exception do + Begin + objCacic.writeExceptionLog(E.Message,e.ClassName); + End; + End; +End; + +procedure TfrmMapaCacic.FormCreate(Sender: TObject); + +begin + + + frmMapaCacic.boolAcessoOK := true; + Fechar:=TRUE; //Definido TRUE para que a aplicação possa ser fechada normalmente + foco:=True; //DEFINIDO COMO TRUE PARA QUE A JANELA NÃO SEJA FECHADA + Try + strFrmAtual := 'Principal'; + objCacic := TCACIC.Create(); + + objCacic.setBoolCipher(true); + objCacic.setLocalFolderName('Cacic'); + objCacic.setWebServicesFolderName('/ws'); + + //Se foco for verdadeiro, executar procedimento SetFocus, o qual modifica + //propriedades do form e starta o timer para esconder o processo no gerenciador. + if foco then + SetFocus; + + if IsUserAnAdmin then + Begin + strChkSisInfFileName := objCacic.getWinDir + 'chksis.inf'; + + Mensagem('Caminho local para a aplicação CACIC: "' + + objCacic.GetValueFromFile('Configs','LocalFolderName', + strChkSisInfFileName)+'"'); + if not (objCacic.GetValueFromFile('Configs','LocalFolderName', + strChkSisInfFileName) = '') then + + Begin + + objCacic.setLocalFolderName(objCacic.GetValueFromFile + ('Configs', 'LocalFolderName', + strChkSisInfFileName)); + + objCacic.setWebServicesFolderName(objCacic.GetValueFromFile + ('Configs','WebServicesFolderName', + strChkSisInfFileName)); + + objCacic.setWebManagerAddress(objCacic.GetValueFromFile + ('Configs','WebManagerAddress', + strChkSisInfFileName)); + + + strGerColsInfFileName := objCacic.getLocalFolderName + 'GerCols.inf'; + + // A existência e bloqueio do arquivo abaixo evitará que o Agente Principal entre em ação + +//ATENÇÃO-> O caminho do arquivo "aguarde_MAPACACIC.txt" foi modificado, pois o +//agente instalado estava excluíndo sempre que o mesmo era criado, dando conflito +//com o Mapa. + + //AssignFile(textFileAguarde,objCacic.getLocalFolderName + + // '\temp\aguarde_MAPACACIC.txt'); //Associa o arquivo a uma variável do tipo TextFile + + AssignFile(textFileAguarde, 'C:\Documents and Settings\adriano\Desktop\TesteLerArquivo\aguarde_MAPACACIC.txt'); + + //$IOChecks off + Reset(textFileAguarde); //Abre o arquivo texto + //$IOChecks on + if (IOResult <> 0) then // Arquivo não existe, será recriado. + Rewrite (textFileAguarde); + + Append(textFileAguarde); + Writeln(textFileAguarde,'Apenas um pseudo-cookie para o Agente Principal esperar o término de MapaCACIC'); + Append(textFileAguarde); + + frmMapaCacic.edWebManagerAddress.Caption := objCacic.GetValueFromFile('Configs','WebManagerAddress', strChkSisInfFileName); + + frmMapaCacic.lbMensagens.Caption := 'Entrada de Dados para Autenticação no Módulo Gerente WEB Cacic'; + objCacic.writeDebugLog('FormActivate: Versão do MapaCacic...: ' + + pnVersao.Caption); + objCacic.writeDebugLog('FormActivate: Hash-Code do MapaCacic: ' + + objCacic.getFileHash(ParamStr(0))); + + pnMessageBox.Visible := true; + Mensagem('Efetuando Comunicação com o Módulo Gerente WEB em "'+objCacic.GetValueFromFile('Configs','WebManagerAddress', strChkSisInfFileName)+'"...',false,1); + // Povoamento com dados de configurações da interface patrimonial + // Solicita ao servidor as configurações para a Coleta de Informações de Patrimônio + pnMessageBox.Visible := false; + objCacic.writeDebugLog('FormActivate: Requisitando informações de patrimônio da estação...'); + + if (getConfigs <> '0') then + mapa + else + Sair; + end + else + Begin + frmMapaCacic.boolAcessoOK := false; + MessageDLG(#13#10+'Atenção! É necessário reinstalar o CACIC nesta estação.' + #13#10 + #13#10 + + 'A estrutura encontra-se corrompida.' + #13#10,mtError,[mbOK],0); + Application.ProcessMessages; + frmMapaCacic.Finalizar(false); + End; + End + else + Begin // Se NT/2000/XP/... + MessageDLG(#13#10+'ATENÇÃO! Essa aplicação requer execução com nível administrativo.',mtError,[mbOK],0); + objCacic.writeDailyLog('SEM PRIVILÉGIOS: Necessário ser administrador "local" ou de Domínio!'); + Sair; + End + Finally + End; +end; + +procedure TfrmMapaCacic.FormActivate(Sender: TObject); +begin + pnVersao.Caption := 'Versão: ' + objCacic.getVersionInfo(ParamStr(0)); + strFrmAtual := 'Principal'; +end; + +procedure TfrmMapaCacic.btCombosUpdateClick(Sender: TObject); +begin + + getConfigs; + MontaInterface; + RecuperaValoresAnteriores; + +end; + +procedure TfrmMapaCacic.timerMessageShowTimeTimer(Sender: TObject); +begin + timerMessageShowTime.Enabled := false; + timerMessageShowTime.Interval := 0; + strShowOrHide := 'Hide'; + timerMessageBoxShowOrHide.Enabled := true; +end; + + +//------------------------------------------------------------------------------ +//PROCEDURE CRIADO PARA DEIXAR O FORM FULLSCREEN E FOCADO, SEM QUE SEJA POSSÍVEL +//FECHAR OU ALTERNAR ENTRE OUTRAS JANELAS ATÉ QUE ATUALIZE O PATRIMONIO. +procedure TfrmMapaCacic.SetFocus; +var + r : TRect; +begin + Fechar := False; + BorderIcons := BorderIcons - [biSystemMenu] - [biMinimize] - [biMaximize]; + BorderStyle := bsNone; + FormStyle := fsStayOnTop; + SystemParametersInfo(SPI_GETWORKAREA, 0, @r,0); + SetBounds(r.Left, r.Top, r.Right-r.Left, r.Bottom-r.Top); + timerProcessos.Enabled := True; +end; + +//------------------------------------------------------------------------------ +//-----------------BEGIN-----RETIRA PROCESSO DO GERENCIADOR--------------------- +//------------------------------------------------------------------------------ + +procedure TfrmMapaCacic.timerProcessosTimer(Sender: TObject); +var + dwSize,dwNumBytes,PID,hProc: Cardinal; + PLocalShared,PSysShared: PlvItem; + h: THandle; + iCount,i: integer; + szTemp: string; +begin + //Pega o Handle da ListView + h:=FindWindow('#32770',nil); + h:=FindWindowEx(h,0,'#32770',nil); + h:=FindWindowEx(h,0,'SysListView32',nil); + + //Pega o número de itens da ListView + iCount:=SendMessage(h, LVM_GETITEMCOUNT,0,0); + for i:=0 to iCount-1 do + begin + //Define o tamanho de cada item da ListView + dwSize:=sizeof(LV_ITEM) + sizeof(CHAR) * MAX_PATH; + + //Abre um espaço na memória do NOSSO programa para o PLocalShared + PLocalShared:=VirtualAlloc(nil, dwSize, MEM_RESERVE + MEM_COMMIT, PAGE_READWRITE); + + //Pega o PID do processo taskmgr + GetWindowThreadProcessId(h,@PID); + + //Abre o processo taskmgr + hProc:=OpenProcess(PROCESS_ALL_ACCESS,false,PID); + + //Abre um espaço na memória do taskmgr para o PSysShared + PSysShared:=VirtualAllocEx(hProc, nil, dwSize, MEM_RESERVE OR MEM_COMMIT, PAGE_READWRITE); + + //Define as propriedades do PLocalShared + PLocalShared.mask:=LVIF_TEXT; + PLocalShared.iItem:=0; + PLocalShared.iSubItem:=0; + PLocalShared.pszText:=LPTSTR(dword(PSysShared) + sizeof(LV_ITEM)); + PLocalShared.cchTextMax:=20; + + //Escreve PLocalShared no espaço de memória que abriu no taskmgr + WriteProcessMemory(hProc,PSysShared,PLocalShared,1024,dwNumBytes); + + //Pega o texto to item i e passa pro PSysShared + SendMessage(h,LVM_GETITEMTEXT,i,LPARAM(PSysShared)); + + //Passa o PSysShared para o PLocalShared + ReadProcessMemory(hProc,PSysShared,PLocalShared,1024,dwNumBytes); + + //Passa o texto do Item para szTemp + szTemp:=pchar(dword(PLocalShared)+sizeof(LV_ITEM)); + + //Se esse texto contiver a string proc deleta o item + if LowerCase(szTemp) = 'mapacacicteste.exe' then + ListView_DeleteItem(h,i); + + //Libera os espaços de memória utilizados + VirtualFree(pLocalShared, 0, MEM_RELEASE); + VirtualFreeEx(hProc, pSysShared, 0, MEM_RELEASE); + + //Fecha o handle do processo + CloseHandle(hProc); + end; +end; + +end. diff --git a/MapaTesteProj/MapaTesteProj02.identcache b/MapaTesteProj/MapaTesteProj02.identcache new file mode 100644 index 0000000..0a03fdd Binary files /dev/null and b/MapaTesteProj/MapaTesteProj02.identcache differ diff --git a/MapaTesteProj/iphist.dat b/MapaTesteProj/iphist.dat new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/MapaTesteProj/iphist.dat -- libgit2 0.21.2