⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 getqueuestatusu.pas

📁 Delphi Win32核心API参考光盘
💻 PAS
字号:
  unit GetQueueStatusU;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    ListBox1: TListBox;
    ListBox2: TListBox;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

  function PrintStatus(Index: Integer; ListBox: TListBox): string;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
var
  CurrentMessage: DWORD;
begin
  {look for any message}
  CurrentMessage := GetQueueStatus(QS_ALLINPUT);

  {display the queue status}
  PrintStatus(HiWord(CurrentMessage), ListBox1);
  PrintStatus(LoWord(CurrentMessage), ListBox2);
  Label3.Caption := 'GetQueueStatus value: '+IntToHex(CurrentMessage, 8);
end;

{this simply converts the GetQueueStatus return value into a string}
function PrintStatus(Index: Integer; ListBox: TListBox): string;
begin
  ListBox.Items.Clear;
  
  if (Index and QS_KEY)=QS_KEY
    then ListBox.Items.Add('QS_KEY');
  if (Index and QS_MOUSEMOVE)=QS_MOUSEMOVE
    then ListBox.Items.Add('QS_MOUSEMOVE');
  if (Index and QS_MOUSEBUTTON)=QS_MOUSEBUTTON
    then ListBox.Items.Add('QS_MOUSEBUTTON');
  if (Index and QS_POSTMESSAGE)=QS_POSTMESSAGE
    then ListBox.Items.Add('QS_POSTMESSAGE');
  if (Index and QS_TIMER)=QS_TIMER
    then ListBox.Items.Add('QS_TIMER');
  if (Index and QS_PAINT)=QS_PAINT
    then ListBox.Items.Add('QS_PAINT');
  if (Index and QS_SENDMESSAGE)=QS_SENDMESSAGE
    then ListBox.Items.Add('QS_SENDMESSAGE');
  if (Index and QS_HOTKEY)=QS_HOTKEY
    then ListBox.Items.Add('QS_HOTKEY');
  if (Index and QS_ALLPOSTMESSAGE)=QS_ALLPOSTMESSAGE
    then ListBox.Items.Add('QS_ALLPOSTMESSAGE');
end;


end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -