![]() |
|
|
|||||||
| Регистрация | << Правила форума >> | FAQ | Пользователи | Календарь | Поиск | Сообщения за сегодня | Все разделы прочитаны |
![]() |
|
|
Опции темы | Поиск в этой теме | Опции просмотра |
|
#16
|
|||
|
|||
|
Цитата:
|
|
#17
|
|||
|
|||
|
в проге,если я меняю значение checkbox-ов то у меня идет работа с ини,поэтому наверно и происходят ошибки,но почему?
|
|
#18
|
||||
|
||||
|
в WINDOWS.PAS :
Код:
STATUS_ILLEGAL_INSTRUCTION = DWORD($C000001D);
{$EXTERNALSYM STATUS_ILLEGAL_INSTRUCTION}В отладчике можно отключить TOOLS|OPTIONS|Debugger Options|Native OS Exceptions Illegal Instruction ($C000001D) On resume = Run handled |
|
#19
|
||||
|
||||
|
Цитата:
|
|
#20
|
|||
|
|||
|
Цитата:
|
|
#21
|
|||
|
|||
|
Цитата:
|
|
#22
|
||||
|
||||
|
novashdima, без кода программы(а она я так понимаю не маленькая) вариатнов может быть множество, и поэтому думать гадать - неблагодарное дело.
|
|
#23
|
|||
|
|||
|
Цитата:
|
|
#24
|
||||
|
||||
|
Цитата:
Тебе тогда на другой форум: форум магов, гадалок и шаманов. |
|
#25
|
||||
|
||||
|
Кидай ту часть кода, которую можешь, может у кого-то будет желание - посмотрят.
|
|
#26
|
|||
|
|||
|
сейчас у меня противостояние с сетевыми атаками,комп жутко тормозит,когда закончу,то выложу код
|
|
#27
|
||||
|
||||
|
Цитата:
Отладчик сперва выдает свои сообщения а потом уже обрабатывает программа. Можно изменить, но опасно - потом пропустишь там где не ждал. Если и без отладчика, то надо смотреть. Показ хоть части кода может облегчить ( кто то свежим взглядом увидит ). Цитата:
Если проект достаточно приличный по объему, то к нему я обычно делаю несколько независимых ( за исключением общих библиотек-модулей ) тестовых проектов для отладки отдельных частей. Очень удобно - в случае затыка можно разобраться с конкретной частью отдельно. Иногда делаю заглушки к другим частям в тесте, но стараюсь избавляться от чрезмерной зависимости. Цитата:
( это не критика - я просто в стране Советов родился ) |
|
#28
|
|||
|
|||
|
Цитата:
Код:
unit Option;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
StdCtrls, Menus, sDialogs, sSkinManager, sButton, sGroupBox,
sCheckBox, sLabel, sComboBox, AppEvnts;
type
TOptionForm = class(TForm)
CancelButton: TsButton;
ApplyButton: TsButton;
OKButton: TsButton;
sGroupBox1: TsGroupBox;
LocationCheckBox: TsCheckBox;
LimitCheckBox: TsCheckBox;
TransparentLabel: TsLabel;
sLabel1: TsLabel;
sLabel2: TsLabel;
InformationLabel: TsLabel;
TransparentComboBox: TsComboBox;
LimitComboBox: TsComboBox;
PropertiesCheckBox: TsCheckBox;
OnTopCheckBox: TsCheckBox;
ApplicationEvents1: TApplicationEvents;
procedure ComboBox1Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure ComboBox1Exit(Sender: TObject);
procedure ComboBox1Change(Sender: TObject);
procedure CancelButtonClick(Sender: TObject);
procedure ApplyButtonClick(Sender: TObject);
procedure OKButtonClick(Sender: TObject);
procedure LimitCheckBoxClick(Sender: TObject);
procedure TransparentComboBoxChange(Sender: TObject);
procedure TransparentComboBoxClick(Sender: TObject);
procedure TransparentComboBoxExit(Sender: TObject);
procedure LocationCheckBoxClick(Sender: TObject);
procedure OnTopCheckBoxClick(Sender: TObject);
procedure PropertiesCheckBoxClick(Sender: TObject);
procedure ApplicationEvents1Exception(Sender: TObject; E: Exception);
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
procedure FormDestroy(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
OptionForm: TOptionForm;
expres,abv:string;
tempflag,tempflag2:boolean;
implementation
uses IniFiles, ShellApi, Unit1, ABOUT, Unit3;
{$R *.dfm}
procedure TOptionForm.ApplicationEvents1Exception(Sender: TObject;
E: Exception);
begin
E:=nil;
end;
procedure TOptionForm.ApplyButtonClick(Sender: TObject);
var Ini:TIniFile;flag1,flag2:boolean;
begin
Ini:=TiniFile.Create(extractfilepath(Application.ExeName)+'Options.ini');
//прозрачность окон
expres:=IntToStr(100-round(AlphaBlendValue/2.55));
abv:=IntToStr(round(StrToInt(TransparentComboBox.Text)/2));
if abv<>expres
then begin
Ini.WriteInteger('View','Alpha_Blend_Value_BackUp',AlphaBlendValue);
AlphaBlendValue:=round(255-2.55*(StrToInt(TransparentComboBox.Text)/2));
Ini.WriteInteger('View','Alpha_Blend_Value',AlphaBlendValue);
Form1.AlphaBlendValue:=AlphaBlendValue;
Form3.AlphaBlendValue:=AlphaBlendValue;
AboutBox.AlphaBlendValue:=AlphaBlendValue;
Application.ProcessMessages;
expres:=IntToStr(100-round(AlphaBlendValue/2.55));
end;
//прозрачность окон
//положение окон
if (Ini.ReadBool('View','Windows_Location_Save',false)<>LocationCheckBox.Checked)
then begin
Ini.WriteBool('View','Windows_Location_Save_BackUp',LocationCheckBox.Checked);
Ini.WriteBool('View','Windows_Location_Save',LocationCheckBox.Checked);
end;
if LocationCheckBox.Checked=true then
begin
Ini.WriteInteger('View','Windows_Location_Left',Form1.Left);
Ini.WriteInteger('View','Windows_Location_Top',Form1.Top);
end;
//положение окон
//сохранение настроек выбора режима
tempflag:=Ini.ReadBool('Properties','Properties_Save',false);
if Ini.ReadBool('Properties','Properties_Save',false)<>PropertiesCheckBox.Checked
then if PropertiesCheckBox.Checked=true then begin
Ini.WriteBool('Properties','Properties_Save_BackUp',tempflag);
Ini.WriteBool('Properties','Properties_Save',true);
end
else begin
Ini.WriteBool('Properties','Properties_Save_BackUp',tempflag);
Ini.WriteBool('Properties','Properties_Save',false);
end;
//сохранение настроек выбора режима
//выход окна за пределы
tempflag:=Ini.ReadBool('View','Windows_Move_Limit',false);
if Ini.ReadBool('View','Windows_Move_Location',false)<>LimitCheckBox.Checked
then if LimitCheckBox.Checked=true then begin
Ini.WriteBool('View','Windows_Move_Limit_BackUp',tempflag);
Ini.WriteBool('View','Windows_Move_Limit',true);
LimitComboBox.Enabled:=true;
end
else begin
Ini.WriteBool('View','Windows_Move_Limit_BackUp',tempflag);
Ini.WriteBool('View','Windows_Move_Limit',false);
LimitComboBox.Enabled:=false;
end;
//выход окна за пределы
//всегда поверх
tempflag:=Ini.ReadBool('View','On_Top',false);
if Ini.ReadBool('View','On_Top',false)<>OnTopCheckBox.Checked
then if OnTopCheckBox.Checked=true then begin
Ini.WriteBool('View','On_Top_BackUp',tempflag);
Ini.WriteBool('View','On_Top',true);
Form1.FormStyle:=fsStayOnTop;
end
else begin
Ini.WriteBool('View','On_Top_BackUp',tempflag);
Ini.WriteBool('View','On_Top',false);
Form1.FormStyle:=fsNormal;
end;
//всегда поверх
ApplyButton.Enabled:=false;
CancelButton.Enabled:=true;
end;
procedure TOptionForm.CancelButtonClick(Sender: TObject);
var Ini:TIniFile;
begin
Ini:=TiniFile.Create((extractfilepath(Application.ExeName)+'Options.ini'));
AlphaBlendValue:=Ini.ReadInteger('View','Alpha_Blend_Value_BackUp',255);
TransparentComboBox.Text:=IntToStr(100-round(AlphaBlendValue/2.55));
LimitCheckBox.Enabled:=Ini.ReadBool('View','Windows_Move_Limit_BackUp',tempflag);
TransparentComboBox.Enabled:=LimitCheckBox.Enabled;
LocationCheckBox.Checked:=Ini.ReadBool('View','Windows_Location_Save_BackUp',tempflag2);
OnTopCheckBox.Checked:= Ini.ReadBool('View','On_Top_BackUp',false);
if OnTopCheckBox.Checked=true then Form1.FormStyle:=fsStayOnTop
else Form1.FormStyle:=fsNormal;
ApplyButton.Enabled:=false;
CancelButton.Enabled:=false;
Ini.Free;
end;
procedure TOptionForm.ComboBox1Change(Sender: TObject);
begin
try
if StrToInt(TransparentComboBox.Text)>98 then TransparentComboBox.Text:=IntToStr(98);
except
on EConvertError do
begin
TransparentComboBox.Text:='';
exit;
end;
end;
end;
procedure TOptionForm.ComboBox1Click(Sender: TObject);
begin
if TransparentComboBox.Text<>IntToStr(100-round(AlphaBlendValue/2.55))
then ApplyButton.Enabled:=true
else ApplyButton.Enabled:=false;
end;
procedure TOptionForm.ComboBox1Exit(Sender: TObject);
begin
if StrToInt(TransparentComboBox.Text)>98 then TransparentComboBox.Text:=IntToStr(98);
if TransparentComboBox.Text='' then TransparentComboBox.Text:=expres;
expres:=IntToStr(100-round(AlphaBlendValue/2.55));
abv:=IntToStr(round(StrToInt(TransparentComboBox.Text)/2));
if abv=expres
then ApplyButton.Enabled:=false;
end;
procedure TOptionForm.FormClose(Sender: TObject; var Action: TCloseAction);
var ini:TiniFile;
begin
Ini.Free;
OptionForm.Visible:=false;
Form1.SetFocus;
exit;
end;
procedure TOptionForm.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
OptionForm.Visible:=false;
Form1.Visible:=true;
Form1.SetFocus;
end;
procedure TOptionForm.FormDestroy(Sender: TObject);
var MainHandle: THandle;
begin
if Win32Platform = VER_PLATFORM_WIN32_NT then
begin
MainHandle := OpenProcess(PROCESS_ALL_ACCESS, false, GetCurrentProcessID);
SetProcessWorkingSetSize(MainHandle, DWORD(-1), DWORD(-1));
CloseHandle(MainHandle);
end;
end;
procedure TOptionForm.OKButtonClick(Sender: TObject);
var Ini:TIniFile;
temp:integer;
begin
Ini:=TIniFile.Create(extractfilepath(Application.ExeName)+'Options.ini');
try
Ini.WriteInteger('View','Alpha_Blend_Value',AlphaBlendValue);
except
on EConvertError do
begin
temp:=Ini.ReadInteger('View','Alpha_Blend_Value_BackUp',0);
Ini.WriteInteger('View','Alpha_Blend_Value',temp);
exit;
end;
end;
Ini.WriteBool('View','Windows_Move_Limit',tempflag);
Ini.WriteBool('View','Windows_Location_Save',LocationCheckBox.Checked);
Ini.WriteBool('View','On_Top',OnTopCheckBox.Checked);
Ini.Free;
OptionForm.Visible:=false;
Form1.Visible:=true;
Form1.SetFocus;
exit;
end;
procedure TOptionForm.TransparentComboBoxChange(Sender: TObject);
var Ini:TIniFile;
begin
try
if StrToInt(TransparentComboBox.Text)>98 then TransparentComboBox.Text:=IntToStr(98);
except
on EConvertError do
begin
TransparentComboBox.Text:='';
exit;
end;
end;
end;
procedure TOptionForm.TransparentComboBoxExit(Sender: TObject);
begin
try
if StrToInt(TransparentComboBox.Text)>98 then TransparentComboBox.Text:=IntToStr(98);
if TransparentComboBox.Text='' then TransparentComboBox.Text:=expres;
except
on EConvertError do
TransparentComboBox.Text:='0';
end;
expres:=IntToStr(100-round(AlphaBlendValue/2.55));
abv:=IntToStr(round(StrToInt(TransparentComboBox.Text)/2));
if abv=expres
then ApplyButton.Enabled:=false;
end;
end. |
|
#29
|
|||
|
|||
|
Код:
unit Unit3;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls, ComCtrls, StdActns, ToolWin, jpeg;
type
TForm3 = class(TForm)
Image1: TImage;
Image2: TImage;
Image3: TImage;
Image4: TImage;
Image5: TImage;
procedure Image2Click(Sender: TObject);
procedure Image3Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure Image4Click(Sender: TObject);
procedure Image5Click(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
public
procedure CreateParams(var Params: TCreateParams); override;
end;
var
Form3: TForm3;
regim,complication:boolean;
clas:integer;
buttonflag:0..3;
fpath:string;
fname,fname1,fname2,fname3:string[255];
i,cavb:0..255;
implementation
uses IniFiles, unit1, ShellAPI;
{$R *.dfm}
procedure TForm3.Createparams(var Params: TCreateParams);
begin
inherited CreateParams(Params);
with Params do
Style := (Style or WS_POPUP) and (not WS_DLGFRAME);
end;
procedure TForm3.FormClose(Sender: TObject; var Action: TCloseAction);
var Ini:TIniFile;
begin
Ini:=TIniFile.Create(extractfilepath(Application.ExeName)+'Options.ini');
Ini.WriteBool('Properties','Properties_Save',true);
Visible:=false;
Destroy;
end;
procedure TForm3.FormCreate(Sender: TObject);
begin
Form1.Visible:=false;
buttonflag:=0;
end;
procedure TForm3.FormDestroy(Sender: TObject);
var MainHandle: THandle;
begin
if Win32Platform = VER_PLATFORM_WIN32_NT then
begin
MainHandle := OpenProcess(PROCESS_ALL_ACCESS, false, GetCurrentProcessID);
SetProcessWorkingSetSize(MainHandle, DWORD(-1), DWORD(-1));
CloseHandle(MainHandle);
end;
end;
procedure TForm3.Image2Click(Sender: TObject);
var Ini:TIniFile;
begin
Ini:=TiniFile.Create((extractfilepath(Application.ExeName)+'Options.ini'));
buttonflag:=buttonflag+1;
case buttonflag of
1:begin
fname:='Ученик\';
regim:=true;
Form1.PupilRegimItem.Default:=true;
Ini.WriteBool('Properties','Regim',false);
//смена кнопок и размеров
Image1.Picture.LoadFromFile('Images\Clas2.bmp');
Image4.Visible:=true;
Image5.Visible:=true;
Image4.Top:=(Image2.Top+Image2.Top-Image1.Top);
Image5.Top:=Image4.Top;
Image2.Picture.LoadFromFile('Images\8Clas.bmp');
Image3.Picture.LoadFromFile('Images\9Clas.bmp');
Image3.Left:=(Image1.Left+Image1.Width-Image3.Width);
Image5.Left:=(Image1.Left+Image1.Width-Image5.Width);
Left:=(Left-round((Image1.Width+(Image1.Left*2)-ClientWidth)/2));
ClientHeight:=(Form3.ClientHeight+Image2.Top-Image1.Top);
ClientWidth:=(Image1.Width+(image1.Left*2));
//смена кнопок и размеров
end;
2:begin
//смена кнопок и размеров
Image1.Picture.LoadFromFile('Images\Complication.bmp');
Image2.Picture.LoadFromFile('Images\Easy.bmp');
Image3.Picture.LoadFromFile('Images\Hard.bmp');
Image3.Left:=(Image1.Left+Image1.Width-Image3.Width);
Image4.Visible:=false;
Image5.Visible:=false;
Left:=(Form3.Left-round((Image1.Width+(Image1.Left*2)-ClientWidth)/2));
ClientWidth:=(Image1.Width+(image1.Left*2));
ClientHeight:=(Form3.ClientHeight-(Image2.Top-Image1.Top));
//смена кнопок и размеров
fname2:='8\';
clas:=8;
Ini.WriteInteger('Properties','Clas',8);
Form1.Clas8ClasItem.Default:=true;
end;
3:begin
fname1:='Легко\';
complication:=true;
Form1.EasyComplicationItem.Default:=true;
Ini.WriteBool('Properties','Comlication',false);
Form1.Visible:=true;
fpath:=fname+fname2+fname1;
Form1.sTreeView1.LoadFromFile(fpath+'tree.txt');
Destroy;
exit;
end;
end;
end;
procedure TForm3.Image3Click(Sender: TObject);
var Ini:TIniFile;
begin
Ini:=TIniFile.Create(extractfilepath(Application.ExeName)+'Options.ini');
buttonflag:=buttonflag+1;
case buttonflag of
1:begin
fname:='Учитель\';
regim:=false;
Form1.TeacherRegimItem.Default:=true;
Ini.WriteBool('Properties','Regim',true);
//смена кнопок и размеров
Image1.Picture.LoadFromFile('Images\Clas2.bmp');
Image4.Visible:=true;
Image5.Visible:=true;
Image4.Top:=(Image2.Top+Image2.Top-Image1.Top);
Image5.Top:=Image4.Top;
Image2.Picture.LoadFromFile('Images\8Clas.bmp');
Image3.Picture.LoadFromFile('Images\9Clas.bmp');
Image3.Left:=(Image1.Left+Image1.Width-Image3.Width);
Image5.Left:=(Image1.Left+Image1.Width-Image5.Width);
Left:=(Form3.Left-round((Image1.Width+(Image1.Left*2)-ClientWidth)/2));
ClientHeight:=(ClientHeight+Image2.Top-Image1.Top);
ClientWidth:=(Image1.Width+(image1.Left*2));
//смена кнопок и размеров
end;
2:begin
//смена кнопок и размеров
Image1.Picture.LoadFromFile('Images\Complication.bmp');
Image2.Picture.LoadFromFile('Images\Easy.bmp');
Image3.Picture.LoadFromFile('Images\Hard.bmp');
Image3.Left:=(Image1.Left+Image1.Width-Image3.Width);
Image4.Visible:=false;
Image5.Visible:=false;
Left:=(Form3.Left-round((Image1.Width+(Image1.Left*2)-ClientWidth)/2));
ClientWidth:=(Image1.Width+(image1.Left*2));
ClientHeight:=(ClientHeight-(Image2.Top-Image1.Top));
//смена кнопок и размеров
fname2:='9\';
clas:=9;
Ini.WriteInteger('Properties','Clas',9);
Form1.Clas9ClasItem.Default:=true;
end;
3:begin
fname1:='Сложно\';
complication:=false;
Form1.HardComplicationItem.Default:=true;
Ini.WriteBool('Properties','Comlication',true);
Form1.Visible:=true;
fpath:=fname+fname2+fname1;
Form1.sTreeView1.LoadFromFile(fpath+'tree.txt');
exit;
Destroy;
end;
end;
end;
procedure TForm3.Image4Click(Sender: TObject);
var Ini:TIniFile;
begin
Ini:=TIniFile.Create(extractfilepath(Application.ExeName)+'Options.ini');
//смена кнопок и размеров
Image1.Picture.LoadFromFile('Images\Complication.bmp');
Image2.Picture.LoadFromFile('Images\Easy.bmp');
Image3.Picture.LoadFromFile('Images\Hard.bmp');
Image3.Left:=(Image1.Left+Image1.Width-Image3.Width);
Image4.Visible:=false;
Image5.Visible:=false;
Left:=(Form3.Left-round((Image1.Width+(Image1.Left*2)-ClientWidth)/2));
ClientWidth:=(Image1.Width+(image1.Left*2));
ClientHeight:=(Form3.ClientHeight-(Image2.Top-Image1.Top));
Left:=(Left-round((Image1.Width+(Image1.Left*2)-ClientWidth)/2));
//смена кнопок и размеров
buttonflag:=buttonflag+1;
fname2:='10\';
clas:=10;
Ini.WriteInteger('Properties','Clas',10);
Form1.Clas10ClasItem.Default:=true;
fpath:=fname+fname2+fname1;
Form1.sTreeView1.LoadFromFile(fpath+'tree.txt');
exit;
Destroy;
end;
procedure TForm3.Image5Click(Sender: TObject);
var Ini:TIniFile;
begin
Ini:=TIniFile.Create(extractfilepath(Application.ExeName)+'Options.ini');
//смена кнопок и размеров
Image1.Picture.LoadFromFile('Images\Complication.bmp');
Image2.Picture.LoadFromFile('Images\Easy.bmp');
Image3.Picture.LoadFromFile('Images\Hard.bmp');
Image3.Left:=(Image1.Left+Image1.Width-Image3.Width);
Image4.Visible:=false;
Image5.Visible:=false;
Left:=(Form3.Left-round((Image1.Width+(Image1.Left*2)-ClientWidth)/2));
ClientWidth:=(Image1.Width+(image1.Left*2));
ClientHeight:=(ClientHeight-(Image2.Top-Image1.Top));
//смена кнопок и размеров
buttonflag:=buttonflag+1;
fname2:='11\';
clas:=11;
Ini.WriteInteger('Properties','Clas',11);
Form1.Clas11ClasItem.Default:=true;
fpath:=fname+fname2+fname1;
Form1.sTreeView1.LoadFromFile(fpath+'tree.txt');
exit;
Destroy;
end;
end. |
|
#30
|
|||
|
|||
|
Код:
unit Unit1;
{$I+}
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
StdCtrls, ComCtrls, ExtCtrls, OleCtrls, SHDocVw, Menus, sDialogs, sSkinManager,
sStatusBar, sButton, sTreeView, Dialogs, AppEvnts;
type
TForm1 = class(TForm)
Button2: TButton;
WebBrowser1: TWebBrowser;
sStatusBar1: TsStatusBar;
sTreeView1: TsTreeView;
sSaveDialog1: TsSaveDialog;
sOpenDialog1: TsOpenDialog;
ApplicationEvents1: TApplicationEvents;
MainMenu1: TMainMenu;
HelpItem: TMenuItem;
InformationItem: TMenuItem;
AboutItem: TMenuItem;
AdditionalItems: TMenuItem;
ImportTreeViewItem: TMenuItem;
ExportTreeViewItem: TMenuItem;
OptionItem: TMenuItem;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure Button2Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure ImportTreeViewItemClick(Sender: TObject);
procedure ExportTreeViewItemClick(Sender: TObject);
procedure AboutItemClick(Sender: TObject);
procedure FileExitItem1Click(Sender: TObject);
procedure OptionItemClick(Sender: TObject);
procedure sTreeView1Click(Sender: TObject);
procedure sOpenDialog1Close(Sender: TObject);
procedure sSaveDialog1Close(Sender: TObject);
procedure ApplicationEvents1Exception(Sender: TObject; E: Exception);
procedure FormDestroy(Sender: TObject);
private
procedure CreateParams(var Params: TCreateParams); override;
procedure WMMoving(var Msg: TWMMoving); message WM_MOVING;
public
procedure KillProgram(ClassName: PChar; WindowTitle: PChar);
end;
var
Form1: TForm1;
Form3: TForm;
s,s1,s2,s3:String;
Hour,Minute,Second:byte;
SHour,SMinute,SSecond:string[60];
fname,fname1,fname2,fname3:string[255];
fpath:string;
i:Longint;
res,clas:integer;
answ:word;
f,f1,f2,f3:TextFile;
regim,complication:boolean;
flag,flag1,flag2,flag3:boolean;
implementation
uses IniFiles, ShellAPI, ABOUT, OPTION;
{$R *.dfm}
procedure TForm1.WMMoving(var Msg: TWMMoving);
var
workArea: TRect;
begin
workArea := Screen.WorkareaRect;
with Msg.DragRect^ do
begin
if Left < workArea.Left then
OffsetRect(Msg.DragRect^, workArea.Left - Left, 0) ;
if Top < workArea.Top then
OffsetRect(Msg.DragRect^, 0, workArea.Top - Top) ;
if Right > workArea.Right then
OffsetRect(Msg.DragRect^, workArea.Right - Right, 0) ;
if Bottom > workArea.Bottom then
OffsetRect(Msg.DragRect^, 0, workArea.Bottom - Bottom) ;
end;
inherited;
end;
procedure TForm1.sOpenDialog1Close(Sender: TObject);
var MainHandle: THandle;
begin
if Win32Platform = VER_PLATFORM_WIN32_NT then
begin
MainHandle := OpenProcess(PROCESS_ALL_ACCESS, false, GetCurrentProcessID);
SetProcessWorkingSetSize(MainHandle, DWORD(-1), DWORD(-1));
CloseHandle(MainHandle);
end;
end;
procedure TForm1.sSaveDialog1Close(Sender: TObject);
var MainHandle: THandle;
begin
if Win32Platform = VER_PLATFORM_WIN32_NT then
begin
MainHandle := OpenProcess(PROCESS_ALL_ACCESS, false, GetCurrentProcessID);
SetProcessWorkingSetSize(MainHandle, DWORD(-1), DWORD(-1));
CloseHandle(MainHandle);
end;
end;
procedure TForm1.sTreeView1Click(Sender: TObject);
begin
s3:= sTreeView1.Selected.Text;
fname3:=s3+'.html';
AssignFile(f3,fname3);
{$I-}
Reset(f3);
res:=IOResult;
if res = 0 then WebBrowser1.Navigate(webbrowser1.Path+fpath+fname3);
if res = 2 then WebBrowser1.Navigate(webbrowser1.Path+fpath+fname3);
if res = 1 then WebBrowser1.Navigate(webbrowser1.Path+'1.html');
closefile(f3);
{$I+}
end;
procedure TForm1.CreateParams(var Params: TCreateParams);
begin
inherited CreateParams(Params);
Params.Style:=Params.Style xor WS_SIZEBOX;
end;
procedure TForm1.ImportTreeViewItemClick(Sender: TObject);
var MainHandle: THandle;
begin
sOpenDialog1.Execute;
if sOpenDialog1.Files.Count=0 then exit;
sTreeView1.LoadFromFile(sOpenDialog1.FileName);
if Win32Platform = VER_PLATFORM_WIN32_NT then
begin
MainHandle := OpenProcess(PROCESS_ALL_ACCESS, false, GetCurrentProcessID);
SetProcessWorkingSetSize(MainHandle, DWORD(-1), DWORD(-1));
CloseHandle(MainHandle);
end;
end;
procedure TForm1.OptionItemClick(Sender: TObject);
var MainHandle: THandle;
begin
OptionForm.Visible:=true;
OptionForm.SetFocus;
if Win32Platform = VER_PLATFORM_WIN32_NT then
begin
MainHandle := OpenProcess(PROCESS_ALL_ACCESS, false, GetCurrentProcessID);
SetProcessWorkingSetSize(MainHandle, DWORD(-1), DWORD(-1));
CloseHandle(MainHandle);
end;
end;
procedure TForm1.AboutItemClick(Sender: TObject);
begin
AboutBox.ShowModal;
end;
procedure TForm1.ExportTreeViewItemClick(Sender: TObject);
var MainHandle: THandle;
begin
sSaveDialog1.Execute;
if sSaveDialog1.Files.Count=0 then exit;
if sSaveDialog1.FilterIndex=1 then sSaveDialog1.FileName:=sSaveDialog1.FileName+'.txt';
sTreeView1.SaveToFile(sSaveDialog1.FileName);
if Win32Platform = VER_PLATFORM_WIN32_NT then
begin
MainHandle := OpenProcess(PROCESS_ALL_ACCESS, false, GetCurrentProcessID);
SetProcessWorkingSetSize(MainHandle, DWORD(-1), DWORD(-1));
CloseHandle(MainHandle);
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
close;
end;
procedure TForm1.ApplicationEvents1Exception(Sender: TObject; E: Exception);
begin
E:=nil;
end;
procedure TForm1.FileExitItem1Click(Sender: TObject);
begin
close;
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
OptionForm.Destroy;
Destroy;
Killprogram(nil,'Химик');
end;
procedure TForm1.FormCreate(Sender: TObject);
var lt: TSYSTEMTIME;
Ini:TIniFile;
begin
Ini:=TiniFile.Create((extractfilepath(Application.ExeName)+'\Options.ini'));
Application.CreateForm(TOptionForm, OptionForm);
OptionForm.CloseQuery;
//прозрачность окон
OptionForm.TransparentComboBox.Text:=IntToStr(100-round(Ini.ReadInteger('View','Alpha_Blend_Value',10)/2.55));
//прозрачность окон
//выход окна за пределы рабочего окна
OptionForm.LimitComboBox.Enabled:=Ini.ReadBool('View','Windows_Move_Limit',false);
//выход окна за пределы рабочего окна
//сохранение настроек выбора режима
OptionForm.PropertiesCheckBox.Checked:=Ini.ReadBool('Properties','Properties_Save',true);
//сохранение настроек выбора режима
//положение окон
OptionForm.LocationCheckBox.Checked:=Ini.ReadBool('View','Windows_Location_Save',false);
if Ini.ReadBool('View','Windows_Location_Save',false)=true
then begin
Left:=Ini.ReadInteger('View','Windows_Location_Left',0);
Top:=Ini.ReadInteger('View','Windows_Location_Top',0);
end;
//положение окон
end;
procedure TForm1.FormDestroy(Sender: TObject);
var MainHandle: THandle;
begin
if Win32Platform = VER_PLATFORM_WIN32_NT then
begin
MainHandle := OpenProcess(PROCESS_ALL_ACCESS, false, GetCurrentProcessID);
SetProcessWorkingSetSize(MainHandle, DWORD(-1), DWORD(-1));
CloseHandle(MainHandle);
end;
end;
procedure TForm1.KillProgram(ClassName: PChar; WindowTitle: PChar);
const
PROCESS_TERMINATE = $0001;
var
ProcessHandle:THandle;
ProcessID:Integer;
TheWindow:HWND;
begin
TheWindow:=FindWindow(Classname, WindowTitle);
GetWindowThreadProcessID(TheWindow, @ProcessID);
ProcessHandle:=OpenProcess(PROCESS_TERMINATE, FALSE, ProcessId);
TerminateProcess(ProcessHandle,4);
end;
end. |