Thread: Dividing window into regions

  1. #1
    Registered User
    Join Date
    Nov 2001

    Dividing window into regions

    I would like to divide a window into irregularly shaped regions that I would name, for instance, Region 1, Region 2, etc. What I want to do is when the window is clicked using the mouse my code should alert me as to which region is being accessed, perhaps via a message box. How can I partition my window?

    Thanks in advance.

  2. #2
    Master of the Universe! velius's Avatar
    Join Date
    Sep 2003
    First you have this post on the wrong board, it should be on the Windows Programming board. Secondly you need to do a hit test in response to the WM_MOUSEMOVE event to know where the pointer is. Or since you want this information during the click you would handle it during a WM_LBUTTONDOWN or WM_LBUTTONUP message.
    While you're breakin' down my back n'
    I been rackin' out my brain
    It don't matter how we make it
    'Cause it always ends the same
    You can push it for more mileage
    But your flaps r' wearin' thin
    And I could sleep on it 'til mornin'
    But this nightmare never ends
    Don't forget to call my lawyers
    With ridiculous demands
    An you can take the pity so far
    But it's more than I can stand
    'Cause this couchtrip's gettin' older
    Tell me how long has it been
    'Cause 5 years is forever
    An you haven't grown up yet
    -- You Could Be Mine - Guns N' Roses

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    Moved thread
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  4. #4
    Grammar Police HybridM's Avatar
    Join Date
    Jan 2003
    Look up regions.

    Specifially look up:
    CreatePolygonRgn() and CreatePolyPolygonRgn()

    And you can then use PtInRegion() (pointer in region) which will tell you if the pointer is inside the region (pass it the region handle and the LO/HI word of lParam in the mouse messages.

    Haven't tested this just looked it up then in the reference, so it may not be what you're looking for.
    Thor's self help tip:
    Maybe a neighbor is tossing leaf clippings on your lawn, looking at your woman, or harboring desires regarding your longboat. You enslave his children, set his house on fire. He shall not bother you again.

    OS: Windows XP
    Compiler: MSVC

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C or C++
    By AcerN30 in forum Game Programming
    Replies: 41
    Last Post: 05-30-2008, 06:57 PM
  2. WM_CAPTION causing CreateWindowEx() to fail.
    By Necrofear in forum Windows Programming
    Replies: 8
    Last Post: 04-06-2007, 08:23 AM
  3. 6 measly errors
    By beene in forum Game Programming
    Replies: 11
    Last Post: 11-14-2006, 11:06 AM
  4. Linking OpenGL in Dev-C++
    By linkofazeroth in forum Game Programming
    Replies: 4
    Last Post: 09-13-2005, 10:17 AM
  5. OpenGL Window
    By Morgul in forum Game Programming
    Replies: 1
    Last Post: 05-15-2005, 12:34 PM