Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function GetAllPrivateQueues( const aMachine : WideString; aStrL : TStrings) : HRESULT;
- // Returns a list of all private queues of a given machine
- type PPWideChar = ^PWideChar;
- var props : MQMGMTPROPS;
- keys : array[0..0] of MGMTPROPID;
- vals : array[0..0] of MQPROPVARIANT;
- ppws : PPWideChar;
- i : Integer;
- begin
- // Init Props
- props.cProp := 0;
- props.aPropID := @keys;
- props.aPropVar := @vals;
- props.aStatus := nil;
- // we want private queues
- ASSERT( props.cProp < (SizeOf(keys) / SizeOf(PROPID)));
- keys[props.cProp] := PROPID_MGMT_MSMQ_PRIVATEQ;
- vals[props.cProp].vt := VT_NULL;
- Inc(props.cProp);
- // MQMgmtGetInfo() has what we want, requires MSMQ 3.0
- result := MQMgmtGetInfo( PWideChar(aMachine), MO_MACHINE_TOKEN, props);
- if FAILED(result) then Exit;
- // collect the names
- // cast required this way, the data type in ActiveX.pas (D7) is incorrect
- ppws := PPWideChar(vals[0].calpwstr.pElems);
- for i := 0 to vals[0].calpwstr.cElems-1 do begin
- aStrL.Add( ppws^);
- MQFreeMemory( ppws^);
- Inc(ppws);
- end;
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement