News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

win32 OEM font selection gets crumbled

Started by M4D45M, September 04, 2005, 12:51:35 PM

Previous topic - Next topic

M4D45M

hi there.

i wanted to program a nfo viewer in assembly.
the situaton is:
I use a MULTILINE EDIT CONTROL
and CreateFontIndirectA.
I set the font up with OEM_CHARSET and
FIXED kerning.

The problem:
If I selct text in the edit box, then it gets
crumbled, deleted, moved, etc.,
until it gets repainted.
If I use ANSI_CHARSET instead, then all worx
fine.
But I wanna make a NFO viewer.

I also dislike to use Richedit, cuz I only want
to view a file (no need for editig),
and I think a MULTILINE EDIT CONTOL must work
as well.
Furthermore, I use a DialogBox and I'm not
sure, but I thought that Richedit requires
a window.

can somebody please help me out, I'm totally
stuck with this.
I also didn't find anything on the net.

so thanx in advance.

Tedd

Code! Post code.
And then someone might help you fix it :wink
No snowflake in an avalanche feels responsible.

M4D45M

  .ELSEIF uMsg == WM_CTLCOLORSTATIC


   INVOKE   SendMessage, hWnd, WM_GETFONT, 0, 0
   INVOKE   GetObject, eax, SIZEOF LOGFONT, ADDR fontTerminal

   MOV   fontTerminal.lfWidth, 12
      MOV   fontTerminal.lfCharSet, OEM_CHARSET
      MOV   fontTerminal.lfPitchAndFamily, FIXED_PITCH or FF_DONTCARE
      MOV   fontTerminal.lfQuality, PROOF_QUALITY

      INVOKE   lstrcpy, ADDR fontTerminal.lfFaceName, ADDR szTerminal
   INVOKE   CreateFontIndirect, ADDR fontTerminal


;   Alternative would be:

;   INVOKE   GetStockObject, OEM_FIXED_FONT

;   but doesn't work either.



   INVOKE   SelectObject, wParam, eax

   INVOKE   SetBkMode, wParam, OPAQUE
   INVOKE   SetTextColor, wParam, CR_TEXT
   MOV   EAX, hBgColor


I can also post the 4kb executable to someone's email,
if he wants to see for himself..

thanx.

M4D45M

have to correct this..

   MOV   EAX, hBgColor
   ret

ramguru

Hi,
I tried to simulate your problem: use multiline edit control, use OEM_CHARSET, set text and background color using WM_CTLCOLORSTATIC etc. I am sorry I see no problem...

[attachment deleted by admin]

M4D45M

Someone helped me out...

The problem was that I created the font in WM_CTLCOLORSTATIC.
I was told to create the font in WM_INITDIALOG.

And it worked !


(is it better to reply to posts if it's solved or rather not ??)