Principal
Pesquisa na Web
Google
Data/Hora
Entrar
Siga-me no Tweeter
RSS Feed

Linguagem de Programação - Descendente do Pascal
(1) 2 3 4 5 »
Delphi : Capturar Instâncias - Delphi
em 1/10/2009 17:20:00 (46 leituras)

procedure TFrmInstan.btnOkClick(Sender: TObject);
var
hHandle : THandle;
WinName, WinClass : array[0..255] of Char;

begin
hHandle := FindWindow( nil, 'Nome Programa - Versão 1.0'); <<-- Nome inteiro do Caption
GetClassName(hHandle, WinClass, SizeOf(WinName) - 1); <<-- Retorna a instancia do Application
GetWindowText(HWND(WindowList1[x]), WinName, SizeOf(WinName) - 1);<<-- Retorna o Caption do Application

// Handle é o número do programa no windows.
ShowMessage(GetText(hHandle)); <<-- Retorna o Nome inteiro do Caption
if IsWindowVisible(hHandle) then
ShowMessage('Visível')
else
ShowMessage('Droga')
end;

function GetText(WinHandle: THandle): string;
var
P: array[0..256] of Char;
begin
P[0] := #0;
GetWindowText(WinHandle, P, 255);
if P[0] = #0 then Result := ''
else
Result := P;
end;

Rating: 0.00 (0 votes) - Rate this News - Comments?
Delphi : Travar Teclado - Delphi
em 28/9/2009 10:20:00 (61 leituras)

procedure BlockInput(ABlockInput : boolean); stdcall; external 'USER32.DLL';
...
procedure TForm1.Button1Click(Sender: TObject);
begin
BlockInput(True);
Sleep(5000);
BlockInput(False);
end;

For more
Win32 Programmer's Reference

Rating: 0.00 (0 votes) - Rate this News - Comments?
Delphi : WinMerge com Jedi VCS
em 27/8/2009 22:00:00 (63 leituras)

/silent /fv %1 %2

Rating: 0.00 (0 votes) - Rate this News - Comments?
Delphi : Colorir Linhas do TRichEdit
em 24/8/2009 20:00:00 (42 leituras)

procedure Tfrm.btn1Click(Sender: TObject);
begin
// Código comentado lança padrão sobre o Rich
// RichEdit1.DefAttributes.Color := clBlue;
// RichEdit1.DefAttributes.Style := [fsBold, fsItalic];

RichEdit1.Lines.Add('sadasdasdasda');
RichEdit1.Lines.Add('sadasdasdasda');
RichEdit1.Lines.Add('sadasdasdasda');
RichEdit1.Lines.Add('sadasdasdasda');
with RichEdit1.SelAttributes do
begin
Color := clRed; // Cor da Fonte
Height := Height + 5; // Tamanho da Fonte
end;
RichEdit1.Lines.Add('Esta linha será vermelha.');
end;

Rating: 0.00 (0 votes) - Rate this News - Comments?
Delphi : Database recovery for Interbase and Firebird
em 17/4/2009 8:50:00 (62 leituras)

Database recovery for Interbase and Firebird
Backing up your Interbase or Firebird Server is standard practice, but without a proven recovery process, the backup might be useless.

Use this checklist to get started:
Never copy a database file on file system level if the server has write access to the database file. This might result in physical database file errors in the copied file and also in the original database file
Always use gbak to create a serverbased backup file of your database. The result file can be copied wherever you need it
Firebird allows to use nbackup to improve the speed for large databases, but since it sometimes needs more space than required, it should only be used with large database files with few changes, for example larger than 50GB
Depending on the speed of the server and the used IB/FB version, the backup process takes only a few minutes per gigabyte, so in most cases a full backup using gbak is recommended
A backup file should always be tested in the restore process, since there are different possible database errors, that are not shown while the backup process is running, but it prevents a successful restore
To minimize lost data in case of a failure, a database backup can also be made several times per day. The multigenerational architecture of IB/FB allows to run a backup while all users are connected
If the backup takes for example just 5 minutes, you can schedule an hourly backup to be sure that only data might be lost within the last hour before the crash
We recommend to restore your database right after the backup on a seperate server, which can be used from all clients in case of a failure of the main server immediatly
Be prepared for the case that your server has an unrecoverable error and no experienced admin is available to restore the environment on a replacement server. You can set up a backup database server with two network interface cards, where the second disconnected interface card uses the same IP as you regular server. When the main server operates without problems, it is not connected to the network, so there is no conflict and the backup/restore process uses the first network interface card. When the main server crashes, you just have to switch the network cable from the main server to the backup server and all clients can use the backupserver using the same IP based connection string
Do not rely only on the RAID technology, we have received several databases from customers, that were the result of a RAID system failure, for example two disks crashed at the same time. Sometimes a simple harddisk is more reliable
Always check if the backup was done successfully, for example by sending the log file per e-mail in case of an error
The use of a database shadow on an external usb drive is another way to improve the recovery time

Rating: 0.00 (0 votes) - Rate this News - Comments?
(1) 2 3 4 5 »
Clima Portal