edit: Someone helped me fix it already. I forgot to include gdi32


I am trying to use CreateFont so I can set the font of children in my window. This is what I use:
invoke  CreateFont,16,24,0,NULL,NULL,NULL,NULL,NULL,NULL,\

NULL,NULL,NULL,NULL, addr szFontName

Now, when I try to run it, it gets this error on that line:
eq2.asm(171) : error A2006: undefined symbol : CreateFont
what's up with that?
Posted on 2001-08-30 12:11:38 by vcv
invokeCreateFont,100,30,0,0,FW_NORMAL,TRUE,1,0,OEM_CHARSET,\
OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,\
9999,DEFAULT_PITCH or FF_DECORATIVE,\
ADDR FontName
invoke SelectObject, hdc, eax
mov hfont,eax

This works for me
You have a lot of NULLS in the creation data.
Some things have to be set.

Check the win32 help file

And dont forget to select the font into the device context.
Posted on 2001-08-30 12:59:10 by titan
The compiler can't find the declaration of CreateFont. Did you include gdi32.inc ?
Posted on 2001-08-30 13:04:19 by Dr. Manhattan
Karim, yes, read the edit :P

titan, thanks, I did change those NULLs, but I'll try what you have.
Posted on 2001-08-30 13:43:02 by vcv
Just one more question, How do i get the hDC?

I tried:
	invoke	GetWindowDC, hwnd
Posted on 2001-08-30 13:46:17 by vcv
Try to use GetDC or GetDCEx

Also you can get a dc by calling BeginPaint

It will be returned in eax

e.g.
invoke BeginPaint,hWnd,ADDR ps
mov hdc,eax

The tutorial for "Painting with text" should help if you have it.
Posted on 2001-08-30 14:48:42 by titan