Hyperlink and Scroll CStatic Class


Environment: VC6.0 SP5, Windows 2000, STL

For my project, I need a static control with hyperlink and scroll functions. I found the "CHotStatic - hyperlink CStatic" article. However, the static control can only have one hyperlink, and it does not have the scroll function. So, I expanded it. This class (CScrollHotStatic) is derived from CStatic with multi-hyperlink and scroll functions.

You can use it easily. Just follow these steps:

  1. Create a new static control in your resource and add a DDX_Control for it.
  2. Change CStatic to CScrollHotStatic in the header file.
  3. Use the AddText function to add displayed texts. For example:
  4.   m_ctrlHotStatic.AddText
          ("------CScrollHotStaticTestDlg 1.0.0.1------");
      m_ctrlHotStatic.AddText("\tProgram Web Site:");
      m_ctrlHotStatic.AddText("CodeGuru", 
                              "www.codeguru.com", 12);
      m_ctrlHotStatic.AddText("MSDN Web Site", 
                              "msdn.microsoft.com", 12);
      m_ctrlHotStatic.AddText(".......");
      m_ctrlHotStatic.AddText("Mail Web Site:");
      m_ctrlHotStatic.AddText("mail.yahoo.com",
                              "mail.yahoo.com", 12);
      m_ctrlHotStatic.AddText("www.hotmail.com", 
                              "www.hotmail.com", 12);
    

The definition is:

  void AddText(LPCTSTR lpStrText, LPCTSTR lpStrLink=NULL,
    DWORD dwStartXPos=0);
  // lpStrText: The string is displayed in control
  // lpStrLink: The link string for this item
  // dwStartXPos: The horizontal position for this item

Downloads

Download demo project - 16 Kb
Download source code - 5 Kb



Comments

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Live Event Date: August 14, 2014 @ 2:00 p.m. ET / 11:00 a.m. PT Data protection has long been considered "overhead" by many organizations in the past, many chalking it up to an insurance policy or an extended warranty you may never use. The realities of today make data protection a must-have, as we live in a data driven society. The digital assets we create, share, and collaborate with others on must be managed and protected for many purposes. Check out this upcoming eSeminar and join eVault Chief Technology …

  • "Security" is the number one issue holding business leaders back from the cloud. But does the reality match the perception? Keeping data close to home, on premises, makes business and IT leaders feel inherently more secure. But the truth is, cloud solutions can offer companies real, tangible security advantages. Before you assume that on-site is the only way to keep data safe, it's worth taking a comprehensive approach to evaluating risks. Doing so can lead to big benefits.

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds