[译]代码项目搜索栏
By robot-v1.0
本文链接 https://www.kyfws.com/applications/the-code-project-search-bar-zh/
版权声明 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
- 19 分钟阅读 - 9059 个词 阅读量 0[译]代码项目搜索栏
原文地址:https://www.codeproject.com/Articles/1070/The-Code-Project-Search-Bar
原文作者:Michael Dunn
译文由本站 robot-v1.0 翻译
前言
The Code Project SearchBar gives you quick access to the Code Project site, and lets you do searches at any time, from any web page.
使用Code Project SearchBar,您可以快速访问Code Project网站,并可以随时从任何网页进行搜索.
介绍(Introduction)
使用Code Project SearchBar,您可以快速访问Code Project网站,并可以随时从任何网页进行搜索. SearchBar是一个向Internet Explorer 5或更高版本添加工具栏的插件.工具栏上有一个文本框和按钮,可让您立即访问Code Project功能.这是工具栏的外观以及控件的功能:(The Code Project SearchBar gives you quick access to the Code Project site, and lets you do searches at any time, from any web page. The SearchBar is a plugin that adds a toolbar to Internet Explorer 5 or later. The toolbar has a text box and buttons that give you instant access to Code Project features. Here’s what the toolbar looks like, and what the controls do:)
SearchBar修订历史记录(SearchBar revision history)
系统要求(System Requirements)
Windows 95\98,Millennium,NT 4\2000,XP或带有Internet Explorer 5或更高版本的Server 2003.我尚未在Server 2003上进行过亲自测试,但只要启用IE插件,SearchBar即可正常运行.(Windows 95, 98, Millennium, NT 4, 2000, XP, or Server 2003 with Internet Explorer 5 or later. I have not personally tested on Server 2003 but as long as you enable IE plugins, the SearchBar should run fine.)
快速搜寻(Quick Searching)
代码项目的搜索引擎可以用四种方式进行搜索,您可以从SearchBar进行全部搜索:文章内容,文章标题,文章摘要和作者姓名.要在文章内容中进行搜索,请在搜索框中输入要查找的文本,然后单击(The Code Project’s search engine can search in four ways, and you can do them all from the SearchBar: article contents, article titles, article summaries, and authors' names. To search within article contents, enter the text you want to find in the search box, and click the)**搜索(Search)**按钮(或按Enter键).搜索结果将显示在浏览器窗口中.要执行其他三个搜索中的任何一个,请单击"搜索"按钮上的向下箭头,然后从菜单中选择一个搜索类型,如下所示.您也可以通过按Ctrl + Enter在作者姓名中进行搜索.(button (or press the Enter key). The search results will appear in the browser window. To do any of the other three searches, click the down arrow on the Search button, then pick a search type from the menu, as shown here. You can also do a search within authors' names by pressing Ctrl+Enter.)
SearchBar还支持拖放搜索.如果您在网页上看到某些内容(例如,程序名称,COM接口名称等),并想在Code Project关键字搜索中使用它,则可以突出显示文本并将其放在SearchBar上.例如,假设您正在阅读有关外壳扩展的MSDN页面:(The SearchBar also supports drag and drop searching. If you see something (for example, a program name, COM interface name, etc.) on a web page and want to use it in a Code Project keyword search, you can highlight the text and drop it on the SearchBar. For example, suppose you’re reading this MSDN page on shell extensions:)
如果要在Code Project文章中搜索" shell扩展处理程序",请首先选择上面所示的文本.然后将文本拖到SearchBar上.鼠标光标将更改为显示SearchBar准备接受文本:(If you want to search for “shell extension handlers” in Code Project articles, first select the text as illustrated above. Then drag the text onto the SearchBar. The mouse cursor will change to show that the SearchBar is ready to accept the text:)
当您释放鼠标按钮时,SearchBar将在文章内容内搜索所选文本.您还可以从任何其他支持拖放纯文本的程序(例如Word或Visual Studio)中拖动文本.(When you release the mouse button, the SearchBar will perform a search within article contents for the selected text. You can also drag text from any other program that supports dragging and dropping of plain text, such as Word or Visual Studio.)
版本1.2中的新功能(New in version 1.2):当您在浏览器中选择文本并单击鼠标右键时,SearchBar还会在显示的上下文菜单中添加搜索功能.如下所示的新菜单项是(: The SearchBar also adds search capability to the context menu displayed when you select text in the browser and right-click it. The new menu items, shown below, are)**代码项目关键字搜索(Code Project Keyword Search)**和(and)代码项目作者搜索(Code Project Author Search).如果您使用基于IE的浏览器(例如(. This feature is particularly useful if you use an IE-based browser (like) 傲游(Maxthon) ),不支持IE工具栏扩展.() that doesn’t support IE toolbar extensions.)
代码项目网站链接(Code Project Site Links)
点击(Click the)**代码项目(CodeProject)**工具栏中的"按钮"可直接转到"代码项目"主页.您也可以点击(button in the toolbar to go right to The Code Project home page. You can also click the)**网站连结(Site Links)**按钮以查看该站点各个区域的快捷菜单.的(button to see a menu of shortcuts to various areas of the site. The)**我的代码项目帐户(My Code Project Account)**子菜单包含指向用于管理帐户的多个页面的链接. (请注意,必须在代码项目帐户设置中启用自动登录才能使这些链接正常工作.)其他链接说明应该是不言自明的.(submenu contains links to several pages for managing your account. (Note that you must enable automatic login in your Code Project account settings for these links to work.) The other link descriptions should be self-explanatory.)
从2.0版开始,“站点链接"菜单是从XML文件构建的,因此可以自定义菜单. XML文件称为(Beginning with version 2.0, the Site Links menu is built from an XML file, so the menu can be customized. The XML file is called)searchbar.xml(searchbar.xml)并存储在(and is stored in)\ Documents and Settings \ All Users \ Application Data \ The Code Project \ SearchBar(\Documents and Settings\All Users\Application Data\The Code Project\SearchBar*)*在Win 2000和XP上,或(*on Win 2000 and XP, or*)*\ windows \所有用户\应用程序数据\代码项目\ SearchBar(*\windows\All Users\Application Data\The Code Project\SearchBar*)*在其他操作系统上.如果要从自己的菜单中添加或删除链接,则可以随意更改(如果检查内容,预期的XML应该很明显).(*on other OSes. You may change this however you like (the expected XML should be obvious if you inspect the contents) if you want to add or remove links from your own menu.*)
CodeProject管理员有时会更新可用的网站链接,并在网站上发布新的searchbar.xml.在激活SearchBar的情况下运行Internet Explorer时,SearchBar将检查CodeProject以查看是否有更新的XML文件.如果是这样,它将在后台下载并自动安装.该检查每周仅执行一次,因此不会占用很多带宽(无论是您的带宽还是站点的带宽).您也可以使用手动将更新下载到"站点链接"菜单.(CodeProject administrators will occasionally update the available site links and post a new searchbar.xml on the site. When you run Internet Explorer with the SearchBar activated, the SearchBar will check CodeProject to see if an updated XML file is available. If so, it is downloaded in the background and automatically installed. This check is done only once per week, so it won’t eat up a lot of bandwidth (either yours or the site’s). You can also manually download updates to the Site Links menu using the)**更新网站链接菜单(Update Site Links Menu)**命令,说明如下.(command, explained below.)
使用代码项目Web服务(Using the Code Project Web Service)
的第一项(The first item on the)**网站连结(Site Links)**菜单,(menu,)代码项目Web服务(Code Project Web Service),具有与Web服务连接的三个命令.(, has three commands that interface with the web service.)
这三个项目中的每一个都与Web服务联系,并在浏览器中显示相应的文章或消息列表.例如,点击(Each of the three items contacts the web service and shows the corresponding list of articles or messages in the browser. For example, clicking)**最新的休息室主题(Latest Lounge Topics)**显示如下列表:(shows a list like this:)
每个主题都有直接指向Lounge帖子的链接,以及用于在新的浏览器窗口中打开帖子的CP标准[^]链接.如果您的系统未连接到Internet(如上图所示),SearchBar将显示上次上线的主题列表.所有日期和时间都显示在您当地的时间.(Each topic has a link directly to the Lounge post, as well as the CP-standard [^] link for opening the post in a new browser window. If your system is not connected to the Internet (as in the screen shot above), the SearchBar will show the topics list from the last time you were online. All dates and times are shown in your local time.)
搜索栏控制菜单(The SearchBar Control Menu)
点击旁边的向下箭头(Click the down arrow next to the)**代码项目(CodeProject)**按钮以查看SearchBar的控件菜单:(button to see the SearchBar’s control menu:)
您可以通过单击CodeProject检查CodeProject中是否有更新的站点链接文件.(You can check CodeProject for an updated Site Links file by clicking the)**更新网站链接菜单(Update Site Links Menu)**项目.如果有新文件可用,则将下载该文件,并且"站点链接"菜单将立即反映更新.这还将通知您是否有新版本的SearchBar.(item. If a new file is available, it will be downloaded and the Site Links menu will reflect the update immediately. This will also notify you if a new version of the SearchBar is available.)
点击(Click the)**关于(About)**项以查看"搜索栏关于"框,其中显示了程序的版本号.(item to see the SearchBar about box, which shows the program’s version number.)
SearchBar选项(SearchBar Options)
请点击(Click)**SearchBar选项(SearchBar Options)**打开搜索栏选项对话框.有两页,(to open the SearchBar options dialog. There are two pages,)**一般(General)**和(and)签名(Signatures).(.)
常规页面(The General page)
第一个复选框控制文本是否显示在工具栏按钮上.您可以关闭按钮文字,以便SearchBar占用更少的屏幕空间,如下所示:(The first check box controls whether text is shown on the toolbar buttons. You can turn off the button text so the SearchBar will take up less screen real estate, as shown below:)
组合框控制搜索的完成方式.默认设置是搜索包含任何搜索词的文章.因此,例如,搜索"颜色按钮"会找到包含任一单词的文章.选择"搜索所有单词"会使您的搜索仅返回包含所有搜索单词的匹配.代码项目搜索引擎现在支持精确短语搜索;看到(The combo box controls how searches are done. The default is to search for articles containing any of the search words. So for example, searching for “color button” finds articles containing either word. Selecting Search for all of the words makes your searches only return hits containing all the search words. The Code Project search engine now supports exact phrase searching; see) 主要搜寻页面(the main search page) 更多细节.(for more details.)
下一部分是您的敌人列表-查看Web服务数据时不想看到其帖子的人.(The next section is your enemies list - people whose posts you don’t want to see when viewing the web service data.)
3.0版的新功能(New in version 3.0):最后,有两个选项可控制新发布页面的增强.这两个复选框对应于发布页面上的两个选项.当您开始撰写新帖子时,SearchBar将选中或取消选中发布页面选项,以匹配您在此处设置的内容.(: Finally, there are two options that control new posting page enhancements. These two check boxes correspond to the two options on the posting page. When you start a new post, the SearchBar will check or uncheck the posting page options to match what you set here on the)**一般(General)**页.(page.)
所有设置均按用户存储.(All settings are stored on a per-user basis.)
签名页面(The Signatures page)
3.0版引入了签名管理器,该签名管理器使您可以保留一组可以插入到帖子中的签名.在撰写文章时,可以在页面上使用新的签名命令(Version 3.0 introduces a signature manager, which lets you keep a set of signatures that can be inserted into your posts. When you are writing a post, you can use the new signature commands on the)**指令(Commands)**菜单(请参阅下文)以插入您的签名之一(特定签名或随机选择的签名).您还可以使用键盘快捷键Ctrl + Shift + R插入随机签名.如果您检查(menu (see below) to insert one of your signatures (either a specific one, or one chosen at random). You can also use the keyboard shortcut Ctrl+Shift+R to insert a random signature. If you check the)**在新帖子中插入随机签名(Insert a random signature into new posts)**复选框,搜索栏将在您开始新帖子时自动插入签名.(check box, the SearchBar will automatically insert a signature when you begin a new post.)
的(The)**在哪里插入签名(Where to insert signatures)**组合框确定签名如何与您在其中设置的现有CodeProject签名合并(combo box determines how the signature is merged with your existing CodeProject signature that you set in) 您的帐户选项(your account options) .我使用它的方式是将其设置为(. The way I use it is to set it to)附加到CP签名(Append to CP signature),这样我的CodeProject签名是恒定的(它包含我的名字和一些链接),然后SearchBar附加我的机智引号之一.您还可以将SearchBar设置为CodeProject签名的前缀,或完全替换它.(, that way my CodeProject signature is constant (it contains my name and some links) then the SearchBar appends one of my witty quotes. You can also set the SearchBar to prepend to the CodeProject signature, or replace it entirely.)
如果您已经使用了现有的CodeProject签名管理器之一((If you already use one of the existing CodeProject signature managers () 桌面鲍勃(Desktop Bob) ,(,) 自动签名(AutoSig) , 要么(, or) 代码项目引用器(Code Project Quoter) ),您可以通过单击将这些签名导入SearchBar.(), you can import those signatures into the SearchBar by clicking the)**进口(Import)*按钮,然后浏览到另一个签名管理器使用的XML数据文件. SearchBar将您的签名列表保留在(button, then browsing to the XML data file used by the other signature manager. The SearchBar keeps your signature list in)\ Documents and Settings \ [用户名] \ Application Data \ The Code Project \ SearchBar(\Documents and Settings[username]\Application Data\The Code Project\SearchBar)在Win 2000和XP上,或(on Win 2000 and XP, or)\ windows \ Application Data \ The Code Project \ SearchBar(\windows\Application Data\The Code Project\SearchBar)*在其他操作系统上.(on other OSes.)
发布页面增强(Posting Page Enhancements)
SearchBar现在向消息发布页面添加了一些功能,这些功能使添加表情符号,插入超链接和发布C ++代码变得更加容易.在发布页面上时,可以通过按Ctrl + Shift + Space调出表情符号菜单:(The SearchBar now adds several features to the message posting page that make it easier to add emoticons, insert hyperlinks, and post C++ code. When you are on a posting page, you can bring up the emoticon menu by pressing Ctrl+Shift+Space:)
选择一个表情符号,将其插入消息编辑区域.的(Select an emoticon to insert it in the message edit area. The)**指令(Commands)**子菜单包含其他增强功能,并列出了其键盘快捷键.例如,要将选定的文本转换为超链接,可以按Ctrl + Shift + L.(submenu contains other enhancements, and lists their keyboard shortcuts. For example, to convert the selected text to a hyperlink, you can press Ctrl+Shift+L.)
可用的增强功能包括:(The available enhancements are:)
- 3.0版的新功能(New in version 3.0):从列表中的列表中插入您的任何签名(: Insert any of your signatures from the list on the)**签名(Signatures)**选项页面.(options page.)
- 3.0版的新功能(New in version 3.0):从该列表中插入随机签名.(: Insert a random signature from that list.)
- 插入HTML(Insert the HTML for)
<
>
和(and)&
因此C ++代码不会像HTML标记那样被对待.(so C++ code doesn’t get treated like HTML tags.) - 兑换(Convert)
<
>
和(and)&
所选文本中的字符转换为与HTML等效的字符(在从其他位置复制C ++代码时很方便).(characters in the selected text to their HTML equivalents (handy for times when you copy C++ code from somewhere else).) - 添加或删除(Add or remove)
<code>
所选文字周围的标签(与单击(tags around the selected text (same as clicking the)code
按钮).(button in the editing toolbar).) - 将选定的文本转换为超链接(带有或不带有[^]新窗口链接).(Convert the selected text to a hyperlink (with or without the [^] new window link).)
- 预览帖子.(Preview the post.)
- 提交帖子.(Submit the post.)
安装和激活搜索栏(Installing and Activating the SearchBar)
从此页面顶部的链接下载SearchBar自解压可执行文件.如果要在SearchBar的现有副本上进行安装,请在运行EXE之前关闭所有Internet Explorer窗口.如果您不这样做,则将使用SearchBar DLL,并且安装程序将无法用新副本替换它.如果要通过SearchBar 1.1版或更高版本进行安装,则安装程序将检测DLL何时在使用中并向您发出警报.(Download the SearchBar self-extracting executable from the link at the top of this page. If you are installing over an existing copy of the SearchBar, close all Internet Explorer windows before running the EXE. If you don’t do this, the SearchBar DLL will be in use and the installer won’t be able to replace it with the new copy. If you are installing over version 1.1 or later of the SearchBar, the installer will detect when the DLL is in use and alert you.)
运行EXE,选择要安装文件的目录,然后单击(Run the EXE, select the directory where you want the files installed, and click)安装(Install).(.)
如果您使用具有实时保护功能的反间谍软件程序,则可能会收到两种警报-一种针对工具栏,另一种针对浏览器帮助对象(BHO).请确保同时安装两个组件,以使SearchBar正常运行.(If you use an anti-spyware program with real-time protection features, you may receive two alerts - one for the toolbar and one for a browser helper object (BHO). Be sure to allow both to be installed for the SearchBar to work properly.)
下次运行Internet Explorer时,搜索栏将自动启用,并出现在工具栏的底部.如果没有出现,请单击(The next time you run Internet Explorer, the SearchBar will be automatically enabled and will appear in the bottom row of toolbars. If it doesn’t appear, click the)**视图(View)**菜单并指向(menu and point to)工具栏(Toolbars).将会有一个新的项目,内容为(. There will be a new item that reads)代码项目SearchBar(The Code Project SearchBar).单击此项以显示搜索栏.重复这些步骤以隐藏SearchBar.或者,您可以右键单击任何现有的Internet Explorer工具栏以获取列出可用工具栏的弹出菜单,然后单击(. Click this item to display the SearchBar. Repeat those steps to hide the SearchBar. Alternatively, you can right-click any existing Internet Explorer toolbar to get a popup menu that lists the available toolbars, and click)**代码项目SearchBar(The Code Project SearchBar)**在该菜单中.(in that menu.)
如果这些步骤仍然不能使SearchBar可见,则可以将IE设置为现在允许第三方插件.要选中此选项,请转到您的IE选项,(If these steps still do not make the SearchBar visible, IE may be set to now allow third-party plugins. To check this option, go to your IE options,)**高级(Advanced)**标签,(tab,)**启用第三方浏览器扩展(Enable third-party browser extensions)**复选框.间谍软件也可能会干扰IE插件,因此如果有疑问,请进行间谍软件扫描(使用信誉良好的扫描器,例如(check box. Spyware may also interfere with IE plugins, so do a spyware scan if in doubt (using a reputable scanner like) 广告意识(Ad-Aware) ,(,) Spybot搜索和销毁(Spybot Search&Destroy) , 要么(, or) Microsoft反间谍软件(Microsoft AntiSpyware) ).().)
如果您运行的是IE 5.0,将有多个(If you are running IE 5.0, there will be multiple)**无线电(Radio)**菜单上的项目.那是由于IE错误-它列出了所有工具栏扩展为(items on the menu. That is due to an IE bug - it lists all toolbar extensions as)无线电(Radio).最后(. The last)**无线电(Radio)**该项目应激活搜索栏.(item should activate the SearchBar.)
请注意,根据Internet Explorer的设置,您可能必须先注销然后重新登录,Internet Explorer才能开始使用新安装的SearchBar.(Note that, depending on your Internet Explorer settings, you may have to log off and back on for Internet Explorer to begin using the newly-installed SearchBar.)
卸载搜索栏(Uninstalling the SearchBar)
您可以使用"添加/删除程序"控制面板小程序来卸载SearchBar. SearchBar目前有一个非常简单的卸载程序,该卸载程序仅注销SearchBar DLL和Web服务阅读器.您将需要手动删除文件. (此问题将在以后的更新中修复.)(You can uninstall the SearchBar using the Add/Remove Programs Control Panel applet. The SearchBar has a really simple uninstaller at this time, which only unregisters the SearchBar DLL and the web service reader. You will need to delete the files manually. (This will be fixed in a future update.))
致谢(Acknowledgements)
搜索栏由Erik Thompson构建(The SearchBar was built with Erik Thompson’s) DeskBand ATL对象向导(DeskBand ATL Object Wizard) .也感谢Erik在凌晨2点帮助我通过MSN Messenger修复了错误!(. Thanks also to Erik for helping me fix bugs over MSN Messenger at 2 AM!)
修订记录(Revision History)
- v3.0(2005年7月17日)-添加了新的签名管理功能.添加了BHO,以在安装SearchBar后首次运行IE时自动显示工具栏.添加了三个新的笑脸.(v3.0 (July 17, 2005) - Added new signature management features. Added a BHO to automatically show the toolbar the first time IE is run after installing the SearchBar. Added three new smileys.)
- v2.0.2(2003年9月14日)-添加了新功能(v2.0.2 (September 14, 2003) - Added new)
:sigh:
和(and):doh:
菜单上的表情符号.删除了使用Ctrl + Shift + 6进行链接[^]后选择文本的代码,因为发布页面中的代码现在已执行该操作.(smileys to the menu. Removed code that selects text after using Ctrl+Shift+6 to make a link[^] since the code in the posting page does that now.) - v2.0.1(2003年7月12日)-SearchBar现在可在MyIE2中使用.现在,当您更改显示按钮文本选项时,搜索编辑框的大小可以正确调整.(v2.0.1 (July 12, 2003) - The SearchBar now works in MyIE2. The search edit box now resizes properly when you change the show button text option.)
- v2.0(2003年6月26日)-大量新内容.现在从XML文件构建"站点链接"菜单. XML文件已从CodeProject自动更新.新的Web服务阅读器,在浏览器中显示最新的CodeProject文章和帖子.发布页面增强功能和表情菜单.(v2.0 (June 26, 2003) - Tons of new stuff. Site Links menu now built from an XML file. XML file updated automatically from CodeProject. New web service reader that shows the latest CodeProject articles and posts in the browser. Posting page enhancements and emoticon menu.)
- v1.2.5(2002年11月13日)-从高级赞助商列表中删除了Wintellect.在站点链接菜单中添加了搜索CodeProject.现在添加qm =查询字符串以使用高级搜索选项.添加了用于控制使用哪种搜索类型的选项.(v1.2.5 (November 13, 2002) - Removed Wintellect from the Premium Sponsors list. Added Search CodeProject to Site Links menu. Now adding qm= query string to use advanced search options. Added options to control which type of search to use.)
- v1.2.4(2002年4月7日)-添加了人字形支持!添加了XP主题支持.增加了Wintellect高级赞助商.修复了弹出菜单,以便当浏览器窗口位于屏幕底部附近时,它们会出现在按钮上方(而不是覆盖它).(v1.2.4 (April 7, 2002) - Added chevron support! Added XP theme support. Added Wintellect premium sponsor. Fixed popup menus so they appear above the button (not covering it) when the browser window is near the bottom of the screen.)
- v1.2.3(2001年10月28日)-在"网站链接"菜单中添加了"高级赞助商"子菜单.更新了图标(在Win 2000的"添加/删除程序"列表中显示),使其与站点上的外星人图标匹配.(v1.2.3 (October 28, 2001) - Added “Premium Sponsors” submenu to the Site Links menu. Updated the icon (which shows up in Win 2000’s Add/Remove Programs list) so it matches the alien icon on the site.)
- v1.2.2(2001年8月22日)-修复了透明性错误,因此钢筋壁纸将通过工具栏显示.修复了告诉IE乐队大小的代码,因此您可以双击乐队的抓手,工具栏将捕捉到正确的大小.添加了Ctrl + Enter键组合以进行作者搜索.使用新徽标更新了图形.更新了"广告信息” URL.(v1.2.2 (August 22, 2001) - Fixed the transparency bug so the rebar wallpaper will show through the toolbar. Fixed the code that tells IE the size of the band, so you can double-click the band’s gripper and the toolbar will snap to just the right size. Added Ctrl+Enter key combo to do an author search. Updated graphics with the new logo. Updated the “advertising information” URL.)
- v1.2(2001年6月18日)-添加了站点链接:SearchBar网页,调查和民意调查,我的代码项目书签.在网页的IE上下文菜单中添加了两个搜索项.添加了工具栏选项,以在执行关键字搜索时自动引用搜索词.(v1.2 (June 18, 2001) - Added site links: SearchBar Web Page, Surveys and Polls, My Code Project Bookmarks. Added two search items to the IE context menu for a web page. Added a toolbar option to automatically quote search words when doing a keyword search.)
- v1.1(2001年4月27日)-将控制菜单添加到CodeProject按钮.添加了显示/隐藏工具栏按钮文本的功能.(v1.1 (April 27, 2001) - Added the control menu to the CodeProject button. Added ability to show/hide toolbar button text.)
- v1.0(2001年4月22日)-第一版.(v1.0 (April 22, 2001) - First release.)
许可
本文以及所有相关的源代码和文件均已获得The Code Project Open License (CPOL)的许可。
C++ HTML VC6 WinXP Win2003 Win2K IE ATL Visual-Studio Dev 新闻 翻译