• 添加对动态GIF动画的支持

      为了实现使用ActiveX控件显示动态的进度条GIF动画,我们将使用Oleg Bykov在CodeProject的一篇文章中创建的类CPictureEx。具体的文章地址,请查阅本文最后的参考资料。

      第一篇:步步学ACTIVEX网页控件开发:创建控件

      首先,我们需要将源代码文件pictureex.cpp和pictureex.h添加到我们的项目中。选择Visual Studio 2005 IDE中的“解决方案浏览器”,在源代码窗口中点击“Header Files or Source Files”,然后点击右键,在弹出的上下文菜单中选择“Add”->“Existing Item”,在文件选择对话框中,选中我们需要的源代码文件添加到项目中。

      默认情况下,Visual Studio 2005本身是不支持GIF资源的。如果你尝试着添加一个GIF资源,它将弹出一个错误窗口报告说这个文件不是一个合法的GIF文件。为了添加一个动态的 GIF动画资源,我们需要做一些额外的工作。请按照下面的步骤添加GIF资源:

      1.复制GIF文件ProcessingProgressBar.gif到你的项目目录,然后将其扩展名修改为“gaf”。在资源视图中,右键单击 MyActiveX.rc,然后选择“Add Resource”。在弹出的添加资源对话框中,点击“Import”按钮,然后选择ProcessingProgressBar.gaf。

      在“自定义资源类型”对话框中,填入“GIF”作为资源类型。这样我们就可以将GIF图像文件导入到项目中作为资源了。你可以在资源视图的“GIF”目录 下中找到我们刚刚导入的GIF图像文件。选中这个GIF图像资源,然后将它的ID由默认的IDR_GIF1修改为IDR_PROGRESSBAR。

      2.在上一步中,我们使用“gaf”作为文件扩展名绕过了Visual Studio对GIF资源文件的检查。现在,我们需要做一些事情将这个“错误”修正过来,使得GIF图像文件能够正常工作。首先,在Visual Studio 2005中保存MyActiveX.rc。然后打开项目目录,用记事本直接打开资源文件MyActiveX.rc,然后找到 IDR_PROGRESSBAR的定义行。这里我们需要将文件名修改为“ProcessingProgressBar.gif”。同样的,将项目目录下的 GIF资源文件的文件名修改为“ProcessingProgressBar.gif”。

      接着,保存记事本中的MyActiveX.rc。这时,Visual Studio将报告说MyActiveX.rc被外部程序修改,点击“Yes”重载这个资源文件。最后,选中“解决方案浏览器”中的 “ProcessingProgressBar.gaf”,在它的属性对话框中,将“Relative Path”修改为“ProcessingProgressBar.gif”

    步步学ACTIVEX控件开发:添加对GIF支持

  • 本文将首先介绍如何使用Visual Studio开发一个简单的ActiveX控件,然后介绍ActiveX控件开发相关的基础知识,比如方法,属性和事件等,最后介绍如何利用这些知识,实现ActiveX控件和网页页面之间的通信


    MyActiveX控件的效果图

      简介

      ActiveX是由Microsoft在90年代中期提出的一项技术。利用ActiveX技术,开发者可以创建像Java小程序applet一样的小型应 用程序。这些应用程序可以被下载然后在Microsoft的浏览器中运行。这篇文章是为那些想学习如何开发他们的第一个ActiveX控件的Visual C++开发者准备的。

      当我自己尝试学习这些技术的时候,我发现很多针对ActiveX技术的资料都已经不再适用了,都已经过时了,或者丢失了很多关键性的信息,这些都使得我在 为我的项目创建一个ActiveX控件的时候,变得困难重重。这篇文章将帮助你实现ActiveX网页控件开发的快速入门。本文将首先介绍如何使用 Visual Studio开发一个简单的ActiveX控件,然后介绍ActiveX控件开发相关的基础知识,比如方法,属性和事件等,最后介绍如何利用这些知识,实 现ActiveX控件和网页页面之间的通信。

      另外,你也将学习到如何在默认的Internet Explorer安全设置下取消掉控件加载过程中的警告或者错误提示,使你的控件成为一个“安全”的ActiveX控件。

      在本文中,我们将创建一个实际的ActiveX控件。在控件加载的过程中,它将显示一个动态的进度条,告诉用户控件正在加载并处理信息。同时,这个控件也 将展示如何在ActiveX控件和Web页面之间传递信息。本文将引导你一步步地利用Microsoft Visual Studio 2005完成ActiveX控件的开发工作。

      创建ActiveX控件

      要创建一个ActiveX控件,首先启动Visual Studio 2005,执行下面这些步骤:

      1.选择“文件”菜单,然后选择“新建”->“项目”。 
      2.在“新建项目”对话框中,如下图1所示,选择“Visual C++”分类下的“MFC”。然后选择“MFC ActiveX控件”作为项目模板。

    步步学ACTIVEX网页控件开发

  • 下面这篇文章来自Jakob Nielsen,介绍了如何利用一个连接的最前面两个词抓住访客的眼睛。对于软件交互设计者,值得一读。

    First 2 Words: A Signal for the Scanning Eye

    Summary:
    Testing how well people understand a link's first 11 characters shows whether sites write for users, who typically scan rather than read lists of items.

    Our newest usability study — in preparation for the new Writing for the Web 2 course — tests how well users understand the first 11 characters of a website's links and headlines. For example, we'd represent this article by the "First 2 Wor" string. (Note how the guideline to show numbers as numerals lets me squeeze more meaning into this tiny stump of text.)

    Why test text that's so severely truncated? Because online reading is often dominated by the F-pattern. That is, people read the first few listed items somewhat thoroughly — thus the cross-bars of the "F" — but read less and less as they continue down the list, eventually passing their eyes down the text's left side in a fairly straight line. At this point, users see only the very beginning of the items in a list.

    On Web and intranet pages, lists occur in many places, including:

    • Search engine results pages (SERP)
    • Lists of current or archived articles, headlines, press releases, and other news items
    • Product listings on category pages
    • Table of contents (ToC) listings
    • Question lists that serve as ToCs at the top of FAQ (frequently asked questions) pages
    • Bulleted or numbered lists, checklists, task steps on a help page or job aid, etc.

    Users typically see about 2 words for most list items; they'll see a little more if the lead words are short, and only the first word if they're long. Of course, people don't see exactly 11 characters every time, but we picked this number to ensure uniformity across the sites we tested.

    The full text of these short items is microcontent, so this study targeted nano-content. Similar principles apply to both links and headings, but we tested a set of links — again for uniformity.

    User Research

    Our study included 80 people broadly distributed across age groups, gender, and education.

    Younger (<30 years) and college-educated users were over-represented among the test participants. However, because these groups can be expected to have above-average reading skills — and, in the latter case, spend more money online than less educated users — that small skewing shouldn't invalidate the findings. Indeed, whatever difficulties such test users encountered would be even more severe for a broader audience.

    We tested 20 different links, one from each of the following 20 sites: Accenture, Amazon.com, Ann Taylor, AT&T, Barclays Bank (UK), Bell Canada, Chase Bank, Dell, Direct.gov.uk, Fidelity Investments, Free Application for Federal Student Aid (USA), Freestyle Media (Australia), Fujitsu, Intel, Norwich Union (UK), Northwestern Memorial Hospital, RMC Labs (Australia), Streamline Solutions (Australia), Topshop (UK), and Xerox.

    As the list shows, we tested sites from 3 continents representing a wide range of sectors, including B2B, e-commerce, financial institutions, government, health care, and technology.

    We tested two tasks:

    • Users were shown truncated links, one at a time, and were asked to predict what they'd find if they clicked on the link. In addition to the 11 characters, we showed users the site's name and a brief site description for additional context.
    • Users were shown a list of 10 truncated links, 9 of which were distracters chosen from 60 other sites that weren't otherwise part of our study. We gave users a scenario, asking them to choose the link that would lead to the requested information. For example: "Find information about how to listen to your voicemail messages on your iPhone."

    Best Links

    Ann Taylor's e-commerce site won this study with the best 11-characters lead. The full link text read "Gift Cards & E-Gift Certificates" and the first 11 characters were "Gift Cards " (including the space after the second word).

    85% of users were able to predict where this link led after seeing only the first 11 characters, and 100% of users successfully picked this link (despite the 9 distracters) when asked to "purchase an Ann Taylor gift certificate for a friend."

    Barclays Bank scored well for "New custome" (full link: "New customers apply online now"), at least for the task of picking the right link from among the 10, which 95% of users did. And 75% of users had a fairly good idea of where the link would lead when they saw the first 11 characters in isolation.

    What characterizes both of these winning links? There's money at stake, so designers are under a mandate to keep it plain and simple, so that the site can make money. Gift certificates are a big revenue source for e-commerce sites, and new accounts are a lifeline for online banking. When users identify and click the right link, both companies can score a win.

    The two winning links also showcase principles for effective Web content. Both links

    • Use plain language
    • Use specific terminology
    • Follow conventions for naming common features
    • Front-load user- and action-oriented terms

    Worst Links

    There were a lot of bad links. In fact, for 35% of the links, users who saw only the first 11 characters hadn't the faintest idea of where the links would lead.

    The very worst link was from Chase Bank: on its tested link, the initial 11 characters, "Introducing," had no meaning. The full link, "Introducing Chase Exclusives Special Benefits for Checking Customers," is not much better; we're still clueless as to what those "exclusive" and "special" benefits might be.

    Not surprisingly, none of the users had a reasonable prediction — or even an inkling — about where "Introducing" might lead. And, when we asked users to pick a link for "Locate any additional benefits you may be eligible for as an existing Chase checking customer," only 15% picked "Introducing" from a list of 10 links.

    Links at Directgov ("Working while you study: paying tax") and Xerox ("Profit Accelerator Overview") tied for the second worst. One user actually had a reasonable prediction of where "Profit Acce" would lead, so Xerox didn't lay an egg in the first part of the study the way Directgov did. On the other hand, 25% of users correctly picked the Directgov link from the 9 distracters in the second part of the study, whereas only 5% of users did so for Xerox.

    These links are infected by 3 nasties that cause bad content usability:

    • Bland, generic words
    • Made-up words or terms
    • Starting with blah-blah and deferring the information-carrying text to the end

    Guiding Users to the Correct Links

    It's admittedly harsh to judge a website's design on only the first 11 characters of its links. So, if you replicate this research with your own links, don't cry if you score below Ann Taylor.

    Users don't need to predict a link's destination with 100% accuracy based solely on its 11 leading characters. In real life, links aren't truncated on the page. Even if users see only the first 2 words or so during their initial scan, they can immediately read more if their eyes stop on the link.

    Thus, only the full link text needs to provide the full information scent:

    • Allow users to confidently predict what they'll get if they click.
    • Be clearly differentiated from the other links.
    • Not be misleading or promise too much.

    Nanocontent (first bit of a link) just needs to be good enough that users will sniff the most promising links in full.

    Still, low scores in this type of study indicate that you haven't written your site's content for the way users read online, as proven by eyetracking research and many other usability studies. If you score really low, you need an urgent rewrite.