CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2011
    Location
    Poland
    Posts
    12

    Shell replacement - The tray window

    Hello everyone!

    I'm trying to make my own shell (explorer.exe) for Windows XP / 7.

    I did the first part - tray window, but... it still has some bugs. For example: if I click the right mouse button on the Avira Antivir (v10) icon - it's popup menu does not show. But if I click on another icon - for example - speaker icon, AIMP 3 or other application then popup menu is showing up.

    No matter which icon I click - menu usually shows up in the wrong place (wrong coordinates) or disappears after a while. I think that problem is in the method of sending message to application window, but I don't know what is incorrect.

    I'm writing my shell in Delphi 7 Personal, but all is based on WinAPI, so it should not matter to you.

    Here is the code of function sending message to applications:
    Code:
    procedure TTaskbarWindow.TrayNotify(const lpTrayItem: PTrayItem; const uMsg: UINT);
    begin
      if (lpTrayItem^.uVersion >= 4) then
        SendNotifyMessage(lpTrayItem^.hWindow, lpTrayItem^.uCallbackMessage, MAKEWPARAM(lpTrayItem^.iPosX, lpTrayItem^.iPosY), MAKELPARAM(uMsg, lpTrayItem^.uID))
      else
        SendNotifyMessage(lpTrayItem^.hWindow, lpTrayItem^.uCallbackMessage, lpTrayItem^.uID, uMsg);
    end;
    Where iPosX and iPosY are the coordinates of icon on my taskbar window.

    Before sending message, in function processing mouse events is this code fragment:
    Code:
        if (uMsg <> WM_MOUSEMOVE) then
        begin
          if (IsWindow(lpTrayItem^.hWindow)) then
          begin
            //if (not AllowSetForegroundWindow(lpTrayItem^.hWindow)) then
            if (not AllowSetForegroundWindow(DWORD(ASFW_ANY))) then
              SetForegroundWindow(lpTrayItem^.hWindow);
          end;
        end;
    What is incorrect?

  2. #2
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,620

    Re: Shell replacement - The tray window

    See NOTIFYICONDATA Structure article, uCallbackMessage section. You need to build callback notification parameters in accordance with uVersion specifics.
    Best regards,
    Igor

  3. #3
    Join Date
    Aug 2011
    Location
    Poland
    Posts
    12

    Re: Shell replacement - The tray window

    Yes, I know about it.
    Avira have uVersion == 0, so this:
    Code:
    SendNotifyMessage(lpTrayItem^.hWindow, lpTrayItem^.uCallbackMessage, lpTrayItem^.uID, uMsg);
    should work, but doesn't.

    Popup menu is showing both for icons with uVerson == 0 and uVersion > 0, for example:
    AIMP 3 (uVersion == 20000). But the main problem is to Avira.

    BTW - I'm testing all under Windows XP, but my target is Windows 7.

  4. #4
    Join Date
    Aug 2011
    Location
    Poland
    Posts
    12

    Re: Shell replacement - The tray window

    Look at logs from my application (in attachment).
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured