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. geting font from hdc (GDI) in API way

geting font from hdc (GDI) in API way

Scheduled Pinned Locked Moved C / C++ / MFC
graphicsjson
5 Posts 3 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.
  • R Offline
    R Offline
    ravjak
    wrote on last edited by
    #1

    Hi i want to get HFONT or LOGFONT form HDC object. I have a hdc but i don't wann to do this in this way HFONT font= (HFONT)SendMessage( hwnd,WM_GETFONT,0,0); or in this way HFONT font = ::CreateFontIndirect(....); HFONT hOldFont = (HFONT)::SelectObject(hdc, font); im looking for something like HFONT font=GetFont(hdc); There must be a way to do this:mad: Pain is a weakness living the body

    R S 2 Replies Last reply
    0
    • R ravjak

      Hi i want to get HFONT or LOGFONT form HDC object. I have a hdc but i don't wann to do this in this way HFONT font= (HFONT)SendMessage( hwnd,WM_GETFONT,0,0); or in this way HFONT font = ::CreateFontIndirect(....); HFONT hOldFont = (HFONT)::SelectObject(hdc, font); im looking for something like HFONT font=GetFont(hdc); There must be a way to do this:mad: Pain is a weakness living the body

      R Offline
      R Offline
      Roger Allen
      wrote on last edited by
      #2

      Try ::GetCurrentObject(HDC, OBJ_FONT) Roger Allen - Sonork 100.10016 Strong Sad: Clever I am? Next to no one. Undiscovered and soggy. Look up. Look down. They're around. Probably laughing. Still, bright, watery. Listed among the top. Ten. Nine. Late night. Early morn. Early mourn. Now I sleep.

      R 1 Reply Last reply
      0
      • R ravjak

        Hi i want to get HFONT or LOGFONT form HDC object. I have a hdc but i don't wann to do this in this way HFONT font= (HFONT)SendMessage( hwnd,WM_GETFONT,0,0); or in this way HFONT font = ::CreateFontIndirect(....); HFONT hOldFont = (HFONT)::SelectObject(hdc, font); im looking for something like HFONT font=GetFont(hdc); There must be a way to do this:mad: Pain is a weakness living the body

        S Offline
        S Offline
        Steve S
        wrote on last edited by
        #3

        Assuming that you don't want to create a font because it's expensive, what about HFONT tmp = (HFONT)SelectObject(hdc,GetStockObject(DEFAULT_GUI_FONT)); SelectObject(hdc,tmp); You don't say why you don't want to use the other methods... Steve S

        R 1 Reply Last reply
        0
        • S Steve S

          Assuming that you don't want to create a font because it's expensive, what about HFONT tmp = (HFONT)SelectObject(hdc,GetStockObject(DEFAULT_GUI_FONT)); SelectObject(hdc,tmp); You don't say why you don't want to use the other methods... Steve S

          R Offline
          R Offline
          ravjak
          wrote on last edited by
          #4

          roger's way is what i was looking for thanks anyway Pain is a weakness living the body

          1 Reply Last reply
          0
          • R Roger Allen

            Try ::GetCurrentObject(HDC, OBJ_FONT) Roger Allen - Sonork 100.10016 Strong Sad: Clever I am? Next to no one. Undiscovered and soggy. Look up. Look down. They're around. Probably laughing. Still, bright, watery. Listed among the top. Ten. Nine. Late night. Early morn. Early mourn. Now I sleep.

            R Offline
            R Offline
            ravjak
            wrote on last edited by
            #5

            Thanks!!!!! Pain is a weakness living the body

            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