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:
Where iPosX and iPosY are the coordinates of icon on my taskbar window.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;
Before sending message, in function processing mouse events is this code fragment:
What is incorrect?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;




Reply With Quote