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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T02:26:34+00:00 2026-05-16T02:26:34+00:00

When left single click on the clock in the taskbar on Windows 7 (maybe

  • 0

When left single click on the clock in the taskbar on Windows 7 (maybe Vista too) a popup opens showing calender and clock(s) (thus not the date and time adjust window). How do I open this window myself (preferred in C#)?

I was hoping timedate.cpl would call this, but this opens the date and time adjust window.

  • 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-05-16T02:26:35+00:00Added an answer on May 16, 2026 at 2:26 am

    To show the clock you need to send the appropriate window message to the tray window. This can be done using the Windows API function SendMessage:

    using System;
    using System.ComponentModel;
    using System.Runtime.InteropServices;
    using System.Text;
    
    class ShowCalendar
    {
        private delegate bool EnumChildCallback(IntPtr hwnd, 
                ref IntPtr lParam);
    
        [DllImport("User32.dll")]
        private static extern bool EnumChildWindows(IntPtr hWndParent, 
                EnumChildCallback lpEnumFunc, 
                ref IntPtr lParam);
    
        [DllImport("User32.dll")]
        private static extern int GetClassName(IntPtr hWnd, 
            StringBuilder lpClassName, 
            int nMaxCount);
    
        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        private static extern IntPtr SendMessage(IntPtr hWnd, 
            UInt32 Msg, 
            IntPtr wParam, 
            IntPtr lParam);
    
        [DllImport("user32.dll", SetLastError = true)]
        private static extern IntPtr FindWindow(string lpClassName, 
            string lpWindowName);
    
        [DllImport("user32.dll", SetLastError = true)]
        private static extern IntPtr FindWindowEx(IntPtr hwndParent, 
            IntPtr hwndChildAfter, 
            string lpszClass, 
            string lpszWindow);
    
        [DllImport("user32.dll")]
        [return: MarshalAs(UnmanagedType.Bool)]
        private static extern bool GetWindowRect(IntPtr hWnd, 
                out RECT lpRect);
    
        [StructLayout(LayoutKind.Sequential)]
        private struct RECT
        {
            public int Left;        
            public int Top;         
            public int Right;       
            public int Bottom;      
        }
    
        private static readonly string TrayWndClassName = "Shell_TrayWnd";
        private static readonly string TrayNotifyWndClassName = "TrayNotifyWnd";
        private static readonly string ClockWndClassName = "TrayClockWClass";
        private static readonly uint WM_NCLBUTTONDOWN = 0x00A1;
        private static readonly uint HTCAPTION = 2;
    
        private static bool EnumChildProc(IntPtr hwndChild, ref IntPtr lParam)
        {
            StringBuilder className = new StringBuilder(128);
            GetClassName(hwndChild, className, 128);
    
            if (className.ToString() == ClockWndClassName)
            {
                lParam = hwndChild;
                return false;
            }
            return true;
        }
    
    
        static void Main(string[] args)
        {
            IntPtr hWndTray = FindWindow(TrayWndClassName, string.Empty);
            if (hWndTray == IntPtr.Zero)
            {
                throw new Win32Exception();
            }
    
            IntPtr hWndTrayNotify = FindWindowEx(hWndTray, 
                IntPtr.Zero, 
                TrayNotifyWndClassName, 
                string.Empty);
            if (hWndTrayNotify == IntPtr.Zero)
            {
                throw new Win32Exception();
            }
    
            // search clock window
            EnumChildCallback cb = new EnumChildCallback(EnumChildProc);
            IntPtr hWndClock = IntPtr.Zero;
            EnumChildWindows(hWndTray, cb, ref hWndClock);
            if (hWndClock == IntPtr.Zero)
            {
                throw new Win32Exception();
            }
    
            // get clock window position
            RECT rect;
            if (!GetWindowRect(hWndClock, out rect))
            {
                throw new Win32Exception();
            }
    
            // send click, lParam contains window position
            IntPtr wParam = new IntPtr(HTCAPTION);
            IntPtr lParam = new IntPtr(rect.Top << 16 | rect.Left);
            SendMessage(hWndTray, WM_NCLBUTTONDOWN, wParam, lParam);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 499k
  • Answers 499k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Well, it seems that Silverlight will not grant access to… May 16, 2026 at 12:34 pm
  • Editorial Team
    Editorial Team added an answer Turns out that if I pass the parameter of the… May 16, 2026 at 12:34 pm
  • Editorial Team
    Editorial Team added an answer it's because the content return by your block in your… May 16, 2026 at 12:34 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I am facing a strange problem . When i single click on my files
Background: We are developing a web application that includes charts. Currently one can left-click
The Beta 1 of VS 2010 does not seem to have a margin on
I know the attribute which makes the text disapear on the left part of
SELECT left_tbl.* FROM left_tbl LEFT JOIN right_tbl ON left_tbl.id = right_tbl.id WHERE right_tbl.id IS
I have two divs #left , and #right . the right div has a
I have a html page, on this page there are some images, when the
I am trying to set up an add-tab button in a Gtk::Notebook (gtkmm). I
I know nearly nothing about this all so I turn to you for some
I have a MSHTML-based control embedded in an application and the ContentEditable mode is

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.