Registriert seit: 10. Okt 2006
Ort: 's-Hertogenbosch, Die Niederlande
222 Beiträge
RAD-Studio 2010 Arc
|
Re: TJvObjectPickerDialog "Falscher Parameter"
31. Jan 2008, 20:27
I never used Jcl version, but this works for me:
Delphi-Quellcode:
function InitObjectPicker(Picker: IDsObjectPicker): HRESULT;
var
ScopeInit: array [0..0] of TDSOPScopeInitInfo;
InitInfo: TDSOPInitInfo;
begin
if nil = Picker then
Result := E_INVALIDARG
else
begin
ZeroMemory(@ScopeInit, SizeOf(ScopeInit));
ScopeInit[0].cbSize := SizeOf(TDSOPScopeInitInfo);
// ScopeInit[0].flType := DSOP_SCOPE_TYPE_TARGET_COMPUTER;
ScopeInit[0].flType := DSOP_SCOPE_TYPE_UPLEVEL_JOINED_DOMAIN;
ScopeInit[0].flScope := DSOP_SCOPE_TYPE_DOWNLEVEL_JOINED_DOMAIN;
ScopeInit[0].FilterFlags.Uplevel.flBothModes := DSOP_FILTER_USERS;
ScopeInit[0].FilterFlags.flDownlevel := DSOP_DOWNLEVEL_FILTER_USERS;
ZeroMemory(@InitInfo, SizeOf(InitInfo));
InitInfo.cbSize := SizeOf(InitInfo);
InitInfo.cDsScopeInfos := SizeOf(ScopeInit) div SizeOf(TDSOPScopeInitInfo);
InitInfo.aDsScopeInfos := @ScopeInit;
InitInfo.flOptions := DSOP_FLAG_SKIP_TARGET_COMPUTER_DC_CHECK;
Result := Picker.Initialize(InitInfo);
end;
end;
procedure TfrGebrAanmaken.edtGebruikerButtonClick(Sender: TObject);
var
Picker: IDsObjectPicker;
DatObj: IDataObject;
begin
if Succeeded(CoInitialize(nil)) then
try
if Succeeded(CoCreateInstance(CLSID_DsObjectPicker, nil,
CLSCTX_INPROC_SERVER, IID_IDsObjectPicker, Picker)) then
try
if Succeeded(InitObjectPicker(Picker)) then
case Picker.InvokeDialog(Self.Handle, DatObj) of
S_OK:
try
ProcessSelectedObjects(DatObj);
finally
DatObj := nil;
end;
S_FALSE:
MessageDlg('Kiezen van gebruiker afgebroken', mtWarning, [mbOK],0);
end;
finally
Picker := nil;
end;
finally
CoUninitialize;
end;
end;
|
|
Zitat
|