1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

FSX Problem with reading FSUIPC OFFSET 0x07D4!

Discussion in 'Tools programming' started by aband, 3/7/10.

  1. aband

    aband

    Joined:
    3/7/10
    Messages:
    3
    Country:
    china
    Got Problem to read the Autopilot altitude !

    my envioroment:VS2008 FSX FSUIPCV4.2

    the Autopilot altitude value explained in the manual:FSUIPC4 Offsets Status.pdf

    07D4 4 Autopilot altitude value, as metres*65536 Ok Ok

    in my project
    I declare a struct:
    struct AUTOPILOT
    {
    int Status[6];
    UINT uHDG;//heading
    TCHAR szHDG[256];
    DWORD dwALT;//altitude
    TCHAR szALT[256];
    UINT uAS;//air speed
    TCHAR szAS[256];
    long lVS;//vertical speed
    TCHAR szVS[256];
    }AP;

    and I use the following function to get the value of AP' altitude:

    if (!FSUIPC_Read(0x07D4,2, &AP.dwALT, &dwResult) ||
    // If we wanted other reads/writes at the same time, we could put them here
    !FSUIPC_Process(&dwResult)) // Process the request(s)
    {
    SetDlgItemText(hwnd,IDC_EDIT_AP_ALT,TEXT("FAIL"));
    }
    else
    {
    wsprintf(AP.szALT,TEXT("%05d"),AP.dwALT/65536);
    SetDlgItemText(hwnd,IDC_EDIT_AP_ALT,AP.szALT);
    }

    but the AP.szALT always get the "00000"

    I make a break point on the "else" line,and check the value of the AP.dwALT in the debug mode,which I read in the offset 0x07D4.
    It's so weird,when the AP altitude valued in the FSX is 100,I got 31457(decimal system) from the AP.dwALT,more showed below:
    FSX AP.szALT (decimal system)
    0 00000
    100 31457
    200 32915
    300 28836

    1000 52428

    99900 34048

    I dont know what is going wrong with my code and very confuse about this.
    Very appreciate if somebody Colud help me!aband

    Posts: 1
    Joined: Tue Jun 01, 2010 8:23 am
    E-mail aband
    Last edited: 3/7/10
  2. rhumbaflappy

    rhumbaflappy Moderator Staff Member Resource contributor

    Joined:
    2/6/04
    Messages:
    2,515
    Country:
    us-wisconsin
    Occasionally Pete Dowson visits this forum, but you would have much better luck in getting an answer here, from either him or another qualified programmer:

    FSUIPC Support Pete Dowson Modules

    Dick
  3. aband

    aband

    Joined:
    3/7/10
    Messages:
    3
    Country:
    china
    Dick:
    Thanks for your reply!I have post a message in FSUIPC Support Pete Dowson Modules befor I found this Forum,Pete Dowson wont come back until 5th jul.

    Aband
  4. Golf-HotelDelta

    Golf-HotelDelta

    Joined:
    20/12/04
    Messages:
    9,762
    Country:
    unitedkingdom
    Offset 07d4 is a 4 byte value containing the altitude in metres*65536.
  5. aband

    aband

    Joined:
    3/7/10
    Messages:
    3
    Country:
    china
    Thanks!
    That is excactly the right answer!I dont know how can I miss this!
    Stay up late to work is not wise.:D

Share This Page