According to

https://msdn.microsoft.com/en-us/library/ms725392(v=vs.85).aspx

the window handle passed to IDBPromptInitialize::PromptDataSource will be used this way:

hWndParent [in]
The parent window handle for dialog boxes to be displayed. The dialog box will always be centered within this window.

This is exactly what I would like, but it doesn't work.
The parent form is on a secondary monitor (left hand side), but the dialog is shown on the primary monitor (right hand side). It works fine when the parent form is on the primary monitor. Anybody got an idea why? Simply a bug in that API?

function TManagedFormConnEditForm.EditConnectionString(_ParentHandle: THandle;
var _ConnectionString: string): Boolean;
var
DataInit: IDataInitialize;
DBPrompt: IDBPromptInitialize;
DataSource: IUnknown;
InitStr: PWideChar;
s: WideString;
begin
DataInit := CreateComObject(CLSID_DataLinks) as IDataInitialize;
if _ConnectionString <> '' then begin
s := _ConnectionString;
DataInit.GetDataSource(nil, CLSCTX_INPROC_SERVER,
PWideChar(s), IUnknown, DataSource);
end;
DBPrompt := CreateComObject(CLSID_DataLinks) as IDBPromptInitialize;
Result := Succeeded(DBPrompt.PromptDataSource(nil, _ParentHandle,
DBPROMPTOPTIONS_PROPERTYSHEET, 0, nil, nil, IUnknown, DataSource));
if Result then begin
InitStr := nil;
DataInit.GetInitializationString(DataSource, True, InitStr);
_ConnectionString := InitStr;
end;
end;

Called as

procedure TManagedFormConnEditForm.BuildButtonClick(_Sender: TObject);
var
ConnectionString: string;
begin
ConnectionString := FConnectionStringEdit.Text;
if EditConnectionString(FForm.Handle, ConnectionString) then
FConnectionStringEdit.Text := ConnectionString;
end;
Shared publiclyView activity