zoukankan      html  css  js  c++  java
  • 遍历菜单

    procedure ExplorerMenuItem(MenuHandle: THandle);
    var
      MenuIndex: Integer;
      MenuCaptionArray: array[1..255]  of Char;
      MenuCaptionString: String;
      ItemInfo: TMenuItemInfo;
      Buffer: array[0..20] of Char;
    begin
      for MenuIndex := 0 to GetMenuItemCount(MenuHandle) - 1 do begin
        //Something todo. Here we get the caption
        GetMenuString(MenuHandle, MenuIndex, @MenuCaptionArray, 255, MF_BYPOSITION);
        MenuCaptionString := MenuCaptionArray;
        SetLength(MenuCaptionString,StrLen(PChar(MenuCaptionString)));
        ShowMessage('Menu Caption: ' + MenuCaptionString);
        //Get caption ends here.
         
        ItemInfo.cbSize := SizeOf(TMenuItemInfo);
        ItemInfo.fMask := MIIM_SUBMENU;
        ItemInfo.dwTypeData := Buffer;
        ItemInfo.cch := SizeOf(Buffer);
        GetMenuItemInfo(MenuHandle, MenuIndex, True, ItemInfo);
        //submenu, calls itself
        if ItemInfo.hSubMenu <> 0 then begin
          ExplorerMenuItem(ItemInfo.hSubMenu);
        end;
      end;
    end;

  • 相关阅读:
    226_翻转二叉树
    199_二叉树的右视图
    145_二叉树的后序遍历
    做IT,网络/系统/数据库/软件开发都得懂
    [恢]hdu 1200
    [恢]hdu 2080
    [恢]hdu 1222
    [恢]hdu 1128
    [恢]hdu 2153
    [恢]hdu 2132
  • 原文地址:https://www.cnblogs.com/chengxin1982/p/1588633.html
Copyright © 2011-2022 走看看