Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. UnClickable window... Clicks thru

UnClickable window... Clicks thru

Scheduled Pinned Locked Moved C / C++ / MFC
question
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Y Offline
    Y Offline
    yytg
    wrote on last edited by
    #1

    How do you create a window so when someone clicks on it the click event go to the window under it? (not the parent) thanks in advance

    C A 2 Replies Last reply
    0
    • Y yytg

      How do you create a window so when someone clicks on it the click event go to the window under it? (not the parent) thanks in advance

      C Offline
      C Offline
      Christopher W Smith
      wrote on last edited by
      #2

      What do you mean by "the window under it"? Do you mean in the z-order, or perhaps the window that created the current window??? "the window under it" could be any window. Whichever window you mean, it's pretty easy to notify another window of an event in the current window. First add a WM_LBUTTONDOWN handler to both windows. (http://msdn.microsoft.com/en-us/library/ms645607(VS.85).aspx[^]) in the window class header files under DECLARE_MESSAGE_MAP()

      afx_msg void OnLButtonDown(UINT nFlags, CPoint point);

      in the window class source file for the window being clicked:

      ...
      //pass the message on to another window...
      void CMyWnd::OnLButtonDown(UINT nFlags, CPoint point)
      {
      m_NotifyWnd.SendMessage(WM_LBUTTONDOWN);
      }
      ...
      //under BEGIN_MESSAGE_MAP
      ON_WM_LBUTTONDOWN()
      ...

      where m_NotifyWnd is whatever window you want to notify of the click. Also remember to add the message map for the window receiving the notification. I did not preserve wparam and lparam across the SendMessage call, you will probably want to read up on the message (link above) and finish the code with the wparam and lparam arguments. Insofar as finding the correct window to notify, I direct you to the following CWnd member functions to check out (since I'm not quite sure what you're looking for): CWnd::GetParent[^] CWnd::GetOwner[^] CWnd::GetParentOwner[^] Additionally you can create a member of your class to store a pointer or reference to some other window to notify. Hope that helps :)

      Chris Smith

      1 Reply Last reply
      0
      • Y yytg

        How do you create a window so when someone clicks on it the click event go to the window under it? (not the parent) thanks in advance

        A Offline
        A Offline
        aks
        wrote on last edited by
        #3

        Create a layared window. For more pls check SetLayeredWindowAttributes() in MSDN for how to create a layared window. Then set the Transparent property( WS_EX_TRANSPARENT ) for the dialog. Now the messages to the layared wnidow will be transferred to the window underlying it.

        aks

        Y 1 Reply Last reply
        0
        • A aks

          Create a layared window. For more pls check SetLayeredWindowAttributes() in MSDN for how to create a layared window. Then set the Transparent property( WS_EX_TRANSPARENT ) for the dialog. Now the messages to the layared wnidow will be transferred to the window underlying it.

          aks

          Y Offline
          Y Offline
          yytg
          wrote on last edited by
          #4

          Thanks

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups