The MASM Forum

General => The Campus => Topic started by: Mr.reCoder on September 10, 2012, 03:27:21 AM

Title: Porblem with Terminal font in edit control [!SOLVED!]
Post by: Mr.reCoder on September 10, 2012, 03:27:21 AM
hi all.

the character 0xDB does not show correctly in edit control when the font is "Terminal" in font size "9".

BR.

code is attached...
Title: Re: Porblem with Terminal font in edit control
Post by: TouEnMasm on September 10, 2012, 03:31:25 AM

If the text must be as shown in the image,a black retangle,i have also a black rectangle in the edit when I clic the button.
I have XP  SP3
Title: Re: Porblem with Terminal font in edit control
Post by: TouEnMasm on September 10, 2012, 03:41:55 AM
The design of the font don't seem very good
Quote
NFOFont LOGFONT <-12,-9,0,0,400,0,0,0,-1,1,2,1,49,"Terminal">

You can create the font with this proc (a tool of mine you can found on the misceallenous project ).
http://masm32.com/board/index.php?topic=648.msg5310#msg5310 (http://masm32.com/board/index.php?topic=648.msg5310#msg5310)

Quote
   CreeFont PROTO
   CreeFont PROC
         Local  retour:DWORD
         Local  logfont:LOGFONT

   mov logfont.lfHeight,0FFFFFFF4h
   mov logfont.lfWidth,0h
   mov logfont.lfEscapement,0h
   mov logfont.lfOrientation,0h
   mov logfont.lfWeight,190h
   mov logfont.lfItalic,0h
   mov logfont.lfUnderline,0h
   mov logfont.lfStrikeOut,0h
   mov logfont.lfCharSet,0FFh
   mov logfont.lfOutPrecision,1h
   mov logfont.lfClipPrecision,2h
   mov logfont.lfQuality,1h   ;0 DEFAULT_QUALITY ,1 DRAFT_QUALITY,2 PROOF_QUALITY
   mov logfont.lfPitchAndFamily,31h
   jmp overtext
   NamedFont db "Terminal",0      ;LOGFONT
   overtext:
   invoke lstrcpy,addr logfont.lfFaceName,addr NamedFont
   INVOKE     CreateFontIndirect, addr logfont      ;Modifie    logfont:LOGFONT
   mov     retour, eax   ;retourne Hfonte
   ;invoke SendMessage,Hcontrole,WM_SETFONT,Hfonte,FALSE
   FindeCreeFont:
   mov eax,retour
   ret
CreeFont endp

note char DBh=219     >>> alt 219  "¦" on an edit and a richedit

If it those following char you want,they are only shown by an edit created by
createwindowsex.

Quote
0000003C 54 65 73 74 20      C tText db "Test ->","0",0dah,"0ÚÛÛÛÛÜ",0dch,"<- Test",0
      2D 3E 30 DA 30
      DA DB DB DB DB
      DC DC 3C 2D 20
      54 65 73 74 00
00000055 54 65 73 74 20      C ttText db "Test ->","0ÚÛÛÛÛÜ","<- Test",0
      2D 3E 30 DA DB
      DB DB DB DC 3C
      2D 20 54 65 73
      74 00

Title: Re: Porblem with Terminal font in edit control
Post by: jj2007 on September 10, 2012, 06:15:18 AM
Your code assembles fine with small changes in base.inc:

include   \masm32\include\windows.inc

uselib   MACRO   libname
   include      \masm32\include\libname.inc
   includelib   \masm32\lib\libname.lib
ENDM

When clicking OK, the black rectangle exactly as in the bmp shows up in the editbox.
Win XP SP3...

Can you use that font somewhere else, e.g. Notepad or your editor, and do you have the same problem?
Title: Re: Porblem with Terminal font in edit control
Post by: MichaelW on September 10, 2012, 08:28:24 AM
The app in the attachment displays all but the control characters for a specified font. For the terminal font the displayed characters look like the familiar (at least to us old timers) VGA character set and are apparently the same on my Windows 2000 SP4 system and my Windows XP SP3 system. But entering the character codes as Alt+N on the numeric keypad seems to work correctly only for character codes < 128.

For example, the characters 219 to 223 are supposed to be a full character-cell block, a lower half, a left half, a right half, and an upper half, just as they appear in the edit control.
Title: Re: Porblem with Terminal font in edit control
Post by: Mr.reCoder on September 10, 2012, 09:37:33 PM
@ ToutEnMasm

i use this tools and your codes but not good result!!!

(http://media.use.com/images/s_1/5d5b3fdb5d62b4ba1db0_1.jpg) (http://www.use.com/5d5b3fdb5d62b4ba1db0?p=1)

@MichaelW

i use this tool but see picture please...

(http://media.use.com/images/s_1/5d5b3fdb5d62b4ba1db0_2.jpg) (http://www.use.com/5d5b3fdb5d62b4ba1db0?p=2)


BR.
Title: Re: Porblem with Terminal font in edit control
Post by: Mr.reCoder on September 10, 2012, 09:42:05 PM
Quote from: jj2007 on September 10, 2012, 06:15:18 AM
Your code assembles fine with small changes in base.inc:

include   \masm32\include\windows.inc

uselib   MACRO   libname
   include      \masm32\include\libname.inc
   includelib   \masm32\lib\libname.lib
ENDM

When clicking OK, the black rectangle exactly as in the bmp shows up in the editbox.
Win XP SP3...

Can you use that font somewhere else, e.g. Notepad or your editor, and do you have the same problem?

No! assembly is working fine! the character 0xDB did not show! it shows like space...

BR.
Title: Re: Porblem with Terminal font in edit control
Post by: TouEnMasm on September 10, 2012, 10:24:22 PM

Quote
@ ToutEnMasm

i use this tools and your codes but not good result!!!

As I said upper ,only an edit created by createwindowsex (not a resource and not a dialog box) can give you good result.

Now,this listing (upper post also) show how the caracter you want is printed
in an edit created by createwindowsex
Did you agree with that ?

correct printed 0DBh =Û
Quote
0000003C 54 65 73 74 20      C tText db "Test ->","0",0dah,"0ÚÛÛÛÛÜ",0dch,"<- Test",0
      2D 3E 30 DA 30
      DA DB DB DB DB
      DC DC 3C 2D 20
      54 65 73 74 00
00000055 54 65 73 74 20      C ttText db "Test ->","0ÚÛÛÛÛÜ","<- Test",0
      2D 3E 30 DA DB
      DB DB DB DC 3C
      2D 20 54 65 73
      74 00





Title: Re: Porblem with Terminal font in edit control
Post by: TouEnMasm on September 10, 2012, 10:50:48 PM

the "prompt>█" (alt 219) is shown in dos mode ,here the normal ascii table works.
Seems you have to made your way between dos,windows(dialog or createwindowsex) ascii shown char.
Perhaps an another char ?
Title: Re: Porblem with Terminal font in edit control
Post by: qWord on September 11, 2012, 01:05:01 AM
Maybe a problem of the current code page - try it with DialogBoxParamW and unicode strings.
Title: Re: Porblem with Terminal font in edit control
Post by: Mr.reCoder on September 11, 2012, 01:09:49 AM

SOLVED! THANK YOU qWord and ToutEnMasm ! I LOVE YOU!!!

I USED CreateWindowExW for creating edit at run time!!!
WORKED VERY WELL!!!

SOURCE CODE ATTACHED FOR ANYONE USING....
Title: Re: Porblem with Terminal font in edit control
Post by: qWord on September 11, 2012, 01:28:04 AM
 :biggrin:
(you should get the same result by just using DialogBoxParamW in your first program)
Title: Re: Porblem with Terminal font in edit control
Post by: Mr.reCoder on September 11, 2012, 01:38:08 AM
Quote from: qWord on September 11, 2012, 01:28:04 AM
:biggrin:
(you should get the same result by just using DialogBoxParamW in your first program)

only works when using CreateWindowExW for crating edit control!! and using DialogBoxParamW alone did not work! you can test...  :t