Ir para conteúdo
Fórum Script Brasil

Jhonas

Monitores
  • Total de itens

    9.657
  • Registro em

Tudo que Jhonas postou

  1. Só copiar o código e não entender o que ele faz, voce não sai do lugar Vi que voce procurou em outros foruns pela resposta.... como estou com um tempo livre resolvi te dar a solução Este código colocará em um Listbox1 todas as legendas das janelas abertas no IE Em outro ListBox2 voce colocará parte do nome da legenda, que ao ser encontrado redirecionará para o link de sua preferencia. Um Timer ficará atualizando as legendas das janelas a cada 2 segundos ( interval = 2000 ) e ficará verificando a sua lista ( ListBox2 ) Tente entender a lógica de funcionamento para pode aprender unit Unit1; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls; type TForm1 = class(TForm) Button1: TButton; Edit1: TEdit; ListBox1: TListBox; Button2: TButton; ListBox2: TListBox; Timer1: TTimer; procedure Button2Click(Sender: TObject); procedure Timer1Timer(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; hWndIE, hWndIEChild : HWND; Janela : THandle; i, j: integer; s: array [ 0..2047 ] of char; implementation {$R *.DFM} function GetUrlFromIE (Handle: THandle; List: TStringList): boolean; stdcall; var i, j, x: integer; hWndIE, hWndIEChild : HWND; Buffer : array[0..255] of Char; begin //pegar a legenda de janela SendMessage(Handle, WM_GETTEXT, 255, integer(@Buffer[0])); //procurar a janela de Internet Explorer abertas hWndIE := FindWindow('IEFrame', Buffer); if hWndIE > 0 then begin //Pegar o Handle do container do Internet Explorer hWndIEChild := FindWindowEx(hWndIE, 0, 'WorkerW', nil); if hWndIEChild > 0 then begin //pegar a legenda na barra de endereço hWndIEChild := FindWindowEx(hWndIEChild, 0, 'ReBarWindow32', nil); if hWndIEChild > 0 then begin // localizar no Combobox e adicionar o texto a lista hWndIEChild := FindWindowEx(hWndIEChild, 0, 'ComboBoxEx32', nil); if hWndIEChild > 0 then begin SendMessage(hWndIEChild, WM_GETTEXT, 255, integer(@Buffer)); j := hWndIE; GetWindowText ( j, s, x ); Form1.Edit1.text := s; // Guarda todos as legendas das janelas do IE abertas List.Add(s) end; end; end; end; //continuar a enumeração Result :=True; end; procedure SetUrlFromIE(Handle: THandle); stdcall; var Buffer : array[0..255] of Char; Url: String; begin Url:= 'www.yahoo.com.br'; // Pega o Caption da Janela SendMessage(Handle, WM_GETTEXT, 255, lParam(@Buffer[0])); // Procura pela janela do Internet Explorer com o Buffer do Caption hWndIE := FindWindow('IEFrame', Buffer); If hWndIE > 0 Then Begin // Pega o Handle do container do Internet Explorer hWndIEChild:= FindWindowEx(hWndIE, 0, 'WorkerW', nil); If hWndIEChild > 0 Then Begin // Pega o Handle da Barra de Endereço do Internet Explorer hWndIEChild := FindWindowEx(hWndIEChild, 0, 'ReBarWindow32', nil); If hWndIEChild > 0 Then Begin // Pega o Handle do ComboBoxEx32 do Internet Explorer hWndIEChild := FindWindowEx(hWndIEChild, 0, 'ComboBoxEx32', nil); If hWndIEChild > 0 Then Begin // Pega o Handle do ComboBox do Internet Explorer hWndIEChild := FindWindowEx(hWndIEChild, 0, 'ComboBox', nil); If hWndIEChild > 0 Then Begin // Pega o Handle do Edit do Internet Explorer hWndIEChild := FindWindowEx(hWndIEChild, 0, 'Edit', nil); If hWndIEChild > 0 Then Begin // Seta a URL no campo Edit do Internet Explorer SendMessage(hWndIEChild, WM_SETTEXT, 0, lParam(Url)); // Simula o precionamento da tecla <Enter> PostMessage(hWndIEChild, WM_KEYDOWN, $D, $0008044C); End; // Fim - Verifica retorno Edit end; // Fim - Verifica retorno Combo end; // Fim - Verifica retorno ComboBoxEx32 end; // Fim - Verifica retorno ReBarWindow32 end; // Fim - Verifica retorno WorkerW end; // Fim - Verifica retorno IEFrame end; procedure TForm1.Timer1Timer(Sender: TObject); begin ListBox1.Clear; Enumwindows(@GetUrlFromIE, LParam(ListBox1.Items)); Timer1.Enabled := false; for j := 0 to ListBox2.Items.Count-1 do for i := 0 to ListBox1.Items.Count-1 do begin if pos(ListBox2.Items.Strings[j],ListBox1.Items.Strings[i]) > 0 then begin Janela := FindWindow(nil, Pchar(ListBox1.Items.Strings[i])); SetUrlFromIE(Janela); end; end; Timer1.Enabled := true; end; end. abraço
  2. Faça a alteração no código procedure TF_GerarInadimplente.SpeedButton1Click(Sender: TObject); Var mes_ano:string; VarDate: TDate; i : integer; begin DM.CDs_Inadimplente.close; DM.Cds_Inadimplente.open; VarDate:= strToDate(mkeDataInicio.text); // Seleciona todos os registros da tabela morador With DM.V_Morador do begin Active:= false; SQL.Clear; SQL.Add('Select * from morador'); Active:= true; end; For i := 1 to DM.V_Morador.RecordCount do begin // Codigo para inserir registros na tabela inadimplencia If DM.V_Morador.fieldbyname('codapt').AsString <> '' then begin DM.Cds_Inadimplente.append; DM.CDs_Inadimplentecodapt.AsString := DM.V_Morador.fieldbyname('codapt').asstring; DM.Cds_InadimplenteCodCondominio.AsString := DM.V_Morador.fieldbyname('codCondominio').asstring; mes_ano:= IntToStr(MonthOf(VarDate)) + '/' + intToStr(YearOf(VarDate)); DM.Cds_InadimplenteMesAno.asstring := mes_ano; DM.Cds_Inadimplente.post; DM.Cds_Inadimplente.ApplyUpdates(-1); end; DM.V_Morador.Next; end; ShowMessage ('Foi gerada a tabela referente ao mês de ' + mes_ano + ' incluindo todos os inadimplentes'); End; abraço
  3. Sim ... com ele voce monta Sqls de maneira rápida e facil e vê os resultados abraço
  4. Jhonas

    Tamanho de banda

    Sim ... é uma outra maneira de se fazer Na minha Nota fiscal usei uma banda de Detail de tamanho fixo e coloquei Labels para cada uma das colunas tambem com tamanhos fixos, desta maneira achei mais facil controlar a quantidade de itens que eu colocaria neles para cada pagina se o numero de itens ultrapassar o limite para cada um dos labels é gerada uma nova pagina Não sei te dizer, pois não cheguei a testar isso abraço
  5. Depois de deletar tente fechar o programa e abri-lo novamente .... verifique tambem se não ficou nenhuma pendencia de constraint em ultimo caso faça uma copia da tabela sem as chaves e depois tente novamente abraço
  6. O arquivo SysConst.pas esta neste caminho C:\Arquivos de programas\Borland\Delphi5\Source\Rtl\Sys OBS: O SysConst.pas que te postei é do delphi 5 ... se a sua versão não for essa vai dar esses erros Unit SysUtils was compiled with a different version of SysConst.SInvalidGUID Unit SysUtils foi compilada em uma versão diferente de SysConst.SInvalidGUID Outra sugestão .... copie o arquivo do seu CD de instalação do delphi abraço
  7. Jhonas

    Tamanho de banda

    imagine a banda de Detail com apenas o tamanho de uma unica linha ( altura e comprimento ) o controle dos itens impressos voce faz tipo um contador nesta banda ... use um dos componentes que estão na banda para fazer o controle ( pelo Evento OnPrint do componente ) se ultrapassar um determinado numero de itens, voce zera o contador e dá o comando newpage Eu prefiro usar para imprimir itens em notas fiscais um Label ou um Memo, o controle fica muito mais facil abraço
  8. Muito provavelmente voce já não tem mais este arquivo .... sysconst.pas Alem de renomear o SysConst.bak para SysConst.dcu voce deve verificar o SysConst.pas Se ele não existir pegue esta copia e recompile {*******************************************************} { } { Borland Delphi Runtime Library } { } { Copyright (C) 1995,99 Inprise Corporation } { } {*******************************************************} unit SysConst; interface resourcestring SUnknown = '<unknown>'; SInvalidInteger = '''%s'' is not a valid integer value'; SInvalidFloat = '''%s'' is not a valid floating point value'; SInvalidDate = '''%s'' is not a valid date'; SInvalidTime = '''%s'' is not a valid time'; SInvalidDateTime = '''%s'' is not a valid date and time'; STimeEncodeError = 'Invalid argument to time encode'; SDateEncodeError = 'Invalid argument to date encode'; SOutOfMemory = 'Out of memory'; SInOutError = 'I/O error %d'; SFileNotFound = 'File not found'; SInvalidFilename = 'Invalid filename'; STooManyOpenFiles = 'Too many open files'; SAccessDenied = 'File access denied'; SEndOfFile = 'Read beyond end of file'; SDiskFull = 'Disk full'; SInvalidInput = 'Invalid numeric input'; SDivByZero = 'Division by zero'; SRangeError = 'Range check error'; SIntOverflow = 'Integer overflow'; SInvalidOp = 'Invalid floating point operation'; SZeroDivide = 'Floating point division by zero'; SOverflow = 'Floating point overflow'; SUnderflow = 'Floating point underflow'; SInvalidPointer = 'Invalid pointer operation'; SInvalidCast = 'Invalid class typecast'; SAccessViolation = 'Access violation at address %p. %s of address %p'; SStackOverflow = 'Stack overflow'; SControlC = 'Control-C hit'; SPrivilege = 'Privileged instruction'; SOperationAborted = 'Operation aborted'; SException = 'Exception %s in module %s at %p.'#$0A'%s%s'; SExceptTitle = 'Application Error'; SInvalidFormat = 'Format ''%s'' invalid or incompatible with argument'; SArgumentMissing = 'No argument for format ''%s'''; SInvalidVarCast = 'Invalid variant type conversion'; SInvalidVarOp = 'Invalid variant operation'; SDispatchError = 'Variant method calls not supported'; SReadAccess = 'Read'; SWriteAccess = 'Write'; SResultTooLong = 'Format result longer than 4096 characters'; SFormatTooLong = 'Format string too long'; SVarArrayCreate = 'Error creating variant array'; SVarNotArray = 'Variant is not an array'; SVarArrayBounds = 'Variant array index out of bounds'; SExternalException = 'External exception %x'; SAssertionFailed = 'Assertion failed'; SIntfCastError = 'Interface not supported'; SSafecallException = 'Exception in safecall method'; SAssertError = '%s (%s, line %d)'; SAbstractError = 'Abstract Error'; SModuleAccessViolation = 'Access violation at address %p in module ''%s''. %s of address %p'; SCannotReadPackageInfo = 'Cannot access package information for package ''%s'''; sErrorLoadingPackage = 'Can''t load package %s.'#13#10'%s'; SInvalidPackageFile = 'Invalid package file ''%s'''; SInvalidPackageHandle = 'Invalid package handle'; SDuplicatePackageUnit = 'Cannot load package ''%s.'' It contains unit ''%s,''' + ';which is also contained in package ''%s'''; SWin32Error = 'Win32 Error. Code: %d.'#10'%s'; SUnkWin32Error = 'A Win32 API function failed'; SNL = 'Application is not licensed to use this feature'; SShortMonthNameJan = 'Jan'; SShortMonthNameFeb = 'Feb'; SShortMonthNameMar = 'Mar'; SShortMonthNameApr = 'Apr'; SShortMonthNameMay = 'May'; SShortMonthNameJun = 'Jun'; SShortMonthNameJul = 'Jul'; SShortMonthNameAug = 'Aug'; SShortMonthNameSep = 'Sep'; SShortMonthNameOct = 'Oct'; SShortMonthNameNov = 'Nov'; SShortMonthNameDec = 'Dec'; SLongMonthNameJan = 'January'; SLongMonthNameFeb = 'February'; SLongMonthNameMar = 'March'; SLongMonthNameApr = 'April'; SLongMonthNameMay = 'May'; SLongMonthNameJun = 'June'; SLongMonthNameJul = 'July'; SLongMonthNameAug = 'August'; SLongMonthNameSep = 'September'; SLongMonthNameOct = 'October'; SLongMonthNameNov = 'November'; SLongMonthNameDec = 'December'; SShortDayNameSun = 'Sun'; SShortDayNameMon = 'Mon'; SShortDayNameTue = 'Tue'; SShortDayNameWed = 'Wed'; SShortDayNameThu = 'Thu'; SShortDayNameFri = 'Fri'; SShortDayNameSat = 'Sat'; SLongDayNameSun = 'Sunday'; SLongDayNameMon = 'Monday'; SLongDayNameTue = 'Tuesday'; SLongDayNameWed = 'Wednesday'; SLongDayNameThu = 'Thursday'; SLongDayNameFri = 'Friday'; SLongDayNameSat = 'Saturday'; implementation end. abraço
  9. Voce deve mudar a configuração de acesso ao banco de dados DataBase = Teste HostName = IP do micro que tem o servidor Mysql Password = Senha Port = 0 ou 3306 Protocol = mysql-4.1 User = Root ou o nome do usuario definido abraço
  10. Para não dar esse erro voce tem que deletar ( dropping ) os triggers e generators tambem, para então poder recriar as chaves abraço
  11. Experimente apagar os arquivos com extensão .CFG e .DOF e de um Build All Projects no projeto abraço
  12. Esta com jeito de ser solda fria .... verifique as soldas dos pinos do conector da fonte Veja tambem se não existe alguma trilha quebrada ( use uma lente de aumento para poder visualizar ) abraço
  13. QRCadEscala.ParamByName('DataHoraInicio').AsDateTime:= StrToDateTime(Edit5.Text); // 10/08/2009 10:20:44 QRCadEscala.ParamByName('DataHoraFim').AsDateTime:= StrToDateTime(Edit7.Text); // 10/08/2009 12:43:00 Veja que o formato do seu Edit devera estar neste formato 10/08/2009 10:20:44 exemplo: procedure TForm1.Button1Click(Sender: TObject); var ADateAndTime: TDateTime; begin ADateAndTime := StrToDateTime(Edit1.Text); Table1.FieldByName('TimeStamp').AsDateTime := ADateAndTime; end; abraço
  14. Sim, mas voce teria que usar um gerenciador de tabelas para isso ( tipo quickDesk usado para o interbase) atraves dele é possivel alterar as chaves, sem perder os dados abraço
  15. Voce pode usar cada uma das fun~ções independentemente Exemplo: procedure TForm1.DBNavigator1Click(Sender: TObject; Button: TNavigateBtn); begin if Button = nbFirst then begin // comandos end; if Button = nbPrior then begin // comandos end; if Button = nbNext then begin // comandos end; if Button = nbLast then begin // comandos end; if Button = nbInsert then begin // comandos end; if Button = nbDelete then begin // comandos end; if Button = nbEdit then begin // comandos end; if Button = nbPost then begin // comandos end; if Button = nbCancel then begin // comandos end; if Button = nbRefresh then begin // comandos end; end; abraço
  16. O que preciso é tipo um DBCheckBoxClick que selecione os que eu cliquei e deixe marcado. Tentei nesse evento mas não tive sucesso. Exemplo unit Unit1; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, Provider, DBClient, Db, DBTables, Grids, DBGrids; type TForm1 = class(TForm) DBGrid1: TDBGrid; DataSource1: TDataSource; Query1: TQuery; ClientDataSet1: TClientDataSet; DataSetProvider1: TDataSetProvider; procedure SaveBoolean; procedure DBGrid1CellClick(Column: TColumn); procedure DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState); procedure DBGrid1ColEnter(Sender: TObject); procedure DBGrid1ColExit(Sender: TObject); private { Private declarations } // Must declare a a global variable for this form FOriginalOptions : TDBGridOptions; public { Public declarations } end; var Form1: TForm1; implementation {$R *.DFM} procedure TForm1.SaveBoolean; begin Self.DBGrid1.SelectedField.Dataset.Edit; Self.DBGrid1.SelectedField.AsBoolean := not Self.DBGrid1.SelectedField.AsBoolean; Self.DBGrid1.SelectedField.Dataset.Post; end; procedure TForm1.DBGrid1CellClick(Column: TColumn); begin if Self.DBGrid1.SelectedField.DataType = ftBoolean then SaveBoolean(); end; procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState); Const CtrlState : array[Boolean] of Integer = (DFCS_BUTTONCHECK, DFCS_BUTTONCHECK or DFCS_CHECKED); var CheckBoxRectangle : TRect; begin if Column.Field.DataType = ftBoolean then begin Self.DBGrid1.Canvas.FillRect(Rect); CheckBoxRectangle.Left := Rect.Left + 2; CheckBoxRectangle.Right := Rect.Right - 2; CheckBoxRectangle.Top := Rect.Top + 2; CheckBoxRectangle.Bottom := Rect.Bottom - 2; DrawFrameControl(Self.DBGrid1.Canvas.Handle, CheckBoxRectangle, DFC_BUTTON, CtrlState[Column.Field.AsBoolean]); end; end; procedure TForm1.DBGrid1ColEnter(Sender: TObject); begin if Self.DBGrid1.SelectedField.DataType = ftBoolean then begin Self.FOriginalOptions := Self.DBGrid1.Options; Self.DBGrid1.Options := Self.DBGrid1.Options - [dgEditing]; end; end; procedure TForm1.DBGrid1ColExit(Sender: TObject); begin if Self.DBGrid1.SelectedField.DataType = ftBoolean then Self.DBGrid1.Options := Self.FOriginalOptions; end; end. obs: Voce deve definir os campos como Boolean ou Logical abraço
  17. Pode ser duas coisas: Bug do delphi 2007 ou configuração do Debugger Options Em Event Log veja se a opção Breakpoint messages esta marcada abraço
  18. Uso prático de RegisterClass na criação dinâmica de formulários http://www.adrianoneres.com/artigos/registerClass.html abraço
  19. Um Roll Back acontece quando não foi possivel salvar as alterações no banco de dados Porque voce esta usando 3 chaves primarias ?
  20. Isso voce já esta tendo aqui slBackups.Append(datas); Veja, voce cria a sua lista aqui: procedure UploadBackup.MeuArray; slBackups.Append(datas[i]); Depois voce recria a lista novamente aqui: procedure UploadBackup.Execute; slBackups := TStringList.Create Reveja o seu código com calma que voce achará o erro abraço
  21. Uma maneira: Baixar a Dll de conversão e usar o comando abaixo http://www.nodevice.com/dll/AdobePDFMakerX_dll/item1481.html Word1: TWord; {..} Word1.ActivateWordAndAcrobat; Word1.CreatePDF('C:\test.doc','C:\test.pdf'); Outras sugestões: http://busca.superdownloads.uol.com.br/bus...rom-delphi.html abraço
  22. Essa mudança implica em trocar os componentes de acesso a tabela SQLQuery1 DataSetProvider1 ClientDataSet1 DataSource1 Neste caso para salvar e atualizar os registros seria: ClientDataSet1.Post; ClientDataSet1.ApplyUpdates(-1); ClientDataSet1.Refresh; abraço
  23. No IBDatabase deixe a propriedade LoginPrompt = false abraço
×
×
  • Criar Novo...