PDA

View Full Version : [FSX] Problem with reading FSUIPC OFFSET 0x07D4!


aband
02 Jul 2010, 21:52
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

rhumbaflappy
02 Jul 2010, 22:05
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 (http://forums.simflight.com/viewforum.php?f=54)

Dick

aband
03 Jul 2010, 02:20
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 (http://forums.simflight.com/viewforum.php?f=54)

Dick

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

Golf-HotelDelta
03 Jul 2010, 02:32
FSUIPC_Read(0x07D4,2, &AP.dwALT, &dwResult)

Offset 07d4 is a 4 byte value containing the altitude in metres*65536.

aband
03 Jul 2010, 13:24
Offset 07d4 is a 4 byte value containing the altitude in metres*65536.
Thanks!
That is excactly the right answer!I dont know how can I miss this!
Stay up late to work is not wise.:D