Exemplo n.º 1
0
LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
     HDC         hdc ;
     PAINTSTRUCT ps ;
     RECT        rect ;
     
     switch (message)
     {
     case WM_PAINT:
          hdc = BeginPaint (hwnd, &ps) ;
          
          GetClientRect (hwnd, &rect) ;
          
          EdrCenterText (hdc, &rect, 
                         TEXT ("This string was displayed by a DLL")) ;
          
          EndPaint (hwnd, &ps) ;
          return 0 ;
          
     case WM_DESTROY:
          PostQuitMessage (0) ;
          return 0 ;
     }
     return DefWindowProc (hwnd, message, wParam, lParam) ;
}
Exemplo n.º 2
0
LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	HDC                   hdc ;
	PAINTSTRUCT           ps ;
	RECT                  rect ;


	switch (message)
	{
	case WM_PAINT:
		hdc = BeginPaint (hwnd, &ps) ;
		GetClientRect (hwnd, &rect) ;

		EdrCenterText(hdc,&rect,TEXT("This string was displayed by a DLL")) ;  //调用动态链接库
		
		//使用手动连接方式
		//hLibrary = LoadLibrary (TEXT("edrlib.dll"));
		//if(hLibrary != NULL)
		//{
		//	pfnRectangle = (PFNRECT) GetProcAddress (hLibrary, TEXT ("_EdrCenterTextA@12"));
		//	if (pfnRectangle)
		//	{
		//		pfnRectangle(hdc,&rect,TEXT("This string was displayed by a DLL")) ;
		//	}
		//	FreeLibrary(hLibrary) ;
		//}

		EndPaint (hwnd, &ps) ;
		return 0 ;
	case WM_DESTROY:
		PostQuitMessage (0) ;
		return 0 ;
	}
	return DefWindowProc (hwnd, message, wParam, lParam) ;
}