Thema: Delphi Form inaktiv anzeigen

Einzelnen Beitrag anzeigen

Benutzerbild von Stevie
Stevie

Registriert seit: 12. Aug 2003
Ort: Soest
4.012 Beiträge
 
Delphi 10.1 Berlin Enterprise
 
#10

Re: Form inaktiv anzeigen

  Alt 28. Okt 2004, 17:38
So, bitteschön! Form wird erst bei einem Klick aktiviert!
Delphi-Quellcode:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, afxCodeHook;

type
  TForm1 = class(TForm)
    procedure FormActivate(Sender: TObject);
  end;

var
  Form1: TForm1;
  ShowWindowNextHook: function(hWnd: HWND; nCmdShow: Integer): LongBool; stdcall;

function ShowWindowHookProc(hWnd: HWND; nCmdShow: Integer): LongBool; stdcall;

implementation

{$R *.dfm}

function ShowWindowHookProc(hWnd: HWND; nCmdShow: Integer): LongBool; stdcall;
begin
  if nCmdShow = SW_SHOWNORMAL then
    Result := ShowWindowNextHook(hWnd, SW_SHOWNOACTIVATE)
  else
    Result := ShowWindowNextHook(hWnd, nCmdShow);
end;

procedure TForm1.FormActivate(Sender: TObject);
begin
  ShowMessage('Test!');
end;

initialization
  HookCode('user32', 'ShowWindow', @ShowWindowHookProc, @ShowWindowNextHook);

finalization
  UnHookCode(@ShowWindowNextHook);

end.
Die afxCodeHook-Lib gibts hier!
Stefan
“Simplicity, carried to the extreme, becomes elegance.” Jon Franklin

Delphi Sorcery - DSharp - Spring4D - TestInsight
  Mit Zitat antworten Zitat