Paradox Community
Search:

 Welcome |  What is Paradox |  Paradox Folk |  Paradox Solutions |
 Interactive Paradox |  Paradox Programming |  Internet/Intranet Development |
 Support Options |  Classified Ads |  Wish List |  Submissions 


Paradox Programming Articles  |  Beyond Help Articles  |  Tips & Tricks Articles  


Manipulating Paradox® Desktop Windows
© 2001 Vladimir Menkin

Introduction

Sometimes it may be necessary to determine what windows are opened on the Paradox desktop and to perform some manipulations with them. The following descriptions may help to do this. Below I will use the word "window" instead of "Paradox desktop window" to make the text more short.


Finding out what windows are on the Paradox desktop

Execute enumDesktopWindowNames(":PRIV:dwin.db"). Now we have a table with a list of all opened windows. [Note: forms opened as dialogs, are not desktop windows and can be enumerated using enumWindowNames.] The resulting table - dwin.db - is sorted according to windows Z-order, the topmost window corresponds to the last record of dwin.db. Dwin.db has several fields which have the following meaning:
Field Meaning
WindowName the window title
ClassName the window class:
Class Description
pfw7f32 tableview window
pfw27f32 form window
pfw28f32 report window
pfw30f32 library window
pfw0f32 query window
pfw37f32 editor window (code editor, SQL editor)
Afx:400000:0:0:0:707f data model designer
Afx:400000:8:14ae:10:0 Paradox toolbars
(There may be other classes, but I never needed to know their meaning.)
Position coordinate of the top left corner of the window in pixels (not twips!) relative to the screen (not to Paradox desktop!)
Size size of the window in pixels (not twips!)
Handle window handle, unique identifier assigned by Windows, allows to manipulate this window (see below)
ChildId unique identifier of the window on the Paradox desktop.
ParentHandle parent window handle
InstanceHandle 0, don't know when it has other values.

Manipulating windows

Now we know window titles and handles, and their Z-order. We can use a form type variable to attach to form, report and library windows (using their titles) and then manipulate them using standard form type methods. [Note: if there are several windows with the same title formVar.attach(WindowTitle) attaches formVar to the topmost window according to Z-order.] But we can perform some manipulations with any window using WinSendMessage() and WinPostMessage() methods. The following examples show such approach:
WinSendMessage(WindowHandle, winGetMessageId("WM_CHILDACTIVATE"), 0, 0)
...makes the corresponding window active.


WinSendMessage(AppHandle, winGetMessageId("WM_COMMAND"), SomeParadoxMenuConstant, 0)
...performs the corresponding menu action on the currently active window, see above for how to make a window active. AppHandle - the application handle - can be obtained using the following code:
Var
 AppHandle longint
 AppVar application
Endvar

AppHandle=AppVar.windowhandle()

And finally:
WinSendMessage(WindowHandle, winGetMessageId("WM_CLOSE"),0,0)
...closes the corresponding window.

Of course, there are many more window messages available, this topic covers only general principles. Hope it helps to work with desktop windows.


Summary

The basics covered above will help you to use these principles for controlling both windows open on the Paradox desktop and, by extension, other application windows open in Windows®.



Check out TechTricks.com for a similar article "Controlling Paradox with Messages" - in the Paradox section, under the "ObjectPAL: Applications and Windows Integration" category.


Discussion of this article


 Feedback |  Paradox Day |  Who Uses Paradox |  I Use Paradox |  Downloads 


 The information provided on this Web site is not in any way sponsored or endorsed by Corel Corporation.
 Paradox is a registered trademark of Corel Corporation.


 Modified: 15 May 2003
 Terms of Use / Legal Disclaimer


 Copyright © 2001- 2003 Paradox Community. All rights reserved. 
 Company and product names are trademarks or registered trademarks of their respective companies. 
 Authors hold the copyrights to their own works. Please contact the author of any article for details.