Thread: Messages not getting through

  1. #1
    Registered User
    Join Date
    Aug 2001
    Location
    Melbourne, Australia
    Posts
    92

    Messages not getting through

    Heya all!
    I haven't been here for a while (I haven't had many problems, fortuanately... but I suppose thats a lame excuse, I probably should be helping out :$). But now I have a problem.

    I have a system tray icon (i'm thinking that the same would occur if i was using something else) that pops up a dialog when the left mouse button is pressed down on it (Using DoModal). The dialog appears covering the tray icon (its a navigator of sorts... works like popup palletes in graphics programs) and when you let up the mouse button, it closes. My problem is that until the user lets up their mouse button after the original mouse down press on the tray icon, the dialog recieves NO MESSAGES other than some initialization ones. (I checked to make sure this is really the case by tracing all message going through PreTranslateMessage). This means that the whole operation of down on the tray icon, move mouse around in the window then letting the mouse up again can NOT be done in a single click :S!

    Does anyone know how to solve this problem? Any help and or comments would be appreciated.

    Thanks,
    Jeff
    psychobrat at gmail

  2. #2
    Registered User johnnie2's Avatar
    Join Date
    Aug 2001
    Posts
    186
    When's the last time you've seen behavior other than this regarding tray icons?
    "Optimal decisions, once made, do not need to be changed." - Robert Sedgewick, Algorithms in C

  3. #3
    Registered User
    Join Date
    Aug 2001
    Location
    Melbourne, Australia
    Posts
    92
    Well, to tell you the truth, I've never used tray icons before in C++, this is my first shot. So, you think the tray icon is at fault? Know any ways that I can give it a bit of a kick and tell it to start getting messages?

    Thanks,
    Jeff
    psychobrat at gmail

  4. #4
    Registered User
    Join Date
    Aug 2001
    Location
    Melbourne, Australia
    Posts
    92

    AHA!

    New discovery:

    What I said at first isn't entirely correct - its not ALL messages that aren't getting through, it turns out that its only MOUSE messages that aren't getting through

    This suggests to me that it isn't the tray icon's fault?

    -out-
    Jeff
    psychobrat at gmail

  5. #5
    Registered User
    Join Date
    Aug 2001
    Location
    Melbourne, Australia
    Posts
    92

    MAJOR BREAKTHROUGH

    Ok! I seem to be talking to myself, but maybe after this somebody else might be able to help me . I've narrowed the problem down significantly... so now here's what I know is what's going on:

    When I press the moues down on the tray icon, WINDOWS does a SetCapture on the system tray window (which makes all mouse messages be sent to that hwnd until ReleaseCapture is called, or the mouse button is released).

    So I have to somehow release the capture that the system tray has done. The problem with this is that ReleaseCapture can only release the capture from the thread it is called from (its void, and that's what it says it does in MSDN).

    Does anybody know some function that I could use to release the capture from the system tray's window, or a 'global' version of ReleaseCapture that will release any captures from all threads?

    THANKS GUYS!

    -out-
    Jeff
    psychobrat at gmail

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Messages Between Different Architectures
    By Cell in forum Linux Programming
    Replies: 5
    Last Post: 05-07-2009, 03:40 AM
  2. Spy++ view messages posted/sent to a control, or from it?
    By hanhao in forum Windows Programming
    Replies: 2
    Last Post: 06-24-2007, 11:07 PM
  3. Sending windows messages
    By Ideswa in forum Windows Programming
    Replies: 2
    Last Post: 03-02-2006, 01:27 PM
  4. Intercepting messages
    By ScriptBlue in forum Windows Programming
    Replies: 2
    Last Post: 06-23-2005, 12:10 AM