Originally Posted by
novacain
Do the signatures match?
ie EzCreateFont declared as HFONT EzCreateFont(HDC *,wchar_t *,int,int,int,int) (name and params must be the same, wchar_t == WCHAR)
If you right click on EzCreateFont in the paint handler in Visual Studio can you go to definition? (if not check you have linked it correctly)
You could try some of the fixes here;
Linker Tools Error LNK2019
The signatures match, I believe here is the code of the paint routine
Code:
TCHAR szAppName [] = TEXT ("FontRot") ;
//TCHAR szTitle [] = TEXT ("FontRot: Rotated Fonts") ;
void PaintRoutine (HWND hwnd, HDC hdc, int cxArea, int cyArea)
{
static TCHAR szString [] = TEXT (" Rotation") ;
HFONT hFont ;
int i ;
LOGFONT lf ;
hFont = EzCreateFont(hdc, TEXT ("Times New Roman"), 540, 0, 0, 1) ;
GetObject (hFont, sizeof (LOGFONT), &lf) ;
DeleteObject (hFont) ;
SetBkMode (hdc, TRANSPARENT) ;
SetTextAlign (hdc, TA_BASELINE) ;
SetViewportOrgEx (hdc, cxArea / 2, cyArea / 2, NULL) ;
for (i = 0 ; i < 12 ; i ++)
{
lf. lfEscapement = lf. lfOrientation = i * 300 ;
SelectObject (hdc, CreateFontIndirect (&lf)) ;
TextOut (hdc, 0, 0, szString, lstrlen (szString)) ;
DeleteObject (SelectObject (hdc, GetStockObject (SYSTEM_FONT))) ;
}
}
Here is the code of Ezfont
Code:
#include<Windows.h>#include"EZFONT.h"
#include <math.h>
HFONT EZCreateFont(HDC hdc, WCHAR * szFaceName, int iDeciPtHeight, int iDeciPtWidth, int iAttributes, int fLogRes)
{
FLOAT cxDpi, cyDpi ;
HFONT hFont ;
LOGFONT lf;
POINT pt;
TEXTMETRIC tm;
...
Here is where I call the paint routine:
Code:
HDC hdc; hdc=GetDC(hWnd);
PaintRoutine (hWnd,hdc, 40, 40);
I looked up the link error tried compiling with clr support and and tried changing the debug mode as described still no success the errors described on msn where fairly cryptic even when explained but the ones I understood I looked at and couldn't find anything wrong, it's probably something obvious like wchar or statically passing a tchar with the Text routine but I am still stumped. Thanks for your patients your dealing with a pretty inexperienced coder here.