Recent

Author Topic: KOL-CE, Disable/enable or intercept hardware buttons  (Read 6688 times)

JohnvdWaeter

  • Full Member
  • ***
  • Posts: 171
    • http://www.jvdw.nl
KOL-CE, Disable/enable or intercept hardware buttons
« on: March 23, 2009, 10:21:13 am »
Hi All,

In my KOL-CE project I'd like to disable/enable or intercept the hardware buttons.

If I try to set the Kolforms KeyPreview to True, I get a compiler message that says:

Error: identifier idents no member "KeyPreview"

Would the Kolforms Onmessage-handler be the right place? If so, what's the message to look at?

Anyone?
tia
John

Al Berto

  • New Member
  • *
  • Posts: 16
Re: KOL-CE, Disable/enable or intercept hardware buttons
« Reply #1 on: January 28, 2010, 06:27:05 pm »
Hi,
to have the key preview I put the define clause {$DEFINE KEY_PREVIEW} in the KOL.pas, after {$DEFINE GDI}.

Then set the TKOLform.KeyPreview := TRUE.

Some buttons are managed by operating system so if you want to manage, for example, the Green button, you should tell to operating system (I put in the form creation):

SendMessage(SHFindMenuBar(form.Handle), SHCMBM_OVERRIDEKEY, VK_TTALK, MAKELPARAM(SHMBOF_NODEFAULT OR SHMBOF_NOTIFY, SHMBOF_NODEFAULT OR SHMBOF_NOTIFY));

where VK_TTALK=VK_F3;

After that, the OnMessage event of the TKOLForm will be called every button is pressed, and to know if it's the Green button

  if (msg.message = WM_HOTKEY) then begin
    case Hi(msg.lParam) of
      VK_TTALK: ...
    end;
  end;

That's all
bye

Alberto

 

TinyPortal © 2005-2018