Hvordan?!?!?
Hej! jeg har et lille problem. En knap jeg har sat på min form ska udfører den her kode :--------------------------
procedure TfrmMain.SBInstallClick(Sender: TObject);
// A user clicks on the install button and the install windows
// will take over control, after the installations info has
// determined
var
i : integer;
s : string;
idx : integer;
ext : string;
doRetry : boolean;
stitle : string;
Offline : boolean; // Offline browsing
begin
idx := GetIndex;
if idx <> -1 then
begin
zipfile:=MenuData.PgmName[idx];
if FileExists(ArchiveDirB + zipfile) then
Offline:=False
else
Offline:=True;
if Offline then
begin
i:=0;
repeat
s:= DriveComboBox.Items.Strings[i][1]+\':\';
Inc (i);
if (GetDriveType(PChar(s)) = 5) and
(FileExists(s+\'\\\' + ArchiveDirB + zipfile)) then
DriveComboBox.drive:=s[1]; // cd or dvd
until (i=DriveComboBox.Items.Count);
SetCurrentDir(DriveComboBox.Drive+\':\\\');
frmInstall.arcpath:=DriveComboBox.Drive+\':\\\';
end
else
begin
frmInstall.arcpath:=GoWinDir;
SetCurrentDir(GoWinDir);
end;
// build window title for \'Insert disc\' dialog
if (Trim(lblHandle.Caption) <> \'\')
and (Trim(lblTitle.Caption) <> \'\') then
stitle:= \'Insert \"\'+
lblHandle.Caption+\' - \'+lblTitle.Caption + \'\" disc\'
else if Trim(lblTitle.Caption) <> \'\' then
stitle:=\'Insert \"\'+ lblTitle.Caption +\'\" disc\'
else
stitle:=\'Insert disc\';
if (MenuData.CDno[idx]<>\'-\') and (MenuData.CDno[idx]<>\'\') then
stitle:=stitle + \' \' + MenuData.CDno[idx];
doRetry:=False;
repeat
Application.ProcessMessages;
if FileExists(ArchiveDirB + zipfile) then
begin
runcmd:=MenuData.Cmd[idx];
if Length(zipfile) > 3 then
begin
ext := GetExt(ArchiveDirB + zipfile);
if (ext = \'.ZIP\')
or (ext = \'.RAR\')
or (ext = \'.ACE\') then
begin
if GoWinDir[Length(GoWinDir)]=\'\\\' then
picdir:=GoWinDir
else
picdir:=GoWinDir + \'\\\';
sSize:=MenuData.Size[idx];
title:=TreeView1.Items[idx].Text;
frmInstall.Caption:= \'Installation of \' + TreeView1.Items[idx].Text;
frmInstall.lblInstallTitle.Caption:=\'Installation of \' + TreeView1.Items[idx].Text;
frmUnpack.lblUnpackTitle.Caption:=\'Unpacking \' +
TreeView1.Items[idx].Text+ \'...\';
frmInstall.SetLaunchExplorer(MenuData.LaunchExpl[idx]);
frmInstall.arcext:=ext;
frmInstall.SetArchivePassword (MenuData.ZipPwd[idx]);
frmInstall.SetShortCutVars
(MenuData.scpath[idx], MenuData.sctext1[idx],
MenuData.scfile1[idx], MenuData.scdesktop1[idx],
MenuData.sctext2[idx],MenuData.scfile2[idx],
MenuData.scdesktop2[idx], MenuData.sctext3[idx],
MenuData.scfile3[idx], MenuData.scdesktop3[idx],
MenuData.sctext4[idx], MenuData.scfile4[idx],
MenuData.scdesktop4[idx]);
SetInstallPath(MenuData.Path[idx]);
if (Length(MenuData.serial[idx])>1) and
(MenuData.serial[idx]<>\'See info\') then
frmInstall.SNclpbrd.Text:=MenuData.serial[idx]
else
frmInstall.SNclpbrd.Text:=\'\';
frmInstall.Show;
frmMain.Hide;
doRetry:=False;
end
else
frmInstall.ExecuteFile(ArchiveDirB + zipfile,\'\',\'\',SW_SHOWNORMAL)
end;
end
else // file not found
begin
if (zipfile=\'\') or (zipfile=\'-\') then
Application.ProcessMessages
else
begin // archive name not empty
i:=0;
repeat
Application.ProcessMessages;
s:= DriveComboBox.Items.Strings[i][1]+\':\';
Inc (i);
if (GetDriveType(PChar(s)) = 5) and // CD or DVD
(FileExists(s+\'\\\' + ArchiveDirB + zipfile)) then
DriveComboBox.drive:=s[1];
until (i=DriveComboBox.Items.Count);
frmMain.Repaint;
SetCurrentDir(DriveComboBox.Drive+\':\\\');
frmInstall.arcpath:=DriveComboBox.Drive+\':\\\';
frmMsgBox.MsgBox(stitle, mtConfirmation, [mbOK]+[mbCancel], 0);
if frmMsgBox.msgboxReturn = mrOK then
doRetry:=True
else
doRetry:=False;
end;
end;
until not doRetry;
SetCurrentDir(GoWinDir);
end;
end; // SBInstallClick
-----------------------------------
Det virker også perfekt, men når jeg prøver at \"indsætte\" koden over på et billede istedet for knappen, så virker det ikke. Nogle der kan hjælpe???