Jump to content
The simFlight Network Forums

Michael A

Members
  • Posts

    21
  • Joined

  • Last visited

Posts posted by Michael A

  1. Hi guys,

    Im still having a problem with the heading equation for offset 0580.

    Code snippet below...

    var
     heading : DWord;
    begin
     FSUIPC_Read($0580, 4, @heading, dwResult);
     Hdg.Caption := FloattoStr(heading*360/(65536*65536))+'º';
    end;
    

    Its the only problem i seem to be having and it looks simple in the programmers guide.

    Any help?

    Cheers

    Mick.

  2. Hi Pete,

    Hope you didnt take that last post the wrong way matey. But thanks for the info. No I am not going to ask for a freeware key if in fact you havent done it before. I just read in about 5 different places that access keys are free if I am not intending to make people pay for my software. I understand now that it is for the "users of my software" that get it free. So in that case, i'll bite the bullet and just purchase it. If a key wasnt needed to do this simple thing, I wouldnt of been here in the first place. So you wont be asked for too much support.

    I have been writing commercial software packages for 10 years, I just found it extremely hard (after reading SDK guides several times) to understand what exactly the key was for and if needed in my situation. FSUIPC is only a hobby for me and wasnt going to be released to anyone in any case.

    Anyway, I'll just go ahead and purchase it and see what eventuates. So I will not require a key from you personally, but thanks.

    Thank you for all your help and patients (if any left - lol) and to you too CAT, I'm sure it'll all work when I purchase it.

    Kind Regards,

    Michael.

  3. Where is the application?

    For this access right, commercial and shareware products pay a fee or subscription. All genuine freeware programs get free access keys on application.

    Dont say the link on that sticky note page, they all ask for payment. How does somebody know where they issue access keys that its freeware without having a finished product first? i mean, i need a key to even get a small program that only requires an altitude read out to work. And thats going to cost me?

    If i purchase it, and find out something is not going to work, therefore not suiting the purpose, i would have wasted money?

    Anyhow, my opinion. =)

    Mick.

    Also, Pete, can you remove that email address of mine you quoted from the forum thankyou. =)

  4. CAT,

    I used exactly the source you sent me. Didnt modify it in anyway what so ever. It is just about identicle to mine too. But I'll post the .pas code here...

    //   Delphi <-> FSUIPC/WideFS Communication                       Version 1.004
    //   Copyright © 2000 by Pelle F. S. Liljendal               pelle@liljendal.dk
    //   All Rights Reserved
    //
    //   MainForm.pas
    //
    //   Example-program demostrating how to use FPCuser.pas (based on C-source
    //   by Peter Dowson)
    //
    //   (Modified by Chris Brett to add support for FS2002 UIPC compatibility.)
    //   (chris@formulate.clara.net)
    //
    //-----------------------------------------------------------------------------
    unit MainForm;
    
    interface
    
    uses
      Windows, Messages, SysUtils, Classes, Controls, Forms, StdCtrls, ExtCtrls;
    
    Const
      ResultText : Array[0..15] of String = ('Okay',
                                            'Attempt to Open when already Open',
                                            'Cannot link to FSUIPC or WideClient',
                                            'Failed to Register common message with Windows',
                                            'Failed to create Atom for mapping filename',
                                            'Failed to create a file mapping object',
                                            'Failed to open a view to the file map',
                                            'Incorrect version of FSUIPC, or not FSUIPC',
                                            'Sim is not version requested',
                                            'Call cannot execute, link not Open',
                                            'Call cannot execute: no requests accumulated',
                                            'IPC timed out all retries',
                                            'IPC sendmessage failed all retries',
                                            'IPC request contains bad data',
                                            'Maybe running on WideClient, but FS not running on Server, or wrong FSUIPC',
                                            'Read or Write request cannot be added, memory for Process is full');
      SimulationText : Array[0..6] of String = ('Any', 'FS98', 'FS2K', 'CFS2', 'CFS1', 'FLY', 'FS2002');
    
    
    type
      TFormMain = class(TForm)
        ButtonOk           : TButton;
        Timer1: TTimer;
        StaticText1: TStaticText;
        StaticText2: TStaticText;
        StaticText3: TStaticText;
        Label5: TLabel;
        Label1: TLabel;
        Label2: TLabel;
        procedure FormCreate(Sender: TObject);
        procedure FormClose(Sender: TObject; var Action: TCloseAction);
        procedure ButtonOkClick(Sender: TObject);
        procedure Timer1Timer(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;
    
    var
      FormMain: TFormMain;
    
    implementation
    
    {$R *.DFM}
    
    Uses
      FPCuser;
    
    
    procedure TFormMain.FormCreate(Sender: TObject);
    var
      dwResult : DWORD;
    begin
      // Try to connect to FSUIPC (or WideFS)
      if FSUIPC_Open(SIM_ANY, dwResult) then begin
        FormMain.Caption := FormMain.Caption + ResultText[dwResult];
        Timer1.Enabled   := True;
      end else begin
        // Unable to "Connect"
        FormMain.Caption := FormMain.Caption + ResultText[dwResult];
      end;
    end;
    
    procedure TFormMain.FormClose(Sender: TObject; var Action: TCloseAction);
    begin
      FSUIPC_Close;
    end;
    
    procedure TFormMain.ButtonOkClick(Sender: TObject);
    begin
      Close;
    end;
    
    procedure TFormMain.Timer1Timer(Sender: TObject);
    var
      dwResult:DWORD;
      height:DWord;
      Altitude:Word;
      IAS: DWord;
    begin
      Timer1.Enabled := False;  // avoids 'overlapping' of Timer events, suggest 50 to 100ms
      FSUIPC_Read($0020, 4, @height, dwResult);
      FSUIPC_Read($02BC, 4, @IAS, dwResult);
      FSUIPC_Read($0574, 2, @Altitude, dwResult);              // Altitude in meter;  * 3,28084 gives feet
      FSUIPC_Process(dwResult);
      Label5.Caption := IntToStr(round(height * 3.28084 / 256)) + ' ft';
      Label2.Caption := IntToStr(round(IAS / 128)) + ' kt';
      Label1.Caption := IntToStr(round(Altitude * 3.28084)) + ' ft';
      Timer1.Enabled := True;
    end;
    
    end.
    

    Cheers,

    Michael.

  5. Thx for the help first of all CAT =)

    Below is the code i inserted and ran.

    procedure TForm1.Timer1Timer(Sender: TObject);
    var 
      dwResult:DWORD;
      height:DWord;
      IAS: DWord;
    begin 
      Timer1.Enabled := False;  // avoids 'overlapping' of Timer events, suggest 50 to 100ms
      FSUIPC_Read($0020, 4, @height, dwResult);
      FSUIPC_Read($02BC, 4, @IAS, dwResult);
      FSUIPC_Process(dwResult); 
      Label5.Caption := IntToStr(round(height * 3.28084 / 256)) + ' ft';
      Label2.Caption := IntToStr(round(IAS / 128)) + ' kt';
      Timer1.Enabled := True; 
    end;
    

    When run, it only shows 0ft and 0kts

    Cheers,

    Mick.

  6. Im actually at work now, but I think it went something like this...

    procedure TForm1.Timer1Timer(Sender: TObject);
    var
      dwResult : DWord;
      height : DWord; //$0020 has a value of 4 ??
    begin
      FSUIPC_Read($0020, 4, @height, dwResult);
      FSUIPC_Process(dwResult);
      Label2.Caption := ?? //Whats the best solution here
    end;
    

    This is the offset for altitude only that I am trying to grab for now until I master it, then I'll expand from there. Label2 I just have as default caption of 0. When I run the program, sometimes it will display a value, sometimes it will just remove the caption and display nothing, and sometimes the caption will display something after a minute of so (without editing the code). The timer is set to 1 sec intervals. As I said, i have tried snippets from other sites but they produce the same results. Even a sample that you may have done could just trigger what is wrong.

    Cheers

    Mick

  7. Hi Pete / Everyone Else,

    If you consider this a stupid question, feel free to shoot me =)

    Ok, I program in Delphi and can successfully create a connection to FS with FSUIPC. I understand how to use FSUIPC_Read and Process. The software compiles and loads fine. However, this is my problem... when I call the process, things look wierd. Sometimes it shows a stupid number i never heard of (most likely requires * this and / that to get the correct number), or it just doesnt display anything.

    I have searched and browsed delphi/fsuipc related sites and even used their code snippets for testing, but i get the same results, either nothing displays in the label's caption or some stupid number. I have even seen it sometimes display data when it feels like it (even tho its just an altitude setting for example).

    I understand you are not fully up with Delphi Pete, but if anyone else reads this, maybe you could help too. I have read and understood all the documentation / examples.

    Hmm, i hope this was understandable to read.

    Thx,

    Mick.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.