Recent

Author Topic: MsRdpClient/COM Objects in Lazarus  (Read 2715 times)

guest60499

  • Guest
MsRdpClient/COM Objects in Lazarus
« on: November 09, 2017, 09:37:40 pm »
Hello,

I found a forum topic on this issue but I still seem to be missing some vocabulary to figure out what to do. Referring to this Wiki page was helpful, but I do not know how to translate that to interaction with an MsRdpClient.

The page on LazActiveX has better information but it seems like I still need to call low-level COM functions. The documentation and projects I can find with my control of interest seem to only deal with C# and I am having a hard time translating them to C/C++ or Pascal as there seems to be lots of wrapping performed by C# and the CLR.

My goal is to be able to compile something similar to this file. I've tried this in C# but the control was nonresponsive on my form and not generating any errors (i.e. setting the server field to "127.0.0.1" and connecting did not give me the log in screen).

If this question would be a better fit for the Windows forum please feel free to move this topic.

Thanks in advance,
     guest

guest60499

  • Guest
Re: MsRdpClient/COM Objects in Lazarus
« Reply #1 on: November 12, 2017, 03:53:12 am »
If anyone could provide documentation I should refer to (to use COM/ActiveX objects from C/C++/FreePascal) that might help as well. Since it's not the hot new thing I am having problems finding references.

jamie

  • Hero Member
  • *****
  • Posts: 6090
Re: MsRdpClient/COM Objects in Lazarus
« Reply #2 on: November 12, 2017, 04:52:26 pm »
In many cases  you may need to call the "CoInitialize(Nil)" and CoUninitialize at the
start and end of our app.
I can offer you a junk test section of a app Test app for you to look at that uses the Voice engine.

procedure TForm1.Button1Click(Sender: TObject);
var
  SpVoice: olevariant;
  pt, X: olevariant;
  T: IDispatch;
  P: Dword;
  S: WideString;
  DISPID: integer;
  GUID: TGUID;
  szMember: PoleChar = 'ISpObjectToken';
  UIRequested: olevariant;// = 'EngineProperties';
  R: integer;
  OleR, OleT: olevariant;
begin

  // OleR := 0;
  UIRequested := 'EngineProperties';
  //ActiveX
  //ComObj.
  DispId := 0;
  // GUID := GUID.
  FillChar(GUID, Sizeof(GUID), 0);
  SetLength(S, 30000);
  SpVoice := CreateOleObject('SAPI.SpVoice');
  T := SpVoice;
  R := T.GetIDsOfNames(GUID, @szMember, 1, $800, @DISPID);
  Caption := IntToStr(DispId);
  // R := SpVoice.IsUISupported(UIrequested);
  OleR := 0;
  //R := SpVoice.DisplayUI(Handle, 'Title','Audio Volume');
  OleR := SpVoice.Rate;
  SpVoice.Volume := 100;
  OleR := SpVoice.Voice;
  //SpVoice.Voice := OleR;

  // Caption := IntTostr(Oler);
  SpVoice.Speak('K A 1 L P A Slow Scan', 0);

end;                               
The only true wisdom is knowing you know nothing

guest60499

  • Guest
Re: MsRdpClient/COM Objects in Lazarus
« Reply #3 on: November 16, 2017, 08:06:42 am »
Thanks jamie,

Unfortunately that seems to be specific to the OLE interface. I am expecting to have to supply a class ID (CLSID).

I am aware of the basic structure of COM objects, but I would like to use the "standard" interface as opposed to linking everything with the autogenerated C structures: https://msdn.microsoft.com/en-us/library/ms809982.

Thanks in advance,
     guest

 

TinyPortal © 2005-2018