procedure TToolbar.ShowSearchMain(
var Message: TMessage);
var
pt: TPOINT;
rect: TRect;
hPopup: HMENU;
BMP: TBitmap;
begin
SendMessage(hToolbarMain, TB_GETITEMRECT, 3, LPARAM(@Rect));
pt.x := Rect.Right;
pt.y := Rect.Bottom - 1;
Windows.ClientToScreen(hToolbarMain, pt);
if pt.x < 0
then pt.x := 0;
begin
hPopup := CreatePopupMenu;
bmp := TBitmap.Create;
bmp.LoadFromResourceID(hinstance, 101);
bmp.TransparentColor :=
rgb(255, 0, 255);
bmp.Transparent := true;
AppendMenu(hPopup, MF_STRING, IDM_SEARCH1, PChar('
SUCHTYPE 1'));
SetMenuItemBitmaps(hPopUp, 0, MF_BYPOSITION, Bmp.Handle, Bmp.Handle);
AppendMenu(hPopup, MF_SEPARATOR, 0, '
');
AppendMenu(hPopup, MF_STRING, IDM_SEARCH2, PChar('
SUCHTYPE 2'));
TrackPopupMenu(hPopup, TPM_CENTERALIGN
or TPM_LEFTBUTTON,
pt.x, pt.y, 0, hToolbarMain,
nil);
DestroyMenu(hPopup);
end;
end;