I am running Lazarus 2.2.0 on 64 bit Windows. I can compile and run the program below, when I compile in 32-bit mode (Target OS Win32, Target CPU family i386, Target processor (Default), but when I change to 64-bit (Targget OS, Target CPU family, Target processor, alle (Default), then program still runs.
I still get avalue fra HotKeyDebugWindow around 4565 (a relatively low number),
but in TForm1.OnHotKey Msg.HotKey is a very high number ( eg 213008903045120), which is not identical to HotKeyDebugWindow.
Can anyone help?
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, Windows;
type
TWMHotKey = packed record
MSG: cardinal;
HotKey: PtrInt;
Unused: PtrInt;
Result: PtrInt;
end;
{ TForm1 }
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
private
procedure OnHotKey(var Msg: TWMHotKey); message WM_HOTKEY;
public
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
var
HotKeyDebugWindow: NativeInt;
procedure TForm1.FormCreate(Sender: TObject);
var
Result: longbool;
begin
HotKeyDebugWindow := GlobalAddAtom('Hotkey: SHITCTRLE');
Result := RegisterHotkey(Handle, HotKeyDebugWindow, MOD_CONTROL + MOD_SHIFT, Ord('E'));
ShowMessage(BoolToStr(result));
end;
procedure TForm1.OnHotKey(var Msg: TWMHotKey);
begin
if Msg.HotKey = HotKeyDebugWindow then
begin
ShowMessage('test');
end;
end;
end.