Board index » delphi » SHAppBarMessage

SHAppBarMessage

Hi!

I'm trying to create a popup-menu at my taskbar-icon.
Only problem ist to get the position of mouse click - the one
I receive with the event is in the taskbar. This would be no
problem if I knew the position of the taskbar. I found
SHAppBarMesagge with ABM_GETTASKBARPOS which
should give me exactly this information. But everytime I
use this function I get an error (i = 0 = false).
Hope anybody can tell me what is wrong or another solution
for my problem.

procedure TFenster.IconBarMouseUp(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
Var
    tabd : TAppBarData;
    i : integer;
begin
    i := SHAppBarMessage( ABM_GETTASKBARPOS, tabd );
    PopupMenu1 . PopUp (X+tabd.rc.left , Y+tabd.rc.top );
end;

Thorsten

--------------------------------------------------------
Thorsten Kuthe, Melatenguertel 23, 50933 Koeln, FRG      
E-mail: a2753...@athena.rrz.uni-koeln.de
      ***** Never change a working computer *****

 

Re:SHAppBarMessage


Quote
Thorsten Kuthe wrote:

> Hi!

> I'm trying to create a popup-menu at my taskbar-icon.
> Only problem ist to get the position of mouse click - the one
> I receive with the event is in the taskbar. This would be no
> problem if I knew the position of the taskbar. I found
> SHAppBarMesagge with ABM_GETTASKBARPOS which
> should give me exactly this information. But everytime I
> use this function I get an error (i = 0 = false).
> Hope anybody can tell me what is wrong or another solution
> for my problem.

> procedure TFenster.IconBarMouseUp(Sender: TObject; Button: TMouseButton;
>       Shift: TShiftState; X, Y: Integer);
> Var
>     tabd : TAppBarData;
>     i : integer;
> begin
>     i := SHAppBarMessage( ABM_GETTASKBARPOS, tabd );
>     PopupMenu1 . PopUp (X+tabd.rc.left , Y+tabd.rc.top );
> end;

> Thorsten

> --------------------------------------------------------
> Thorsten Kuthe, Melatenguertel 23, 50933 Koeln, FRG
> E-mail: a2753...@athena.rrz.uni-koeln.de
>       ***** Never change a working computer *****

I think you have to fill in the cbSize (to sizeof(TAppBarData)) and hWnd
fields of the TAppBarData before making the call.

Chris Jobson

Other Threads