Calling a Dialog in a DLL (OpenInsight 32-bit Specific)
At 12 APR 2002 12:30:55PM Graeme Hall wrote:
I'm trying to invoke a modal dialog from an OI form. The dialog is in a Delphi DLL. I can happily invoke the DLL from a Delphi EXE - the Application Handle for the Dialog is the EXE's Handle. The Dialog comes up, functions as it should modally, and closes without a problem.
But when the procedure to invoke the 32-bit Dialog is called from an OI form (OEngine v4.0.1) things are a bit strange. The Dialog comes up OK, but it seems that because OEngine called it, it is "attached" to OEngine, not the OInsight form. The prototyping of the DLL seems fine (parameters are passed OK), and the Dialog appears and seems to run OK (although very slow closing) it just ain't modal to my form.
I pass the Handle to the form (the MDIChild or the MDIFrame Handle) and attempt to assign this to the DLL Application before creating the Dialog (with Application.Handle := OIHandle; MyForm := TMyForm.Create(Application); etc.), but to no avail! The OIHandle seems to be fine, but changing the DLL's Application Handle from OEngine's to an OInsight form's causes real problems - you need to be careful what other windows you touch and OEngine.EXE may crash.
How can I call a procedure in a DLL to present a modal Dialog?
Graeme
At 12 APR 2002 01:10PM [url=http://www.sprezzatura.com" onMouseOver=window.status=Click here to visit our web site?';return(true)]The Sprezzatura Group[/url] wrote:
Graeme,
Welcome to one of the major issues with an out-of-process Engine! As you've found out, Windows doesn't like the windows of one process being able to play too much with the windows of another process and both OI and OE are executed in separate processes. So, as your DLL is loaded into OE's process your going to have trouble putting it in front of an OI window. (This would seem to explain why there are focus issues with the debugger and other C tools in OI32).
We ran into this very same problem with the 32-bit Utility32 dialogs so here are a couple of ideas:
1) First try disabling your parent OI window and making sure you use the BLOCK_EVENTS property around your DLL dialog call. If that deosn't work too well (it did't for us :( ) then …
2) Create an exe to host the dialog and launch that. This is the way we did it and works well….
World Leaders in all things RevSoft
At 12 APR 2002 03:59PM Pat McNerthney wrote:
Graeme,
Try calling the SetForegroundWindow API before invoking the Dialog.In general, I do not recommend performing any UI in OpenEngine. The eventual plan is to make OpenEngine an NT Service and to also be able to attach to OpenEngnes that reside on other machines. However, at this point, there is not an alternative way of invoking 3rd party dialogs. Hopefully we'll get that one solved when OpenInsight and OpenEngine are successfully split.Pat McNerthney