Top.Mail.Ru
Мастера DELPHI, Delphi programming community Титульная страница Поиск, карта сайта Написать письмо 
| Новости | Поиск | FAQ | Статьи | Книги | Новости VCL |
| Форумы ЧАТ | Орешник | KOL и MCK |
Форумы -» Основная («Начинающим»)/ Базы / WinAPI / Компоненты / Сети / Media / Игры / Corba и COM / KOL / FreePascal / .Net / Прочее / RSDN.ORG

« предыдущая ветвь | форум | следующая ветвь »

Укажите ошибку (почему прга не реагирует на мессаги) .


case ©   (2006-08-20 15:39:00) 

Появилась необходимость написать очень компактное приложение.  
Подскажите, пожалуйста, где моя ошибка (не реагирует на мессаги) или как выполнить эту задачу правильно.


uses Windows, Messages, Kol;

const pass='qwerty';

var box:pcontrol;

function press(var Msg: tagMSG; var Rslt: Integer):Boolean;
begin
 if (msg.message=wm_keydown) and (msg.wparam=vk_return) then begin
   if (box.text=pass) then showmessage('True')
     else showmessage('Wrong');
 end;

 result:=false;
end;

begin
 Applet:=NewForm(Nil,'Enter Password').setsize(200,50);
 Applet.Border:=0;
 Applet.CenterOnParent;
 Applet.CanResize:=false;

 Box:=neweditbox(applet,[eoPassword]).setalign(caclient);
 Box.onmessage:=tonmessage(MakeMethod(box,@press));

 Run(Applet);
end.


thaddy   (2006-08-20 18:08:00) [1]

Better read the documentation for makemethod!!!!


program Project1;
uses Windows, Messages, Kol;

const pass='qwerty';

var box:pcontrol;

function press(dummy:pointer;var Msg: tagMSG; var Rslt: Integer):Boolean;
begin
if (msg.message=wm_keydown) and (msg.wparam=vk_return) then begin
  if (box.text=pass) then showmessage('True')
    else showmessage('Wrong');
end;

result:=false;
end;

begin
Applet:=NewForm(Nil,'Enter Password').setsize(200,50);
Applet.Border:=0;
Applet.CenterOnParent;
Applet.CanResize:=false;

Box:=neweditbox(applet,[eoPassword]).setalign(caclient);
Box.onmessage:=tonmessage(MakeMethod(box,@press));

Run(Applet);
end.


Наверх

Титульная страница Поиск, карта сайта Написать письмо