www.pudn.com > 5_5.rar > 5_5.cpp


#include  
#include  
#include  
 
long WINAPI WndProc(HWND hWnd,UINT iMessage,UINT wParam,LONG lParam);					//消息处理函数声明. 
 
BOOL InitWindowsClass(HINSTANCE hInstance);			//初始化窗口类声明 
BOOL InitWindows(HINSTANCE hInstance, int nCmdShow);//初始化窗口声明. 
int CALLBACK pEnumFontFamProc( 
  ENUMLOGFONT FAR *lpelf,  // pointer to logical-font data 
  NEWTEXTMETRIC FAR *lpntm,  // pointer to physical-font data 
  int FontType,            // type of font 
  LPARAM lParam            // pointer to application-defined data 
); 
  
HWND hWndMain;			//定义窗口句柄. 
int iFontSign=0;		//定义字体标志,表示采用何种字体. 
 
int WINAPI WinMain(HINSTANCE hInstance, 
				   HINSTANCE hPrevInstance, 
				   LPSTR lpCmdLine, 
				   int nCmdShow)			//主函数 
{ 
	MSG Message; 
	if(!InitWindowsClass(hInstance))		//初始化窗口类. 
		return FALSE; 
	if(!InitWindows(hInstance,nCmdShow))	//初始化窗口. 
		return FALSE; 
	while(GetMessage(&Message,0,0,0)) 
	{ 
		TranslateMessage(&Message);			//消息循环. 
		DispatchMessage(&Message); 
	} 
	return Message.wParam; 
} 
 
long WINAPI WndProc(HWND hWnd,UINT iMessage,UINT wParam,LONG lParam)			//消息处理函数. 
{ 
	HDC hDC;				//定义设备环境句柄. 
	HFONT hF;				//定义字体句柄.	 
	PAINTSTRUCT ps;			//定义包含绘图信息的结构体变量 
	TEXTMETRIC tm;			//定义包含字体信息的结构体变量. 
	static char lpsz_1[]="只有付出才有收获  ";	//定义输出的字符串. 
	char chFont[20];				//定义字体种类的字符串. 
	int X=0,Y=0,i; 
	static int nCharlen=strlen(lpsz_1);	//定义字符串长度变量. 
 
	switch(iMessage) 
	{ 
	case WM_PAINT:							//处理绘图消息. 
		hDC=BeginPaint(hWnd,&ps);		//获得设备环境指针. 
		for(i=0;i