In this post, you’ll learn more about HookMainWindow or DelphiVCL.Application.HookMainWindow method enables a native Windows dialog box to receive messages sent to the application’s main window. In case you’ve learned about HookMainWindow that allows you to switch applications with Alt+Tab, you may start your python journey with python for absolute beginners.
Table of Contents
How to use the HookMainWindow method properly?
Use HookMainWindow to ensure that a native Windows dialog box behaves correctly as a child of the application, not as a stand-alone window. For example, switching among applications with Alt+Tab treats the application as a single task after calling HookMainWindow, rather than treating the native Windows dialog box as a separate task.
When the window identified by the Handle property receives relevant dialog messages, it passes them to the dialog procedure passed as the Hook parameter.
There is no problem with leaving a dialog box hooked into the main window, even for extended periods. However, should the dialog box close, call the UnhookMainWindow method to release the hook.
How to browse the properties, methods, and built-in properties of the DelphiVCL.Application.HookMainWindow?
Let’s browse all the properties, methods, and built-in properties of the DelphiVCL.Application.HookMainWindow using dir() command:
1 2 3 |
import DelphiVCL dir(DelphiVCL.Application.HookMainWindow) |
See the responses in our Windows command prompt:
You can also read short information about the DelphiVCL.Application.HookMainWindow using the print() command:
1 2 |
print(DelphiVCL.Application.HookMainWindow) print(DelphiVCL.Application.HookMainWindow.__doc__) |
See the responses in our Windows command prompt:
Check out DelphiVCL which easily allows you to build GUIs for Windows using Python.