Recent

Author Topic: (SLV)StayOnTop Over Start winButton  (Read 1440 times)

codeman

  • Jr. Member
  • **
  • Posts: 78
(SLV)StayOnTop Over Start winButton
« on: March 02, 2015, 06:52:27 pm »
I found this code from delphi, but i get TCreateParams not found, i want my app to be onTop from Start WinButton when i press VK_LWIN or VK_RWIN, how to make it work?

Code: [Select]
procedure TForm1.CreateParams
   (var Params: TCreateParams);
begin
  inherited CreateParams(Params);
  with Params do begin
  ExStyle := ExStyle or WS_EX_TOPMOST;
    WndParent := GetDesktopwindow;
  end;
end;
« Last Edit: March 02, 2015, 08:00:26 pm by codeman »
Lazarus v2.02 Win10

ChrisF

  • Hero Member
  • *****
  • Posts: 542
Re: StayOnTop Over Start winButton(?)
« Reply #1 on: March 02, 2015, 07:13:43 pm »
I'm not sure your code will act as you wish. Anyway:

- for TCreateParams: add LCLType in you 'uses' clause,
- for GetDesktopwindow: add Windows in you 'uses' clause.
« Last Edit: March 02, 2015, 07:22:40 pm by ChrisF »

Xirax

  • New Member
  • *
  • Posts: 34
Re: StayOnTop Over Start winButton(?)
« Reply #2 on: March 02, 2015, 07:16:05 pm »
Test it:
Code: [Select]
SetWindowPos(Self.Handle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE or SWP_NOMOVE or SWP_NOACTIVATE);An easy way to keep on top is put this code in a timer with a small interval but I know its not beautiful but it do the job until you find a better way.

codeman

  • Jr. Member
  • **
  • Posts: 78
Re: StayOnTop Over Start winButton(?)
« Reply #3 on: March 02, 2015, 08:00:06 pm »
I got the result i wanted!
Thanks guys.
Lazarus v2.02 Win10

 

TinyPortal © 2005-2018