Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 173
  • Last Modified:

Window On Top question

Is there a better way to alter a form between 'StayOnTop' and 'Normal'. I ams setting the forms formstyle property to fsstayontop or fsnormal but I get an anoying flicker when I do this.... Anyone know of a way to toggle between states without flicker?
0
davegreen
Asked:
davegreen
  • 6
  • 2
1 Solution
 
davegreenAuthor Commented:
I just read in the Delphi help that it is inadvisable to alter formstyle at runtime. Many programs let you change between stayontop and normal at run time... Whats the best way?

0
 
rwilson032697Commented:
Try using LockWindowUpdate(Form.Handle) before changing it and LockWindUpdate(0) after changing it.

I am not 100% sure if this will work but its worth a try...

Cheers,

Raymond.
0
 
davegreenAuthor Commented:
I tried this one... this on win98 has the side effect of making all icons flash on the desktop, plus the form still flashes :(

0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
MadshiCommented:
Try using SetWindowPos with HWND_NOTOPMOST and HWND_TOPMOST...

Regards, Madshi.
0
 
davegreenAuthor Commented:
Thanks Madshi... any idea what unit I need to include in the uses clause?
0
 
davegreenAuthor Commented:
Madshi, have you got an example of its use. I tried SetWindowPos(hwnd,HWND_TOPMOST,1,1,1,1,SWP_NOMOVE + SWP_NOSIZE) but it fails to compile... any ideas?

0
 
davegreenAuthor Commented:
Madshi,
Well, I'm stupid.. as you can see I should have used handle instead of hwnd and it would have compiled.

Anyway.. it WORKS!  .. no flicker!
Answer the question... the points are yours.
Thanks Matshi for pointing me in this direction. :)

0
 
MadshiCommented:
Great, that it works. Was not sure about it...  :-)

Thanx for the points...

Regards, Madshi.
0
 
davegreenAuthor Commented:
Thanks again Madshi :)

0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 6
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now