show_three.cpp

  name="google_ads_frame" marginwidth="0" marginheight="0" src="http://pagead2.googlesyndication.com/pagead/ads?client=ca-pub-5572165936844014&dt=1194442938015&lmt=1194190197&format=336x280_as&output=html&correlator=1194442937843&url=file%3A%2F%2F%2FC%3A%2FDocuments%2520and%2520Settings%2Flhh1%2F%E6%A1%8C%E9%9D%A2%2FCLanguage.htm&color_bg=FFFFFF&color_text=000000&color_link=000000&color_url=FFFFFF&color_border=FFFFFF&ad_type=text&ga_vid=583001034.1194442938&ga_sid=1194442938&ga_hid=1942779085&flash=9&u_h=768&u_w=1024&u_ah=740&u_aw=1024&u_cd=32&u_tz=480&u_java=true" frameborder="0" width="336" scrolling="no" height="280" allowtransparency="allowtransparency"> 
#include <windows.h> 
#include "show_three.h"


#if defined (WIN32)
 #define IS_WIN32 TRUE
#else
 #define IS_WIN32 FALSE
#endif

#define IS_NT      IS_WIN32 && (BOOL)(GetVersion() < 0x80000000)
#define IS_WIN32S  IS_WIN32 && (BOOL)(!(IS_NT) && (LOBYTE(LOWORD(GetVersion()))<4))
#define IS_WIN95   (BOOL)(!(IS_NT) && !(IS_WIN32S)) && IS_WIN32

HINSTANCE hInst;   // current instance

LPCTSTR lpszAppName  = "MyApp";
LPCTSTR lpszTitle    = "Tip 1277";

BOOL RegisterWin95( CONST WNDCLASS* lpwc );

int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
                      LPTSTR lpCmdLine, int nCmdShow)
{
   MSG      msg;
   HWND     hWnd;
   WNDCLASS wc;

   // Register the main application window class.
   //............................................
   wc.style         = CS_HREDRAW | CS_VREDRAW;
   wc.lpfnWndProc   = (WNDPROC)WndProc;      
   wc.cbClsExtra    = 0;                     
   wc.cbWndExtra    = 0;                     
   wc.hInstance     = hInstance;             
   wc.hIcon         = LoadIcon( hInstance, lpszAppName );
   wc.hCursor       = LoadCursor(NULL, IDC_ARROW);
   wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
   wc.lpszMenuName  = lpszAppName;             
   wc.lpszClassName = lpszAppName;             

   if ( IS_WIN95 )
   {
      if ( !RegisterWin95( &wc ) )
         return( FALSE );
   }
   else if ( !RegisterClass( &wc ) )
      return( FALSE );

   hInst = hInstance;

   // Create the main application window.
   //....................................
   hWnd = CreateWindow( lpszAppName,
                        lpszTitle,   
                        WS_OVERLAPPEDWINDOW,
                        CW_USEDEFAULT, 0,
                        CW_USEDEFAULT, 0, 
                        NULL,             
                        NULL,             
                        hInstance,        
                        NULL              
                      );

   if ( !hWnd )
      return( FALSE );

   ShowWindow( hWnd, nCmdShow );
   UpdateWindow( hWnd );        

   while( GetMessage( &msg, NULL, 0, 0) )  
   {
      TranslateMessage( &msg );
      DispatchMessage( &msg ); 
   }

   return( msg.wParam );
}


BOOL RegisterWin95( CONST WNDCLASS* lpwc )
{
   WNDCLASSEX wcex;

   wcex.style         = lpwc->style;
   wcex.lpfnWndProc   = lpwc->lpfnWndProc;
   wcex.cbClsExtra    = lpwc->cbClsExtra;
   wcex.cbWndExtra    = lpwc->cbWndExtra;
   wcex.hInstance     = lpwc->hInstance;
   wcex.hIcon         = lpwc->hIcon;
   wcex.hCursor       = lpwc->hCursor;
   wcex.hbrBackground = lpwc->hbrBackground;
   wcex.lpszMenuName  = lpwc->lpszMenuName;
   wcex.lpszClassName = lpwc->lpszClassName;

   // Added elements for Windows 95.
   //...............................
   wcex.cbSize = sizeof(WNDCLASSEX);
   wcex.hIconSm = LoadImage(wcex.hInstance, lpwc->lpszClassName,
                            IMAGE_ICON, 16, 16,
                            LR_DEFAULTCOLOR );
   
   return RegisterClassEx( &wcex );
}

LRESULT CALLBACK WndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
static HWND hText = NULL;
static HWND hEdit = NULL;
static HWND hBtn  = NULL;

   switch ( uMsg )
   {
      case WM_COMMAND :
              switch( LOWORD( wParam ) )
              {
                 case IDM_TEST :
                        hText = CreateWindow( "STATIC", "Static Text",
                                              WS_CHILD | WS_VISIBLE | SS_LEFT,
                                              10, 10, 100, 15,
                                              hWnd,
                                              (HMENU)IDC_TEXT,
                                              hInst, NULL );

                        hEdit = CreateWindow( "EDIT", "",
                                              WS_CHILD | WS_VISIBLE |
                                                ES_LEFT | WS_BORDER,
                                              110, 8, 100, 20,
                                              hWnd,
                                              (HMENU)IDC_EDIT,
                                              hInst, NULL );

                        hBtn = CreateWindow( "BUTTON", "Push Button",
                                             WS_CHILD | WS_VISIBLE |
                                             BS_PUSHBUTTON,
                                             50, 50, 100, 32,
                                             hWnd,
                                             (HMENU)IDC_BTN,
                                             hInst, NULL );
                        break;

                 case IDM_ABOUT :
                        DialogBox( hInst, "AboutBox", hWnd, (DLGPROC)About );
                        break;

                 case IDM_EXIT :
                        DestroyWindow( hWnd );
                        break;
              }
              break;
     
      case WM_DESTROY :
              PostQuitMessage(0);
              break;

      default :
            return( DefWindowProc( hWnd, uMsg, wParam, lParam ) );
   }

   return( 0L );
}


LRESULT CALLBACK About( HWND hDlg,          
                        UINT message,       
                        WPARAM wParam,      
                        LPARAM lParam)
{
   switch (message)
   {
       case WM_INITDIALOG:
               return (TRUE);

       case WM_COMMAND:                             
               if (   LOWORD(wParam) == IDOK        
                   || LOWORD(wParam) == IDCANCEL)   
               {
                       EndDialog(hDlg, TRUE);       
                       return (TRUE);
               }
               break;
   }

   return (FALSE);
}

chromium下面函数中添加“登录”按钮,需要如何修改 void AppMenuModel::Build() { // Build (and, by extension, Init) should only be called once. DCHECK_EQ(0u, GetItemCount()); if (app_menu_icon_controller_ && app_menu_icon_controller_->GetTypeAndSeverity().type == AppMenuIconController::IconType::UPGRADE_NOTIFICATION) { AddSeparator(ui::SPACING_SEPARATOR); const auto update_icon = ui::ImageModel::FromVectorIcon(kBrowserToolsUpdateChromeRefreshIcon, ui::kColorMenuIconOnEmphasizedBackground, kDefaultIconSize); if (browser_defaults::kShowUpgradeMenuItem) { AddItemWithIcon(IDC_UPGRADE_DIALOG, GetUpgradeDialogTitleText(), update_icon); AddSeparator(ui::SPACING_SEPARATOR); } } if (AddSafetyHubMenuItem() || AddGlobalErrorMenuItems() || AddDefaultBrowserMenuItems()) { AddSeparator(ui::NORMAL_SEPARATOR); } AddItemWithStringIdAndVectorIcon(this, IDC_USER_LOGIN, IDS_DEVICE_LOG_TYPE_LOGIN, kPersonIcon); AddSeparator(ui::NORMAL_SEPARATOR); // 打开新的标签页 AddItemWithStringIdAndVectorIcon(this, IDC_NEW_TAB, browser_->profile()->IsIncognitoProfile() && !browser_->profile()->IsGuestSession() ? IDS_NEW_INCOGNITO_TAB : IDS_NEW_TAB, kNewTabRefreshIcon); // 打开新的窗口 AddItemWithStringIdAndVectorIcon(this, IDC_NEW_WINDOW, IDS_NEW_WINDOW, kNewWindowIcon); // This menu item is not visible in Guest Mode. If incognito mode is not // available, it will be shown in disabled state. (crbug.com/1100791) // 打开新的无痕式窗口 if (!browser_->profile()->IsGuestSession()) { AddItemWithStringIdAndVectorIcon(this, IDC_NEW_INCOGNITO_WINDOW, IDS_NEW_INCOGNITO_WINDOW, kIncognitoRefreshMenuIcon); SetElementIdentifierAt(GetIndexOfCommandId(IDC_NEW_INCOGNITO_WINDOW).value(), kIncognitoMenuItem); } // 分隔线 AddSeparator(ui::NORMAL_SEPARATOR); #if !BUILDFLAG(IS_CHROMEOS) sub_menus_.push_back(std::make_unique<ProfileSubMenuModel>(this, browser()->profile(), browser()->window()->GetColorProvider())); auto* const profile_submenu_model = static_cast<ProfileSubMenuModel*>(sub_menus_.back().get()); // 您的chrome AddSubMenu(IDC_PROFILE_MENU_IN_APP_MENU, profile_submenu_model->profile_name(), profile_submenu_model); SetIcon(GetIndexOfCommandId(IDC_PROFILE_MENU_IN_APP_MENU).value(), profile_submenu_model->avatar_image_model()); SetElementIdentifierAt(GetIndexOfCommandId(IDC_PROFILE_MENU_IN_APP_MENU).value(), kProfileMenuItem); AddSeparator(ui::SPACING_SEPARATOR); #endif // 密码和自动填充 if (!browser_->profile()->IsGuestSession()) { sub_menus_.push_back(std::make_unique<PasswordsAndAutofillSubMenuModel>(this)); AddSubMenuWithStringIdAndVectorIcon(this, IDC_PASSWORDS_AND_AUTOFILL_MENU, IDS_PASSWORDS_AND_AUTOFILL_MENU, sub_menus_.back().get(), vector_icons::kPasswordManagerIcon); SetElementIdentifierAt(GetIndexOfCommandId(IDC_PASSWORDS_AND_AUTOFILL_MENU).value(), kPasswordAndAutofillMenuItem); } // 历史记录 if (!browser_->profile()->IsOffTheRecord()) { auto recent_tabs_sub_menu = std::make_unique<RecentTabsSubMenuModel>(provider_, browser_); recent_tabs_sub_menu->RegisterLogMenuMetricsCallback(base::BindRepeating(&AppMenuModel::LogMenuMetrics, base::Unretained(this))); sub_menus_.push_back(std::move(recent_tabs_sub_menu)); AddSubMenuWithStringIdAndVectorIcon(this, IDC_RECENT_TABS_MENU, IDS_HISTORY_MENU, sub_menus_.back().get(), kHistoryIcon); SetElementIdentifierAt(GetIndexOfCommandId(IDC_RECENT_TABS_MENU).value(), kHistoryMenuItem); } // 下载内容 AddItemWithStringIdAndVectorIcon(this, IDC_SHOW_DOWNLOADS, IDS_SHOW_DOWNLOADS, kDownloadMenuIcon); SetElementIdentifierAt(GetIndexOfCommandId(IDC_SHOW_DOWNLOADS).value(), kDownloadsMenuItem); // 书签和清单 if (!browser_->profile()->IsGuestSession()) { bookmark_sub_menu_model_ = std::make_unique<BookmarkSubMenuModel>(this, browser_); AddSubMenuWithStringIdAndVectorIcon(this, IDC_BOOKMARKS_MENU, IDS_BOOKMARKS_AND_LISTS_MENU, bookmark_sub_menu_model_.get(), kBookmarksListsMenuIcon); SetElementIdentifierAt(GetIndexOfCommandId(IDC_BOOKMARKS_MENU).value(), kBookmarksMenuItem); } // 标签页分组 if (browser_->profile()->IsRegularProfile()) { auto saved_tab_groups_model = std::make_unique<ui::SimpleMenuModel>(this); sub_menus_.push_back(std::move(saved_tab_groups_model)); AddSubMenuWithStringIdAndVectorIcon(this, IDC_SAVED_TAB_GROUPS_MENU, IDS_SAVED_TAB_GROUPS_MENU, sub_menus_.back().get(), kSavedTabGroupBarEverythingIcon); SetElementIdentifierAt(GetIndexOfCommandId(IDC_SAVED_TAB_GROUPS_MENU).value(), kTabGroupsMenuItem); } // Extensions sub menu. //扩展程序 if (base::FeatureList::IsEnabled(features::kExtensionsCollapseMainMenu) && !extensions::ui_util::HasManageableExtensions(browser_->profile())) { AddItemWithStringIdAndVectorIcon(this, IDC_FIND_EXTENSIONS, IDS_FIND_EXTENSIONS, vector_icons::kExtensionChromeRefreshIcon); SetElementIdentifierAt(GetIndexOfCommandId(IDC_FIND_EXTENSIONS).value(), ExtensionsMenuModel::kVisitChromeWebStoreMenuItem); } else { sub_menus_.push_back(std::make_unique<ExtensionsMenuModel>(this, browser_)); AddSubMenuWithStringIdAndVectorIcon(this, IDC_EXTENSIONS_SUBMENU, IDS_EXTENSIONS_SUBMENU, sub_menus_.back().get(), vector_icons::kExtensionChromeRefreshIcon); SetElementIdentifierAt(GetIndexOfCommandId(IDC_EXTENSIONS_SUBMENU).value(), kExtensionsMenuItem); } // 删除浏览数据 AddItemWithStringIdAndVectorIcon(this, IDC_CLEAR_BROWSING_DATA, IDS_CLEAR_BROWSING_DATA, kTrashCanRefreshIcon); AddSeparator(ui::NORMAL_SEPARATOR); CreateZoomMenu(); // 缩放 AddSeparator(ui::NORMAL_SEPARATOR); // 打印 AddItemWithStringIdAndVectorIcon(this, IDC_PRINT, IDS_PRINT, kPrintMenuIcon); #if BUILDFLAG(ENABLE_GLIC) if (glic::GlicEnabling::IsEnabledForProfile(browser_->profile())) { AddItemWithStringIdAndVectorIcon(this, IDC_OPEN_GLIC, IDS_GLIC_THREE_DOT_MENU_ITEM, glic::GlicVectorIconManager::GetVectorIcon(IDR_GLIC_BUTTON_VECTOR_ICON)); SetIsNewFeatureAt(GetIndexOfCommandId(IDC_OPEN_GLIC).value(), browser()->window()->MaybeShowNewBadgeFor(features::kGlicAppMenuNewBadge)); } #endif // 使用Google智能镜头搜索 if (browser()->GetFeatures().lens_overlay_entry_point_controller()->IsEnabled()) { const gfx::VectorIcon& icon = #if BUILDFLAG(GOOGLE_CHROME_BRANDING) vector_icons::kGoogleLensMonochromeLogoIcon; #else vector_icons::kSearchChromeRefreshIcon; #endif AddItemWithStringIdAndVectorIcon(this, IDC_CONTENT_CONTEXT_LENS_OVERLAY, IDS_SHOW_LENS_OVERLAY, icon); const int lens_command_index = GetIndexOfCommandId(IDC_CONTENT_CONTEXT_LENS_OVERLAY).value(); SetElementIdentifierAt(lens_command_index, kShowLensOverlay); SetIsNewFeatureAt(lens_command_index, browser()->window()->MaybeShowNewBadgeFor(lens::features::kLensOverlay)); } //翻译 AddItemWithStringIdAndVectorIcon(this, IDC_SHOW_TRANSLATE, IDS_SHOW_TRANSLATE, kTranslateIcon); // 查找和修改 CreateFindAndEditSubMenu(); // 投放、保存和分享 sub_menus_.push_back(std::make_unique<SaveAndShareSubMenuModel>(this, browser_)); int string_id = media_router::MediaRouterEnabled(browser()->profile()) ? IDS_CAST_SAVE_AND_SHARE_MENU : IDS_SAVE_AND_SHARE_MENU; AddSubMenuWithStringIdAndVectorIcon(this, IDC_SAVE_AND_SHARE_MENU, string_id, sub_menus_.back().get(), kFileSaveChromeRefreshIcon); SetElementIdentifierAt(GetIndexOfCommandId(IDC_SAVE_AND_SHARE_MENU).value(), kSaveAndShareMenuItem); #if BUILDFLAG(IS_CHROMEOS) // Always show this option if we're in tablet mode on Chrome OS. if (display::Screen::GetScreen()->InTabletMode()) { AddItemWithStringIdAndVectorIcon(this, IDC_TOGGLE_REQUEST_TABLET_SITE, IDS_TOGGLE_REQUEST_TABLET_SITE, chrome::IsRequestingTabletSite(browser_) ? kRequestMobileSiteCheckedIcon : kRequestMobileSiteUncheckedIcon); } #endif // 更多工具 sub_menus_.push_back(std::make_unique<ToolsMenuModel>(this, browser_)); AddSubMenuWithStringIdAndVectorIcon(this, IDC_MORE_TOOLS_MENU, IDS_MORE_TOOLS_MENU, sub_menus_.back().get(), kMoreToolsMenuIcon); SetElementIdentifierAt(GetIndexOfCommandId(IDC_MORE_TOOLS_MENU).value(), kMoreToolsMenuItem); AddSeparator(ui::NORMAL_SEPARATOR); // The help submenu is only displayed on official Chrome builds. As the // 'About' item has been moved to this submenu, it's reinstated here for // Chromium builds. // 帮助 #if BUILDFLAG(GOOGLE_CHROME_BRANDING) sub_menus_.push_back(std::make_unique<HelpMenuModel>(this, browser_)); AddSubMenuWithStringIdAndVectorIcon(this, IDC_HELP_MENU, IDS_HELP_MENU, sub_menus_.back().get(), kHelpMenuIcon); #else #if BUILDFLAG(IS_CHROMEOS) AddItem(IDC_ABOUT, l10n_util::GetStringUTF16(IDS_ABOUT)); #else AddItemWithStringIdAndVectorIcon(this, IDC_ABOUT, IDS_ABOUT, vector_icons::kInfoRefreshIcon); #endif #endif // 设置 AddItemWithStringIdAndVectorIcon(this, IDC_OPTIONS, IDS_SETTINGS, kSettingsMenuIcon); // 退出 if (browser_defaults::kShowExitMenuItem) { AddItemWithStringIdAndVectorIcon(this, IDC_EXIT, IDS_EXIT, kExitMenuIcon); } // On Chrome OS, similar UI is displayed in the system tray menu, instead of // this menu. #if !BUILDFLAG(IS_CHROMEOS) if (ShouldDisplayManagedUi(browser_->profile())) { AddSeparator(ui::NORMAL_SEPARATOR); AddItemWithIcon(IDC_SHOW_MANAGEMENT_PAGE, GetManagedUiMenuItemLabel(browser_->profile()), ui::ImageModel::FromVectorIcon(GetManagedUiIcon(browser_->profile()), ui::kColorMenuIcon, kDefaultIconSize)); SetAccessibleNameAt(GetIndexOfCommandId(IDC_SHOW_MANAGEMENT_PAGE).value(), GetManagedUiMenuItemTooltip(browser_->profile())); } #endif // !BUILDFLAG(IS_CHROMEOS) uma_action_recorded_ = false; }
最新发布
08-21
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值