mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-13 04:02:54 +01:00
* fixed Win64 in behalf of Micha
git-svn-id: trunk@10119 -
This commit is contained in:
parent
0be210dffc
commit
107c5e7c0b
@ -103,6 +103,9 @@ const
|
|||||||
// Since W98 the size is 48 (hbmpItem was added)
|
// Since W98 the size is 48 (hbmpItem was added)
|
||||||
W95_MENUITEMINFO_SIZE = 44;
|
W95_MENUITEMINFO_SIZE = 44;
|
||||||
|
|
||||||
|
var
|
||||||
|
menuiteminfosize : DWORD = 0;
|
||||||
|
|
||||||
type
|
type
|
||||||
TCaptionFlags = (cfBold, cfUnderline);
|
TCaptionFlags = (cfBold, cfUnderline);
|
||||||
TCaptionFlagsSet = set of TCaptionFlags;
|
TCaptionFlagsSet = set of TCaptionFlags;
|
||||||
@ -139,7 +142,7 @@ var MenuItemIndex: integer;
|
|||||||
begin
|
begin
|
||||||
Result := MakeLResult(0, 0);
|
Result := MakeLResult(0, 0);
|
||||||
MenuItemIndex := -1;
|
MenuItemIndex := -1;
|
||||||
ItemInfo.cbSize := W95_MENUITEMINFO_SIZE;
|
ItemInfo.cbSize := menuiteminfosize;
|
||||||
ItemInfo.fMask := MIIM_DATA;
|
ItemInfo.fMask := MIIM_DATA;
|
||||||
if not GetMenuItemInfo(AMenuHandle, 0, true, @ItemInfo) then Exit;
|
if not GetMenuItemInfo(AMenuHandle, 0, true, @ItemInfo) then Exit;
|
||||||
FirstMenuItem := TMenuItem(ItemInfo.dwItemData);
|
FirstMenuItem := TMenuItem(ItemInfo.dwItemData);
|
||||||
@ -445,7 +448,7 @@ function ChangeMenuFlag(const AMenuItem: TMenuItem; Flag: Integer; Value: boolea
|
|||||||
var
|
var
|
||||||
MenuInfo: MENUITEMINFO;
|
MenuInfo: MENUITEMINFO;
|
||||||
begin
|
begin
|
||||||
MenuInfo.cbSize := W95_MENUITEMINFO_SIZE;
|
MenuInfo.cbSize := menuiteminfosize;
|
||||||
MenuInfo.fMask := MIIM_TYPE;
|
MenuInfo.fMask := MIIM_TYPE;
|
||||||
MenuInfo.dwTypeData := nil; // don't retrieve caption
|
MenuInfo.dwTypeData := nil; // don't retrieve caption
|
||||||
GetMenuItemInfo(AMenuItem.Parent.Handle, AMenuItem.Command, false, @MenuInfo);
|
GetMenuItemInfo(AMenuItem.Parent.Handle, AMenuItem.Command, false, @MenuInfo);
|
||||||
@ -466,7 +469,7 @@ var
|
|||||||
begin
|
begin
|
||||||
with MenuInfo do
|
with MenuInfo do
|
||||||
begin
|
begin
|
||||||
cbsize := W95_MENUITEMINFO_SIZE;
|
cbsize := menuiteminfosize;
|
||||||
if ACaption <> '-' then
|
if ACaption <> '-' then
|
||||||
begin
|
begin
|
||||||
fType := MFT_STRING;
|
fType := MFT_STRING;
|
||||||
@ -479,7 +482,7 @@ begin
|
|||||||
SetMenuItemInfo(AMenuItem.Parent.Handle, AMenuItem.Command, false, @MenuInfo);
|
SetMenuItemInfo(AMenuItem.Parent.Handle, AMenuItem.Command, false, @MenuInfo);
|
||||||
with MenuInfo do
|
with MenuInfo do
|
||||||
begin
|
begin
|
||||||
cbsize := W95_MENUITEMINFO_SIZE;
|
cbsize := menuiteminfosize;
|
||||||
fMask := MIIM_TYPE;
|
fMask := MIIM_TYPE;
|
||||||
fType := MFT_OWNERDRAW;
|
fType := MFT_OWNERDRAW;
|
||||||
dwTypeData:=LPSTR(ACaption);
|
dwTypeData:=LPSTR(ACaption);
|
||||||
@ -503,7 +506,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
ParentOfParent := AMenuItem.Parent.Parent.Handle;
|
ParentOfParent := AMenuItem.Parent.Parent.Handle;
|
||||||
with MenuInfo do begin
|
with MenuInfo do begin
|
||||||
cbSize := W95_MENUITEMINFO_SIZE;
|
cbSize := menuiteminfosize;
|
||||||
fMask:=MIIM_SUBMENU;
|
fMask:=MIIM_SUBMENU;
|
||||||
end;
|
end;
|
||||||
GetMenuItemInfo(ParentOfParent, AMenuItem.Parent.Command,
|
GetMenuItemInfo(ParentOfParent, AMenuItem.Parent.Command,
|
||||||
@ -517,7 +520,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
with MenuInfo do begin
|
with MenuInfo do begin
|
||||||
cbsize := W95_MENUITEMINFO_SIZE;
|
cbsize := menuiteminfosize;
|
||||||
if AMenuItem.Enabled then fState:=MFS_ENABLED else fstate:=MFS_GRAYED;
|
if AMenuItem.Enabled then fState:=MFS_ENABLED else fstate:=MFS_GRAYED;
|
||||||
if AMenuItem.Checked then fState:=fState or MFS_CHECKED;
|
if AMenuItem.Checked then fState:=fState or MFS_CHECKED;
|
||||||
fMask:=MIIM_ID or MIIM_DATA or MIIM_STATE or MIIM_TYPE;
|
fMask:=MIIM_ID or MIIM_DATA or MIIM_STATE or MIIM_TYPE;
|
||||||
@ -614,6 +617,10 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
|
if (Win32MajorVersion=4) and (Win32MinorVersion=0) then
|
||||||
|
menuiteminfosize:=W95_MENUITEMINFO_SIZE
|
||||||
|
else
|
||||||
|
menuiteminfosize:=sizeof(TMenuItemInfo);
|
||||||
|
|
||||||
////////////////////////////////////////////////////
|
////////////////////////////////////////////////////
|
||||||
// I M P O R T A N T
|
// I M P O R T A N T
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user