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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Win CE program, SetFong() not work

Win CE program, SetFong() not work

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpquestion
4 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.
  • E Offline
    E Offline
    econy
    wrote on last edited by
    #1

    In a WinCE MFC program, OnInitDialog(), I changed font of a Static text, but, it shows messy characters. same logic in my PC, I wrote a test MFC program. it works well. Please help me to analyze the reason.

    BOOL CTestDlg::OnInitDialog()
    {
    CDashApp *pApp ;

    CDialog::OnInitDialog();
    pApp = (CDashApp \*) AfxGetApp();
    // Hide the cursor
    ShowCursor( FALSE ) ;
    
    InitConfigurationFile();
    LoadDtcFile( pApp->g\_PanelSettings.language );	
    
    if ( NULL != AddFontResource(TEXT("\\\\FlashDisk\\\\Startup\\\\FZYTK.TTF")) ) {
    	::SendMessage(HWND\_BROADCAST,WM\_FONTCHANGE,0,0);
    }
    
    // Draw Working Screen
    DrawDash( BKG\_DRAW ) ;
    RefreshMainScreen( );
    
    pApp->m\_ActiveDlg = ACTIVE\_DLG\_TEST ;
    
    LOGFONT lf;		
    CStatic \*pEdit2 = new CStatic;
    
    memset(&lf, 0, sizeof(LOGFONT));
    
    lf.lfQuality = CLEARTYPE\_QUALITY;
    lf.lfWidth  = 0;
    WCHAR lffn\[\] = TEXT("FZYaoTi(OpenType)"); 
    wcscpy(lf.lfFaceName,lffn);
    
    lf.lfCharSet = GB2312\_CHARSET;
    
     if (m\_Font1.m\_hObject)   {   
            m\_Font1.DeleteObject();   
      }  
    
    m\_Font1.CreateFontIndirect(&lf);
    pEdit2 = (CStatic\*)GetDlgItem( IDC\_INFO\_TOP);
    
    GetDlgItem( IDC\_INFO\_TOP)->SetFont(&m\_Font1,1);
    //pEdit1->SetWindowTextW(\_T("??"));
    pEdit2->SetWindowTextW(\_T("??"));
    
    return TRUE;  // return TRUE unless you set the focus to a control
    // EXCEPTION: OCX Property Pages should return FALSE
    

    }

    R 2 Replies Last reply
    0
    • E econy

      In a WinCE MFC program, OnInitDialog(), I changed font of a Static text, but, it shows messy characters. same logic in my PC, I wrote a test MFC program. it works well. Please help me to analyze the reason.

      BOOL CTestDlg::OnInitDialog()
      {
      CDashApp *pApp ;

      CDialog::OnInitDialog();
      pApp = (CDashApp \*) AfxGetApp();
      // Hide the cursor
      ShowCursor( FALSE ) ;
      
      InitConfigurationFile();
      LoadDtcFile( pApp->g\_PanelSettings.language );	
      
      if ( NULL != AddFontResource(TEXT("\\\\FlashDisk\\\\Startup\\\\FZYTK.TTF")) ) {
      	::SendMessage(HWND\_BROADCAST,WM\_FONTCHANGE,0,0);
      }
      
      // Draw Working Screen
      DrawDash( BKG\_DRAW ) ;
      RefreshMainScreen( );
      
      pApp->m\_ActiveDlg = ACTIVE\_DLG\_TEST ;
      
      LOGFONT lf;		
      CStatic \*pEdit2 = new CStatic;
      
      memset(&lf, 0, sizeof(LOGFONT));
      
      lf.lfQuality = CLEARTYPE\_QUALITY;
      lf.lfWidth  = 0;
      WCHAR lffn\[\] = TEXT("FZYaoTi(OpenType)"); 
      wcscpy(lf.lfFaceName,lffn);
      
      lf.lfCharSet = GB2312\_CHARSET;
      
       if (m\_Font1.m\_hObject)   {   
              m\_Font1.DeleteObject();   
        }  
      
      m\_Font1.CreateFontIndirect(&lf);
      pEdit2 = (CStatic\*)GetDlgItem( IDC\_INFO\_TOP);
      
      GetDlgItem( IDC\_INFO\_TOP)->SetFont(&m\_Font1,1);
      //pEdit1->SetWindowTextW(\_T("??"));
      pEdit2->SetWindowTextW(\_T("??"));
      
      return TRUE;  // return TRUE unless you set the focus to a control
      // EXCEPTION: OCX Property Pages should return FALSE
      

      }

      R Offline
      R Offline
      Rage
      wrote on last edited by
      #2

      Is the font installed on the target machine ?

      ~RaGE();

      I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus Entropy isn't what it used to.

      1 Reply Last reply
      0
      • E econy

        In a WinCE MFC program, OnInitDialog(), I changed font of a Static text, but, it shows messy characters. same logic in my PC, I wrote a test MFC program. it works well. Please help me to analyze the reason.

        BOOL CTestDlg::OnInitDialog()
        {
        CDashApp *pApp ;

        CDialog::OnInitDialog();
        pApp = (CDashApp \*) AfxGetApp();
        // Hide the cursor
        ShowCursor( FALSE ) ;
        
        InitConfigurationFile();
        LoadDtcFile( pApp->g\_PanelSettings.language );	
        
        if ( NULL != AddFontResource(TEXT("\\\\FlashDisk\\\\Startup\\\\FZYTK.TTF")) ) {
        	::SendMessage(HWND\_BROADCAST,WM\_FONTCHANGE,0,0);
        }
        
        // Draw Working Screen
        DrawDash( BKG\_DRAW ) ;
        RefreshMainScreen( );
        
        pApp->m\_ActiveDlg = ACTIVE\_DLG\_TEST ;
        
        LOGFONT lf;		
        CStatic \*pEdit2 = new CStatic;
        
        memset(&lf, 0, sizeof(LOGFONT));
        
        lf.lfQuality = CLEARTYPE\_QUALITY;
        lf.lfWidth  = 0;
        WCHAR lffn\[\] = TEXT("FZYaoTi(OpenType)"); 
        wcscpy(lf.lfFaceName,lffn);
        
        lf.lfCharSet = GB2312\_CHARSET;
        
         if (m\_Font1.m\_hObject)   {   
                m\_Font1.DeleteObject();   
          }  
        
        m\_Font1.CreateFontIndirect(&lf);
        pEdit2 = (CStatic\*)GetDlgItem( IDC\_INFO\_TOP);
        
        GetDlgItem( IDC\_INFO\_TOP)->SetFont(&m\_Font1,1);
        //pEdit1->SetWindowTextW(\_T("??"));
        pEdit2->SetWindowTextW(\_T("??"));
        
        return TRUE;  // return TRUE unless you set the focus to a control
        // EXCEPTION: OCX Property Pages should return FALSE
        

        }

        R Offline
        R Offline
        Rage
        wrote on last edited by
        #3

        ... and MSDN says CreateFontIndirect would work for desktop apps only, so ...

        ~RaGE();

        I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus Entropy isn't what it used to.

        E 1 Reply Last reply
        0
        • R Rage

          ... and MSDN says CreateFontIndirect would work for desktop apps only, so ...

          ~RaGE();

          I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus Entropy isn't what it used to.

          E Offline
          E Offline
          econy
          wrote on last edited by
          #4

          Thanks, CreateFontIndrect work for WinCE also. Now it solved. seems when the IDE pop up a message window, ask me if I hope to change the character set, I clicked no.

          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