A class name of any form Delphi is also the registered class name of the window underlying the "Windows window". Therefore, you should use the FindWindow () call to the Windows API to get the TFrmMain window handle a little something like:
hWnd := FindWindow('TFrmMain', NIL);
If there are (potentially) multiple instances of a given form class name, you can distinguish them using the 2nd parameter (Window name, ie βsignatureβ or title). If this is not enough, you may need a little more complicated and look at the EnumWindows () function and check the properties of the windows to find interest.
To check the class name of the arbirary window handle (for example, in your callback function that you use with EnumWindows ()), use GetClassName () , for example:
function GetWindowClassName(const aHWND: HWND): String; var buf: array[0..255] of Char;
Without the specific details of your specific implementation task, itβs hard to say what will most likely work best for you, but hopefully this should be enough pointers to make you move in the right direction.
Deltics
source share