Not sure where to put this so please move to a more appropriate section if needed 
I recently wanted to use Delphi to create some software which interacts with my Smartphone (E100), looking around the internet led me to RAPI.pas but this had no instructions and two critical errors.
I've found and fixed the errors and made headway into communicating with my smartphone through Delphi applications.
(Fixed Delphi.pas attached in zip file)
There is little to no information to using RAPI and Delphi on the internet (that I could find after two days of searching) so I'm posting this here for others to benefit from
Simply add RAPI.pas to your Uses like this example:
You will initially need to connect to your device, using CeRapiInit is not recommended as your program can hang if no device is connected.
Instead use CeRapiInitEx, I use the following code (placed on a button press here) which I converted from a C++ example:
and of course once you have finished what you need to do call CeRapiUninit to close the connection.
I'll add more if anyone will find it usefull but the above (with the fixed RAPI.pas) is enough to get you started
I recently wanted to use Delphi to create some software which interacts with my Smartphone (E100), looking around the internet led me to RAPI.pas but this had no instructions and two critical errors.
I've found and fixed the errors and made headway into communicating with my smartphone through Delphi applications.
(Fixed Delphi.pas attached in zip file)
There is little to no information to using RAPI and Delphi on the internet (that I could find after two days of searching) so I'm posting this here for others to benefit from
Simply add RAPI.pas to your Uses like this example:
Quote
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls, RAPI;
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls, RAPI;
You will initially need to connect to your device, using CeRapiInit is not recommended as your program can hang if no device is connected.
Instead use CeRapiInitEx, I use the following code (placed on a button press here) which I converted from a C++ example:
procedure TForm1.Button1Click(Sender: TObject); var ri : TRapiInit; hRes : HRESULT; dwRet : DWORD; begin ri.cbSize := sizeof(ri); hRes := CeRapiInitEx(ri); dwRet := WaitForSingleObject(ri.heRapiInit, 5000); if ((dwRet <> WAIT_OBJECT_0) OR (SUCCEEDED(ri.hrRapiInit) = FALSE))then begin // Could not initialize Rapi CeRapiUninit; end // else you are connected! end;
and of course once you have finished what you need to do call CeRapiUninit to close the connection.
I'll add more if anyone will find it usefull but the above (with the fixed RAPI.pas) is enough to get you started






Sign In
Create Account


Back to top








