Giter Club home page Giter Club logo

Comments (4)

gcardi avatar gcardi commented on August 16, 2024 1

Resolved by adding...

    ::SetWindowPos(
        Fmx::Platform::Win::ApplicationHWND(),
        HWND_TOPMOST, 0, 0, 0, 0,
        SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE 
    );

after

    trayIcon_->Show();

Example:

void TfrmMain::MinimizeToTrayBar()
{
    Hide();
    trayIcon_->Show();

    ::SetWindowPos(
        Fmx::Platform::Win::ApplicationHWND(),
        HWND_TOPMOST, 0, 0, 0, 0,
        SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE 
    );

    HideAppOnTaskbar();
}

Regards

from fmxtrayicon.

HemulGM avatar HemulGM commented on August 16, 2024 1

Oh, thank you very much. I have not made edits for a long time, and I myself have used it for a long time. But I think it's time to fix it. Thanks again. Maybe today I will fix it using your suggestion

from fmxtrayicon.

HemulGM avatar HemulGM commented on August 16, 2024 1

Fixed popup menu display. Do additional actions before or after - not necessary

from fmxtrayicon.

gcardi avatar gcardi commented on August 16, 2024

Hi.

I noticed that after minimizing the main window in the tray icon as per the code in the previous posts, when I would restore the window it would always remain topmost, always overstanding all other applications. Since this is an annoying problem, I solved it by declaring HWND_NOTOPMOST in the call to SetWindowPos when restoring from the tray bar (by double-clicking on the tray icon).

void TfrmMain::RestoreFromTrayBar()
{
    ::SetWindowPos(
        Fmx::Platform::Win::WindowHandleToPlatform( Handle )->Wnd,
        HWND_NOTOPMOST,
        0, 0, 0, 0,
        SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_SHOWWINDOW
    );
    trayIcon_->Hide();
    ShowAppOnTaskbar();
}

Note, however, that this time I did not use the application handle, but the main window handle.

To recap: when minimizing you should use the application handle and the HWND_TOPMOST flag in the SetWindowPos, and when restoring you should use the main window handle and HWND_NOTOPMOST when calling the SetWindowsPos.

from fmxtrayicon.

Related Issues (1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.