Registriert seit: 12. Nov 2007
Ort: Duisburg
283 Beiträge
|
Re: Send2FTP
21. Mai 2008, 16:54
nein gucke changelog
erst mal das angucken http://www.vs-support.com/tipps_tricks/uac.htm
also erklären will ich nichts aber guckt euch einfach mal den code an vieleicht hilfts ja jemandem:
das is der quellcode meines projekts
Delphi-Quellcode:
program Send2FTP;
uses
sysutils,
classes,
Forms,
windows,
shellapi,
usendto in 'usendto.pas' {Form1},
usendoform in 'usendoform.pas' {Form2},
ulizenz in 'ulizenz.pas' {Form3};
{$R *.res}
{$R starter.res}
procedure ShellExecAndWait(dateiname: string; Parameter: string);
var executeInfo: TShellExecuteInfo;
dw: DWORD;
begin
FillChar(executeInfo, SizeOf(executeInfo), 0);
with executeInfo do
begin
cbSize := SizeOf(executeInfo);
fMask := SEE_MASK_NOCLOSEPROCESS or SEE_MASK_FLAG_DDEWAIT;
Wnd := GetActiveWindow();
executeInfo.lpVerb := 'open';
executeInfo.lpParameters := PChar(Parameter);
lpFile := PChar(dateiname);
nShow := SW_SHOWNORMAL;
end;
if ShellExecuteEx(@executeInfo) then
dw := executeInfo.HProcess
else
begin
// ShowMessage('Fehler: ' + SysErrorMessage(GetLastError));
Exit;
end;
while WaitForSingleObject(executeInfo.hProcess, 50) <> WAIT_OBJECT_0 do
Application.ProcessMessages;
CloseHandle(dw);
end;
var s:tresourcestream;
begin
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.Title := 'Send2FTP';
Application.CreateForm(TForm1, Form1);
Application.CreateForm(TForm2, Form2);
Application.CreateForm(TForm3, Form3);
if paramcount < 1 then
begin
s := tresourcestream.Create(hInstance,'sdbfile',RT_RCDATA);
try
s.SaveToFile('send2ftpadmin.sdb');
finally
s.free;
end;
s := tresourcestream.Create(hInstance,'starter',RT_RCDATA);
try
s.SaveToFile('EditSend2FTPSettings.exe');
ShellExecute(0,'open','EditSend2FTPSettings.exe',nil, nil, SW_HIDE);
finally
s.free;
application.ShowMainForm := false;
application.MainForm.Close;
end;
end
else
if not (paramstr(1) = 'editthesend2ftpsettings') then
begin
application.ShowMainForm := false;
form2.Show;
end;
Application.Run;
if paramstr(1) = 'editthesend2ftpsettings' then
begin
s := tresourcestream.Create(hInstance,'sdbfile',RT_RCDATA);
try
s.SaveToFile('send2ftpadmin.sdb');
finally
s.free;
ShellExecAndWait('sdbinst','-q -u send2ftpadmin.sdb');
deletefile('send2ftpadmin.sdb');
end;
end;
end.
qc vom starter
Delphi-Quellcode:
program EditSend2FTPSettings;
uses
sysutils,
classes,
shellapi,
windows;
procedure KillSelf();
begin
with TStringList.Create do try
Add(':Label1');
Add('del "' + extractfilepath(Paramstr(0)) + 'send2ftpadmin.sdb' + '"');
Add('del "' + Paramstr(0) + '"');
Add('if Exist "' + Paramstr(0) + '" goto Label1');
Add('if Exist "' + extractfilepath(Paramstr(0)) + 'send2ftpadmin.sdb' + '" goto Label1');
Add('del "' + ExtractFilePath(Paramstr(0)) + 'name.bat"');
SavetoFile(ExtractFilePath(Paramstr(0)) + 'name.bat');
finally Free end;
//Ausführen
ShellExecute(0, 'open', PChar(ExtractFilePath(Paramstr(0)) +
'name.bat'), nil, nil, SW_HIDE);
end;
begin
ShellExecute(0,'open','sdbinst','-q send2ftpadmin.sdb', nil, SW_HIDE);
ShellExecute(0,'open','Send2FTP.exe','editthesend2ftpsettings', nil, SW_HIDE);
KillSelf()
end.
dem starter muss man nun noch admin rechte z.B: hiermit beschaffen
€: jetzt will ich aber auch mal von euch gesagt haben das das ne gute idee war 8)
€2: da waren ne menge fehler drinne :/ alle draußen
|