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 8173823
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T22:17:49+00:00 2026-06-06T22:17:49+00:00

I want to use in my wpf aplication notify icon (with .dll library in

  • 0

I want to use in my wpf aplication notify icon (with .dll library in project http://www.codeproject.com/Articles/36468/WPF-NotifyIcon).

But I don’t know, how to show my window (after minimize to tray) by double click in tray icon.

I declared new command

namespace MyBasicFlyffKeystroke
{
    class ShowWindowCommand : ICommand
    {
        public void Execute(object parameter)
        {
            Window1 window = new Window1();
            window.Show();
        }

        public bool CanExecute(object parameter)
        {
            return true;
        }

        public event EventHandler CanExecuteChanged;
    }
}

And I used it in my window1.xaml file:

<tb:TaskbarIcon x:Name="notifyIcon" IconSource="icon.ico" ToolTipText="MyBasicFlyffKeystroke" 
    DoubleClickCommand="{StaticResource ShowWindow}">                    
</tb:TaskbarIcon>

and

<Grid.Resources>
    <my:ShowWindowCommand x:Key="ShowWindow" />
</Grid.Resources>

But after double clicking open new instance with Window1… Is any metod here?

Best regards,
Dagna

  • 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-06T22:17:51+00:00Added an answer on June 6, 2026 at 10:17 pm

    Try add an event handler for window messages

    Command

    namespace MyBasicFlyffKeystroke
    {
        class ShowWindowCommand : ICommand
        {
            public void Execute(object parameter)
            {
                // Broadcast isn't a good idea but work...
                NativeMethods.PostMessage((IntPtr)NativeMethods.HWND_BROADCAST, NativeMethods.WM_SHOWME, IntPtr.Zero, IntPtr.Zero);
            }
    
            public bool CanExecute(object parameter)
            {
                return true;
            }
    
            public event EventHandler CanExecuteChanged;
        }
    }
    

    In Window1

    protected override void OnSourceInitialized(EventArgs e) {
        base.OnSourceInitialized(e);
        HwndSource source = PresentationSource.FromVisual(this) as HwndSource;
        source.AddHook(WndProc);
    }
    
    private IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled) {
        if (msg == NativeMethods.WM_SHOWME) {
            WindowState = WindowState.Normal;
        }
        return IntPtr.Zero;
    }
    

    And in NativeMethods (UPDATED)

    public static readonly int HWND_BROADCAST = 0xffff;
    public static readonly int WM_SHOWME = RegisterWindowMessage("WM_SHOWME");
    
    [DllImport("user32.dll")]
    public static extern int RegisterWindowMessage(string message);
    
    [DllImport("user32.dll")]
    public static extern bool PostMessage(IntPtr hwnd, int msg, IntPtr wparam, IntPtr lparam);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am starting a project from scratch in WPF using SQLite.I want to use
I want to use WPF windows in a legacy win32 application. I'd like to
I want use BYTE_ORDER macro in my Xcode project but i can't because i
I am implementing WPF Application and i want to use System.Windows.Automation Namespace to capture
How to use MVVM in WPF Browser Application? I want to know how to
I want to use twitter streaming API in my WPF application, I am able
I want use MVVM design pattern in WPF and Silverlight Application. Where can i
I want to use RadWindow as the main window of my WPF application. So
When writing a WPF application using MVVM, I want to use a WCF service,
Scenario: I want to use 3 standard font size for my WPF application :

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.