Skip to content

Latest commit

 

History

History
47 lines (32 loc) · 1.01 KB

sample_034.md

File metadata and controls

47 lines (32 loc) · 1.01 KB

Home

Printing text on the client area of the main VFP window

Code:

DO decl

hwnd = GetActiveWindow()
hDC = GetDC (hwnd)

lpString = "Printing text with TextOut"
= TextOut (hDC, 50,80, lpString, Len(lpString)) &&

= ReleaseDC (hwnd, hDC)

PROCEDURE  decl
	DECLARE INTEGER GetDC IN user32 INTEGER hwnd

	DECLARE INTEGER ReleaseDC IN user32;
		INTEGER hwnd, INTEGER hdc

	DECLARE INTEGER GetActiveWindow IN user32

	DECLARE INTEGER TextOut IN gdi32;
		INTEGER hdc,;
		INTEGER x,;
		INTEGER y,;
		STRING  lpString,;
		INTEGER nCount  

Listed functions:

GetActiveWindow
GetDC
ReleaseDC
TextOut

Comment:

This does not work - no client area is available.

Always use GetWindowDC to access a device context, which can be used for printing and drawing on VFP windows.