Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7915077
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T14:20:15+00:00 2026-06-03T14:20:15+00:00

I encountered a weird issue with XE2: I’m using HWND_TOPMOST with SetWindowPos to set

  • 0

I encountered a weird issue with XE2:

I’m using HWND_TOPMOST with SetWindowPos to set my form on top, but if I switch VCL styles at runtime, the window isn’t topmost anymore, and unsetting/re-setting it doesn’t fix it either.

Any way to fix this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T14:20:16+00:00Added an answer on June 3, 2026 at 2:20 pm

    Your problem is that the form is being recreated because of a style change and loosing its top most style since the VCL have no knowledge of this. Either use:

    FormStyle := fsStayOnTop; 
    

    or override CreateWindowHandle so that SetWindowPos is called each time the form is recreated:

    type
      TForm1 = class(TForm)
        ..
      protected
        procedure CreateWindowHandle(const Params: TCreateParams); override;
      ..
    
    procedure TForm1.CreateWindowHandle(const Params: TCreateParams);
    begin
      inherited;
      SetWindowPos(Handle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE or SWP_NOMOVE);
    end;
    

    BTW, I couldn’t duplicate “unsetting/re-setting doesn’t fix it”. With my tests, calling SetWindowPos again fixed it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've encountered a weird issue while using Reflection. So I have a domain class
I encountered some very weird behaviour which I think is a bug, but I
We are facing a weird issue. We have NFS set up with 2 machines
I've encountered a weird problem about positioning bodies in cocos2d/box2d. If I set b2BodyDef
I have encountered a very weird behavior while using SimpleDateFormat for parsing a string
I've encountered a very weird problem with WF4: when I use Switch activity and
I've just encountered a weird problem, I'm trying to printf an integer variable, but
I've encountered a weird issue that has gotten me stumped for a few days
I encountered a weird problem while using python multiprocessing library. My code is sketched
I was working on HTTP post using java and encountered a weird stream behavior.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.