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: October 29, 2014 @ 11:00 a.m. ET / 8:00 a.m. PT Are you interested in building a cognitive application using the power of IBM Watson? Need a platform that provides speed and ease for rapidly deploying this application? Join Chris Madison, Watson Solution Architect, as he walks through the process of building a Watson powered application on IBM Bluemix. Chris will talk about the new Watson Services just released on IBM bluemix, but more importantly he will do a step by step cognitive …

  • Managing your company's financials is the backbone of your business and is vital to the long-term health and viability of your company. To continue applying the necessary financial rigor to support rapid growth, the accounting department needs the right tools to most efficiently do their job. Read this white paper to understand the 10 essentials of a complete financial management system and how the right solution can help you keep up with the rapidly changing business world.

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds