robben1970 0 Posted March 23, 2021 Hello i have a pc with more monitors and i can execute a delphi program in any of them. The main program could launch an external program by ShellExecute ShellExecute(Handle,'open', Pchar(progname), nil, nil, SW_SHOWNORMAL) ; but i want that the external program being showed on the same monitor where actually main program has been executed. How to get it? Or there's another way than ShellExecute? Thans for your support Share this post Link to post
Guest Posted March 23, 2021 hi @robben1970 I think this property would be given by the operating system, which controls where the windows would be opened on the standard screen. In your case, perhaps, it would be interesting to use the customization that is allowed by MSWindows to edit some properties of the batch files, for example. You can then create a ".BAT" file and edit its screen properties using the "right-button -> properties" and determine, for example, the location on the screen. Or, run this file once, and place it on the desired display. So, MSWindows will archive this information to this .bat file, do you understand? Another way, via code, would be: Find the running window And, use the SetWindowPos (,,,,,) function of the MSWindows API, to determine the position of the window on the display. To do this, you would need to use other functions, such as: FindWindow (vbNullString, TextCaptionXXX) -> to find the window by its caption retval = GetClassName (lHwnd, lpClassName, 256) to find the window class to use in SetWindowPos () but I don't have two monitors to test the latter method. hug Share this post Link to post