Автор: Пользователь скрыл имя, 21 Ноября 2011 в 18:50, отчет по практике
В юридическом смысле слова рекламное агентство не является агентством, то есть посредником.
Рекламные агентства выступают в роли комитентов по отношению к средствам массовой информации.
Рекламное агентство покупает время или печатную площадь у средств массовой информации на свой страх и риск, а вовсе не в качестве Вашего рекламного агента. Вы не вступаете ни в какие юридические отношения со средствами массовой информации. Вы имеете дело только с конкретным рекламным агентством.
DeleteFile(TempDir + sIndexFile);
FreeMem(TempDir, MAX_PATH);
PostMessage(MainFOrm.Handle, MM_ENDTHREAD, 0, 0);
except
on e: exception do PostMessage(MainFOrm.Handle, MM_DATAERROR, StrToInt(e.Message), 0)
end;
end;
end;
procedure DataThread.UpdateProgress;
var Persent: integer;
begin
with MainFOrm do
begin
Persent
:= trunc(100*(Table1.RecNo/
progressBar1.Position := Persent;
lbPersent.Caption := InttoStr (Persent)+ ' %';
end;
end;
procedure DataThread.RemaskMDX;
var
OldFile, NewFile: tFileStream;
Buffer : byte;
const index = 28;
begin
OldFile := TFileStream.Create(TempDir + sBuffFIle2, fmOpenRead or fmShareDenyWrite);
try
NewFile := TFileStream.Create( TempDir + sBuffFile,fmCreate or fmOpenWrite);
try
NewFile.CopyFrom(OldFile ,OldFile.Size);
NewFile.Position := index;
Buffer := 0;
NewFile.Write(Buffer, 1);
finally
FreeAndNil(NewFile);
end;
finally
FreeAndNil(OldFile);
end;
end;
procedure DataThread.UpdateForm;
begin
with MainFOrm do
begin
Image1.Visible := false;
ProgressBar1.Visible := true;
LbPersent.Visible := true;
lbMessage.Visible := true;
end;
end;
end.
unit TElDov;
interface
uses
Windows, SysUtils, Thread, Progress, ExtCtrls, ComCtrls, Menus,
ToolWin, DBCtrls, ImgList, Classes, Controls, StdCtrls, Grids,
DB, DBTables, DBGrids, Forms, Messages, Dialogs,Clipbrd;
type
TPhoneForm = class(TForm)
DataSource1: TDataSource;
Table1: TTable;
StatusBar1: TStatusBar;
GroupBox1: TGroupBox;
Search: TButton;
ToolBar1: TToolBar;
ExitButton: TToolButton;
EraseButton: TToolButton;
DBGrid1: TDBGrid;
SortButton: TToolButton;
PopupMenu1: TPopupMenu;
ToolButton2: TToolButton;
ToolButton3: TToolButton;
ToolButton4: TToolButton;
ToolButton5: TToolButton;
ToolButton6: TToolButton;
ToolButton7: TToolButton;
ToolButton8: TToolButton;
PopupMenu2: TPopupMenu;
DBNavigator1: TDBNavigator;
procedure FormCreate(Sender: TObject);
procedure SearchClick(Sender: TObject);
procedure AOM(var Msg: tagMSG; var Handled: Boolean);
procedure EraseButtonClick(Sender: TObject);
procedure MyPopupHandler(Sender: TObject);
procedure MyPopupHandler2(Sender: TObject);
procedure MyEditPopup(Sender: TObject; MousePos: TPoint; var Handled: Boolean);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure MInMaxSize(var Message: TMessage); message WM_GETMINMAXINFO;
procedure N20Click(Sender: TObject);
procedure N13Click(Sender: TObject);
procedure N14Click(Sender: TObject);
procedure N15Click(Sender: TObject);
procedure N16Click(Sender: TObject);
procedure ExitButtonClick(Sender: TObject);
procedure SearchButtonClick(Sender: TObject);
procedure HelpButtonClick(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
procedure CreatePopupFields;
procedure UpdateStatusBar;
procedure CalculateEditSize;
procedure SortMode (Sender: tObject);
procedure ReadIni;
procedure WriteIni; // Ini-file
public
end;
var
PhoneForm: TPhoneForm;
Inputs : array [0..4] of TEdit;
MyThread: DataThread;
bool: boolean;
ColumnIndex: integer;
const
SortName : array[0..2]
of string =('ïî Òåëåôîíó','ïî Èìåíè','
IndexName : array [0..2]
of string =('ByNumTel','ByFamil','
COPY_TO_CLIPBOARD = 'Êîïèðîâàòü';
PASTE_FROM_CLIPBOARD = 'Âñòàâèòü';
function IndexOfItem(Item: string): integer;
implementation
uses IniFiles, DBITypes, DBIProcs, Graphics,ShellApi;
{$R *.dfm}
procedure TPhoneForm.FormCreate(Sender: TObject);
var i, j: integer;
item : tMenuItem;
begin
Table1.TableName := sDataFile;
Table1.Open;
CreatePopupFields;
CalculateEditSize;
UpDateStatusBar;
ReadIni;
Application.onMessage := Aom;
Application.HelpFile := sHelpFile;
end;
procedure TPhoneForm.MyPopupHandler(
begin
if Sender is TMenuItem then with (Sender as TMenuItem) do
begin
case tag of
0..2: begin Table1.IndexName := IndexName[(Sender as TMenuItem).tag ];
SortMode(Sender);
end;
4: Clipboard.AsText := DBGrid1.SelectedField.
end;
UpdateStatusBar;
end;
end;
procedure TPhoneForm.CreatePopupFields;
var
i: integer;
MyPopupMenuItem : array [0..4] of TMenuItem;
MenuItem: TMenuItem;
begin
for i := 0 to 4 do
begin
Inputs[i] := TEdit.Create(self);
Inputs[i].Parent := GroupBox1;
Inputs[i].PopupMenu := PopupMenu2;
Inputs[i].OnContextPopup := MyEditPopup;
Inputs[i].Tag := i;
end;
for i := 0 to 4 do with PopupMenu1 do
begin //Ñòâîðåííÿ ìåíþ ñîðòóâàííÿ
MyPopupMenuItem[i] := TMenuItem.Create(self);
if i<3 then MyPopupMenuItem[i].Caption := SortName[i];
MyPopupMenuItem[i].Tag := i;
MyPopupMenuItem[i].OnClick := MyPopupHandler;
PopupMenu1.Items.add(
end;
MyPopupMenuItem[3].Caption := '-';
MyPopupMenuItem[4].Caption := COPY_TO_CLIPBOARD;
MyPopupMenuItem[4].ShortCut := ShortCut(Word('C'), [ssCtrl]);
PopupMenu1.Items[0].Checked := true;
MenuItem := TMenuItem.Create(self);
MenuItem.Caption := PASTE_FROM_CLIPBOARD;
MenuItem.OnClick := MyPopupHandler2;
PopupMenu2.Items.add(MenuItem)
MyEditPopup(nil, Point(0,0), bool);
end;
procedure TPhoneForm.CalculateEditSize;
var
i: integer;
OffSet: integer;
begin
offset :=13;
for i := 0 to 4 do
begin
Inputs[i].Left := Offset;
Offset := Offset + DbGrid1.Columns[i].width + 8;
Inputs[i].Width := DBGrid1.Columns[i].width;
Inputs[i].Top := 24;
Inputs[i].MaxLength :=Table1.Fields[i].Size;
end;
end;
procedure TPhoneForm.UpdateStatusBar;
var SortMode: string;
begin
statusBar1.Panels[0].Text := ' Íàéäåíî àáîíåíòîâ: '+ InttoStr(Table1.RecordCount);
Sortmode := SortName[0];
if PopupMenu1.Items[1].Checked then sortMode := SortName[1];
if PopupMenu1.Items[2].Checked then sortMode := SortName[2];
statusbar1.Panels[1].Text := ' Îòñîðòèðîâàíî: '+SortMode;
end;
procedure tPhoneForm.AOM(var Msg: tagMSG; var Handled: Boolean);
var key : word;
begin
handled := false;
if msg.message = Wm_keydown then
begin
key := msg.wParam;
handled := true;
case key of
vk_up: SendMessage(DBGrid1.Handle,wm_
vk_Down: SendMessage(DBGrid1.Handle,wm_
vk_Prior: SendMessage(DBGrid1.Handle,wm_
vk_Next: SendMessage(DBGrid1.Handle,wm_
vk_return: Search.OnClick(Search);
vk_f8: EraseButton.Click;
vk_f1: Application.HelpCommand(HELP_
else handled := false;
end;
end;
end;
procedure TPhoneForm.SearchClick(Sender: TObject);
var
filters: string;
i: integer;
begin
filters := '';
for i:= 0 to 4 do //with table1 do
begin
if Inputs[i].Text <> ''
then filters := filters + '('+Table1.Fields[i].FieldName + '='+ QuotedStr(Inputs[i].Text + '*')+ ') and';
end;
if filters <> '' then
Filters := copy(Filters, 0, Length(filters)-4);
table1.Filter := filters;
UpdateStatusBar;
end;
procedure TPhoneForm.EraseButtonClick(
var
i: integer;
begin
for i := 0 to 4 do Inputs[i].Text := '';
end;
procedure TPhoneForm.SortMode (Sender: tObject);
var
i: integer;
begin
for i := 0 to 2 do
PopupMenu1.Items[i].Checked := false;
(sender as TMenuItem).Checked := true;
end;
procedure TPhoneForm.FormClose(Sender: TObject; var Action: TCloseAction);
begin
application.OnMessage := MainForm.progressAom;
WriteIni;
postMessage(MainForm.Handle, WM_CLOSE, 0, 0);
end;
procedure TPhoneForm.ReadIni;
begin
with TIniFile.Create(
begin
table1.IndexName
:= IndexName[ReadInteger('
Left := ReadInteger('Position','left', 100);
top := ReadInteger('Position','top', 100);
Height :=
ReadInteger('Position','
end;
end;
function IndexOfItem(Item: string): integer;
begin
if Item = SortName[1] then result := 1
else if Item = SortName[2] then result := 2
else result := 0;
end;
procedure TPhoneForm.WriteIni;
begin
with TIniFile.Create(
begin
WriteInteger('Defaults','
WriteInteger('Position','left'
WriteInteger('Position','top', PhoneForm.top);
WriteInteger('Position','