Arsip: Mo coba bwat program sederhana ......

 
user image
more 19 years ago

cyber_hecker

program tutorial 6 - get windows, system, program files directory and execute program kode lengkap :
unit Unit1;
interface
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls;
type
  TForm1 = class(TForm)
    Button1: TButton;
    RadioGroup1: TRadioGroup;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
var
  Form1: TForm1;
implementation
{$R *.dfm}
uses Registry;
function GetRegistryData(RootKey: HKEY; Key, Value: string): variant;
var
  Reg: TRegistry;
  RegDataType: TRegDataType;
  DataSize, Len: integer;
  s: string;
label cantread;
begin
  Reg := nil;
  try
    Reg := TRegistry.Create(KEY_QUERY_VALUE);
    Reg.RootKey := RootKey;
    if Reg.OpenKeyReadOnly(Key) then begin
      try
        RegDataType := Reg.GetDataType(Value);
        if (RegDataType = rdString) or
           (RegDataType = rdExpandString) then
          Result := Reg.ReadString(Value)
        else if RegDataType = rdInteger then
          Result := Reg.ReadInteger(Value)
        else if RegDataType = rdBinary then begin
          DataSize := Reg.GetDataSize(Value);
          if DataSize = -1 then goto cantread;
          SetLength(s, DataSize);
          Len := Reg.ReadBinaryData(Value, PChar(s)^, DataSize);
          if Len <> DataSize then goto cantread;
          Result := s;
        end else
        cantread:
          raise Exception.Create(SysErrorMessage(ERROR_CANTREAD));
      except
        s := ''; // Deallocates memory if allocated
        Reg.CloseKey;
        raise;
      end;
      Reg.CloseKey;
    end else
      raise Exception.Create(SysErrorMessage(GetLastError));
  except
    Reg.Free;
    raise;
  end;
  Reg.Free;
end;
function GetProgramFilesDir: TFileName;
begin
  Result := GetRegistryData(HKEY_LOCAL_MACHINE,
    '\Software\Microsoft\Windows\CurrentVersion',
    'ProgramFilesDir');  // or 'ProgramFilesPath'
end;
function GetWindowsDir: TFileName;
var
  WinDir: array [0..MAX_PATH-1] of char;
begin
  SetString(Result, WinDir, GetWindowsDirectory(WinDir, MAX_PATH));
  if Result = '' then
    raise Exception.Create(SysErrorMessage(GetLastError));
end;
function GetSystemDir: TFileName;
var
  SysDir: array [0..MAX_PATH-1] of char;
begin
  SetString(Result, SysDir, GetSystemDirectory(SysDir, MAX_PATH));
  if Result = '' then
    raise Exception.Create(SysErrorMessage(GetLastError));
end;
procedure TForm1.Button1Click(Sender: TObject);
const sProgram : Array [0..10] of String
  = ('excel.exe', 'frontpg.exe', 'winword.exe',
    'powerpnt.exe', 'outlook.exe', 'msaccess.exe',
    'notepad.exe', 'regedit.exe','cliconfg.exe',
    'calc.exe', 'freecell.exe');
begin
  if RadioGroup1.ItemIndex in [0..5] then
    WinExec(
      PChar(GetProgramFilesDir+'\Microsoft Office\Office'+sProgram[RadioGroup1.ItemIndex]),
      SW_NORMAL)
  else
  if RadioGroup1.ItemIndex in [6..7] then
    WinExec(
      PChar(GetWindowsDir+''+sProgram[RadioGroup1.ItemIndex]),
      SW_NORMAL)
  else
  if RadioGroup1.ItemIndex in [8..10] then
    WinExec(
      PChar(GetSystemDir+''+sProgram[RadioGroup1.ItemIndex]),
      SW_NORMAL)
  else
    ShowMessage('Bego Loe, Kok Gak Dipilih Optionnya !');
end;
end.
user image
more 19 years ago

LuriDarmawan

kayanya mending CH buat/submit ke artikel saja deh.. http://pascal-id.org/dpr/Submit_News.pas
user image
more 19 years ago

EkoIndri

:D untung aq lom sempet tambahkan....... ok, masuk artikel ajalah....... @luri tapi postingnya nggak nambah............. wakakakakakak kabooooooooor.....
user image
more 19 years ago

cyber_hecker

pengennya seh masuk in artikel. tapi di artikel BBCode-nya gak bisa seh. gue rada bingung kalo masuk in gambar pake kode html. boss.. di enabled dunk BBCode buat artikel... :D
user image
more 19 years ago

danzfx

@LuriDarmawan: kayanya mending CH buat/submit ke artikel saja deh.. http://pascal-id.org/dpr/Submit_News.pas
CH apatuh?? :? thankz :)
user image
more 19 years ago

deLogic

@danzfx: CH apatuh?? :? thankz :)
itu inisial dari bung Cyber_Hecker....
user image
more 19 years ago

cyber_hecker

OOT: iya neh... mosok belon kenal ama selebrites yang cakep, baik, ramah tamah, keren, sabar, penyayang, setia, rendah diri, pemalu yang satu ini... wakakakakakak
user image
more 19 years ago

EkoIndri

di iya-in aja biar seneng.......... ntar klo ngambek g berani masuk ni forum lagi lho.........
user image
more 19 years ago

imunk

selain itu gak mau ngejawab kalo ditanya lagi..... bisa ngejawab kalo kita bs ngerayu dia, kayak saysnsay...... dia tuh paling jago dalam rayu merayu........... mana nih dia kok gak nongol ya....
user image
more 19 years ago

cyber_hecker

OOT: kekekeke... bukannya gak mau njawab, tapi kalo emang gue gak bisa, gue gak mau njawab. dari pada mberi jawaban yang gak nyambung :P, lebih baik diem... dan kalo gue bisa njawab, pasti ku jawab :D
more ...
  • Pages:
  • 1
  • 2
Share to

AI Forward

🚀 We're thrilled to partner with Alibaba Cloud for "AI Forward - Alibaba Cloud Global Developer Summit 2025" in Jakarta! Join us and explore the future of AI. Register now: https://int.alibabacloud.com/m/1000400772/
#AlibabaCloud #DeveloperSummit #Jakarta #AIFORWARD

Random Topic

Local Business Directory, Search Engine Submission & SEO Tools FreeWebSubmission.com SonicRun.com