Results 1 to 4 of 4

Thread: RideRunner & Delphi Plugin

  1. #1
    Newbie
    Join Date
    Mar 2010
    Posts
    3

    RideRunner & Delphi Plugin

    Hello from Austria,

    i am the new guy and fan of Riderunner
    I use this great software for about 2 Months.
    Now is time to write the first plugin.
    I am working on a temperature plugin using a 1-wire USB Adapter and DS1920 sensors.
    This part is okay, my problem ist to send a message to RideRunner.
    I found this example, but i can't get it work.
    Has anybody a working example for Borland Delphiform me !?

    Thank you in advance
    Tesla76

    Code:
    unit Unit2;
    
    interface
    
    uses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls;
    
    const
      WM_COPYDATA = 74;
    
    type
      TMyCopyDataStruct = packed record
        dwData: DWORD;
        cbData: DWORD;
        lpData: Pointer;
      end;
    
    type
      TForm1 = class(TForm)
        Button1: TButton;
        Edit1: TEdit;
        procedure Button1Click(Sender: TObject);
    
      private
        procedure WMCopyData(var Msg : TWMCopyData) ; message WM_COPYDATA;
      public
        procedure SendCopyData(hTargetWnd: HWND; ACopyDataStruct:TCopyDataStruct);
      end;
    
    var
      Form1: TForm1;
      MyCopyDataStruct: TCopyDataStruct;
    
    implementation
    
    {$R *.dfm}
    
    { Use: "SENDMSG;<FORMTITLE>;<TEXT>" from RR to receive data here }
    procedure TForm1.WMCopyData(var Msg: TWMCopyData) ;
    var
      s : string;
    begin
      s := PChar(Msg.CopyDataStruct.lpData) ;
      SetLength(s, Msg.CopyDataStruct.cbData) ;
    
      // Displays Received Data
      showmessage(s);
    
      //Send something back
      msg.Result := 1;
    end;
    
    procedure TForm1.Button1Click(Sender: TObject);
    var
      txt: string;
    begin
    
      with MyCopyDataStruct do begin
        dwData := 1; // may use a value do identify content of message
        cbData := StrLen(PChar(Edit1.Text));// + 1;  //Need to transfer terminating #0 as well
        lpData := PChar(Edit1.Text)
      end;
    
      sendcopydata(findwindow(nil, 'RideRunner'), MyCopyDataStruct);
      sendcopydata(findwindow(nil, 'RoadRunner'), MyCopyDataStruct);
    
    end;
    
    procedure TForm1.SendCopyData(hTargetWnd: HWND; ACopyDataStruct:TCopyDataStruct);
    begin
      if hTargetWnd <> 0 then
        SendMessage(hTargetWnd, WM_COPYDATA, Longint(Handle), Longint(@ACopyDataStruct))
      else
        ShowMessage('No Recipient found!');
    end;
    
    end.

  2. #2
    RoadRunner Mastermind
    Auto Apps:loading...
    guino's Avatar
    Join Date
    Nov 2004
    Location
    Toronto, Canada
    Posts
    9,817
    You may want to try something like this instead..

    Code:
    procedure TForm1.InsertBtnClick(Sender: TObject);
    var
      S: string;
      RRSDK: Variant;
    begin
      try
        RRSDK := CreateOleObject('RideRunner.SDK');
      except
        ShowMessage('Could not start RR.');
        Exit;
      end;
    
      RRSDK.Execute('PLAY');
      S := RRSDK.GetInfo('TRACKNAME');
    
    end;
    I highly recommend you reading the method "3" of this link:
    http://www.mp3car.com/vbulletin/rr-f...cation-rr.html

    The method you were trying to use (while it should still work) is more complex and offers no benefit over the COM method above described.
    Ride Runner RR's Myspace

    "Being happy is not about having what you want, it's about wanting what you have."
    "The best things in life are always free - but that doesn't mean money can't buy you good things."

  3. #3
    Newbie
    Join Date
    Mar 2010
    Posts
    3
    @guino

    Thank you very much !!
    Your solution is very easy (perhaps to easy) and working like a charme !!
    I highly recommend you reading the method "3" of this link:
    http://www.mp3car.com/vbulletin/rr-f...cation-rr.html
    I read this 20 times bevore, but i don't know that creating an COM Objekt in Delphi is so easy !!
    Now my prog is updating the temperature with the SETVAR command.

    Tesla

  4. #4
    Raw Wave pierrotm777's Avatar
    Join Date
    May 2008
    Location
    Bordeaux, France
    Posts
    2,842
    That would be a good idea to have a Delphi plugin example ready to use and modify

Similar Threads

  1. Build on Mandriva 2010
    By yoshihiro in forum RevFE
    Replies: 28
    Last Post: 02-23-2010, 05:50 AM
  2. music defaults to first song on open
    By soundman98 in forum Road Runner
    Replies: 18
    Last Post: 11-23-2009, 02:36 AM
  3. Replies: 15
    Last Post: 10-21-2009, 08:09 PM
  4. Replies: 13
    Last Post: 05-28-2009, 03:18 PM
  5. pc reboot on sd startup
    By duanes7 in forum StreetDeck
    Replies: 3
    Last Post: 12-14-2007, 08:55 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •