Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
GDI functions doesn't work
Message
From
13/04/1998 08:15:53
 
 
To
13/04/1998 05:08:00
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00091457
Message ID:
00091476
Views:
22
>Somehow, GDI functions doesn't work in VFP. I have tried very basic
>functions like ARC,ELLIPSE etc., but couldn't got the results.
>It typically behaves like function returns .T. means it executes successfully but doesn't display the desired results on the screen.
>
>I have used this with other languages like PB and VB and runs smoothly.
>
>Anybody have idea , what could be the reason ?
>
>Thanks,
>Kaumir

I bad speak in English, but will try to explain.

GDI functions works in VFP, but you can't see results.
_Screen object has a child window where VFP display result of commands ( as ?, ?? etc.) You don't see result of paint on a screen when use a handle of a display device context retrieved by calling function GetDC() or GetDCEx() with using window handle of _Screen (main VFP window).

- First you should use function FindWindow() or GetActiveWindow() to retrieve handle of Main VFP window.

- Then it is necessary to retrieve handle of Child window you should use function ChildWindowFromPoint().

- Then, to retrieve handle of a display device context you should use function GetDC().

Sample:

declare long GetActiveWindow in win32api
declare long ChildWindowFromPoint in win32api long, long, long
declare long GetDC in win32api long
declare long ReleaseDC in win32api long, long

nhMainWindow = GetActiveWindow()
nhChildWindow = ChildWindowFromPoint( nhMainWindow, 100, 100)
nhChildDC = GetDC( nhChildWindow)
...
Now you may painting and drawing.
...
lnResult = ReleaseDC( nhChildWindow, nhChildDC)
* After painting with a common device context, the ReleaseDC function must be
* called to release the device context.

Warning:
VFP don't give without its knowledge to draw on _Screen.
So, if you anything display on the _Screen ( using of screen output commands or functions, such as ?, ?? etc.), results of functions WIN32API disappears.


Alexander Grigorjev.
Alex
Previous
Reply
Map
View

Click here to load this message in the networking platform