Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to identify class of dialog control

How to identify class of dialog control

Scheduled Pinned Locked Moved C / C++ / MFC
tutorial
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    John Oliver
    wrote on last edited by
    #1

    Hello, I want to change the font of all the Frame Static controls on my dialog. The following code will loop through all the dialog's controls and change all their fonts. CWnd* pwndChild = GetWindow(GW_CHILD); while (pwndChild) { pwndChild->SetFont( &MyNewFont, FALSE ); pwndChild = pwndChild->GetNextWindow(); } Could somebody tell me how I can identify if the window is a static frame type. Thanks, John

    P 1 Reply Last reply
    0
    • J John Oliver

      Hello, I want to change the font of all the Frame Static controls on my dialog. The following code will loop through all the dialog's controls and change all their fonts. CWnd* pwndChild = GetWindow(GW_CHILD); while (pwndChild) { pwndChild->SetFont( &MyNewFont, FALSE ); pwndChild = pwndChild->GetNextWindow(); } Could somebody tell me how I can identify if the window is a static frame type. Thanks, John

      P Offline
      P Offline
      Pavel Klocek
      wrote on last edited by
      #2

      You can do this so:

      TCHAR buf[50];
      GetClassName(pwndChild->GetSafeHwnd(),buf,50);
      if(strcmp(buf,"Static")==0)
      {
      ...
      }

      But I don't think it's a good practice. Pavel Sonork 100.15206

      J 1 Reply Last reply
      0
      • P Pavel Klocek

        You can do this so:

        TCHAR buf[50];
        GetClassName(pwndChild->GetSafeHwnd(),buf,50);
        if(strcmp(buf,"Static")==0)
        {
        ...
        }

        But I don't think it's a good practice. Pavel Sonork 100.15206

        J Offline
        J Offline
        John Oliver
        wrote on last edited by
        #3

        Thanks Pavel, The Static Frame control's ClassName is 'Button' so now I have to work out how to differentiate between it and other Button types.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups